mirror of
https://github.com/pret/pokeheartgold.git
synced 2024-11-26 22:50:22 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
e118d1e6f9
@ -133,7 +133,7 @@
|
||||
.public Save_VarsFlags_CheckHaveFollower
|
||||
.public ClearFlag965
|
||||
.public Save_VarsFlags_CheckSafariSysFlag
|
||||
.public CheckFlag996
|
||||
.public Save_VarsFlags_CheckBugContestFlag
|
||||
.public Save_VarsFlags_CheckPalParkSysFlag
|
||||
.public StrengthFlagAction
|
||||
.public CheckDisabledCianwoodWaterfall
|
||||
|
@ -23,7 +23,7 @@
|
||||
.public GameStats_Inc
|
||||
.public TaskManager_GetFieldSystem
|
||||
.public TaskManager_GetEnvironment
|
||||
.public sub_02050B90
|
||||
.public FieldSystem_StartForcedWildBattle
|
||||
.public BattleSetup_Delete
|
||||
.public GetFirstAliveMonInParty_CrashIfNone
|
||||
.public sub_0205B514
|
||||
|
@ -213,7 +213,7 @@
|
||||
.public TaskManager_GetEnvironment
|
||||
.public TaskManager_GetStatePtr
|
||||
.public sub_02050B08
|
||||
.public sub_02050B90
|
||||
.public FieldSystem_StartForcedWildBattle
|
||||
.public BattleSetup_New
|
||||
.public BattleSetup_New_SafariZone
|
||||
.public BattleSetup_New_BugContest
|
||||
@ -284,7 +284,7 @@
|
||||
.public SetFlag99C
|
||||
.public Save_VarsFlags_CheckAlphPuzzleFlag
|
||||
.public Save_VarsFlags_CheckSafariSysFlag
|
||||
.public CheckFlag996
|
||||
.public Save_VarsFlags_CheckBugContestFlag
|
||||
.public Save_VarsFlags_GetFollowerTrainerNum
|
||||
.public sub_02066BE8
|
||||
.public Save_VarsFlags_IsInRocketTakeover
|
||||
@ -462,7 +462,7 @@
|
||||
.public ov02_02246F70
|
||||
.public ov02_022470A0
|
||||
.public ov02_02247170
|
||||
.public ov02_02247374
|
||||
.public FieldSystem_ChooseHeadbuttEncounter
|
||||
.public ov02_02247F30
|
||||
.public ov02_02247F9C
|
||||
.public ov02_02249458
|
||||
|
@ -258,7 +258,7 @@
|
||||
.public CheckGameClearFlag
|
||||
.public Save_VarsFlags_MomsSavingsFlagAction
|
||||
.public Save_VarsFlags_MomsSavingsFlagCheck
|
||||
.public CheckFlag996
|
||||
.public Save_VarsFlags_CheckBugContestFlag
|
||||
.public Save_VarsFlags_FlypointFlagAction
|
||||
.public Save_VarsFlags_IsInRocketTakeover
|
||||
.public Save_VarsFlags_GetVar4057
|
||||
|
@ -118,7 +118,7 @@
|
||||
.public MapObject_GetScript
|
||||
.public sub_0205F330
|
||||
.public Save_VarsFlags_CheckSafariSysFlag
|
||||
.public CheckFlag996
|
||||
.public Save_VarsFlags_CheckBugContestFlag
|
||||
.public Save_VarsFlags_CheckPalParkSysFlag
|
||||
.public sub_02067584
|
||||
.public FieldSystem_BugContest_Get
|
||||
|
@ -1,12 +0,0 @@
|
||||
#include <nitro/fs/overlay.h>
|
||||
#pragma once
|
||||
.public AllocFromHeap
|
||||
.public FreeToHeap
|
||||
.public TouchscreenHitbox_TouchHeldIsIn
|
||||
.public TouchscreenHitbox_TouchNewIsIn
|
||||
.public System_GetTouchHeld
|
||||
.public System_GetTouchNew
|
||||
.public GF_AssertFail
|
||||
.public TouchHitboxController_Create
|
||||
.public TouchHitboxController_Destroy
|
||||
.public TouchHitboxController_IsTriggered
|
@ -105,7 +105,7 @@
|
||||
.public GetItemFieldUseFunc
|
||||
.public ItemCheckUseData_Init
|
||||
.public Save_VarsFlags_CheckSafariSysFlag
|
||||
.public CheckFlag996
|
||||
.public Save_VarsFlags_CheckBugContestFlag
|
||||
.public Save_VarsFlags_CheckPalParkSysFlag
|
||||
.public CheckGotStarter
|
||||
.public CheckGotPokegear
|
||||
|
@ -3,8 +3,8 @@
|
||||
.public GF_AssertFail
|
||||
.public MapHeader_IsKanto
|
||||
.public Save_VarsFlags_Get
|
||||
.public sub_020517E8
|
||||
.public sub_020517FC
|
||||
.public BattleSetup_GetWildTransitionEffect
|
||||
.public BattleSetup_GetWildBattleMusic
|
||||
.public GetFirstAliveMonInParty_CrashIfNone
|
||||
.public Save_VarsFlags_FlypointFlagAction
|
||||
.public GetMonData
|
||||
|
@ -4110,7 +4110,7 @@
|
||||
.short 726
|
||||
.endm
|
||||
|
||||
.macro scrcmd_727 arg0
|
||||
.macro get_follow_poke_party_index arg0
|
||||
.short 727
|
||||
.short \arg0
|
||||
.endm
|
||||
@ -4259,7 +4259,7 @@
|
||||
.short \arg2
|
||||
.endm
|
||||
|
||||
.macro scrcmd_754 arg0
|
||||
.macro try_headbutt_encounter arg0
|
||||
.short 754
|
||||
.short \arg0
|
||||
.endm
|
||||
|
@ -2231,7 +2231,7 @@ BugContestTimeoutCheck: ; 0x021E7A60
|
||||
add r5, r0, #0
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Save_VarsFlags_Get
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #0
|
||||
bne _021E7A7C
|
||||
mov r0, #0
|
||||
|
@ -96,7 +96,7 @@ _021FC6E2:
|
||||
ldr r2, [r5, #0x10]
|
||||
add r0, r4, #0
|
||||
add r1, r6, #0
|
||||
bl sub_02050B90
|
||||
bl FieldSystem_StartForcedWildBattle
|
||||
add r0, r5, #0
|
||||
bl FreeToHeap
|
||||
mov r0, #0
|
||||
|
@ -2358,7 +2358,7 @@ _02246DE0:
|
||||
bl Save_VarsFlags_CheckSafariSysFlag
|
||||
str r0, [sp, #0xc]
|
||||
ldr r0, [sp, #0x14]
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
str r0, [sp, #8]
|
||||
cmp r6, #0
|
||||
bne _02246E18
|
||||
@ -2858,7 +2858,7 @@ _022471AC:
|
||||
ldr r1, [sp, #8]
|
||||
ldr r2, [sp, #0x1c]
|
||||
add r0, r5, #0
|
||||
bl sub_02050B90
|
||||
bl FieldSystem_StartForcedWildBattle
|
||||
add sp, #0x9c
|
||||
mov r0, #1
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
@ -2867,7 +2867,7 @@ _0224721A:
|
||||
bl Save_VarsFlags_CheckSafariSysFlag
|
||||
add r6, r0, #0
|
||||
add r0, r7, #0
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
add r7, r0, #0
|
||||
ldr r0, [sp, #0xc]
|
||||
cmp r0, #0
|
||||
@ -3014,7 +3014,7 @@ _0224734C:
|
||||
ldr r1, [sp, #8]
|
||||
ldr r2, [sp, #0x1c]
|
||||
add r0, r5, #0
|
||||
bl sub_02050B90
|
||||
bl FieldSystem_StartForcedWildBattle
|
||||
b _02247360
|
||||
_0224735C:
|
||||
bl GF_AssertFail
|
||||
@ -3031,8 +3031,8 @@ _02247360:
|
||||
.balign 4, 0
|
||||
thumb_func_end ov02_02247170
|
||||
|
||||
thumb_func_start ov02_02247374
|
||||
ov02_02247374: ; 0x02247374
|
||||
thumb_func_start FieldSystem_ChooseHeadbuttEncounter
|
||||
FieldSystem_ChooseHeadbuttEncounter: ; 0x02247374
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
sub sp, #0xa8
|
||||
add r5, r0, #0
|
||||
@ -3117,7 +3117,7 @@ _0224741C:
|
||||
add sp, #0xa8
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end ov02_02247374
|
||||
thumb_func_end FieldSystem_ChooseHeadbuttEncounter
|
||||
|
||||
thumb_func_start ov02_02247424
|
||||
ov02_02247424: ; 0x02247424
|
||||
@ -3548,8 +3548,8 @@ _0224771A:
|
||||
.balign 4, 0
|
||||
thumb_func_end ov02_0224768C
|
||||
|
||||
thumb_func_start ov02_02247720
|
||||
ov02_02247720: ; 0x02247720
|
||||
thumb_func_start EncounterSlot_WildMonSlotRoll_Surfing
|
||||
EncounterSlot_WildMonSlotRoll_Surfing: ; 0x02247720
|
||||
push {r3, lr}
|
||||
bl LCRandom
|
||||
mov r1, #0x64
|
||||
@ -3586,10 +3586,10 @@ _0224775E:
|
||||
mov r0, #4
|
||||
pop {r3, pc}
|
||||
.balign 4, 0
|
||||
thumb_func_end ov02_02247720
|
||||
thumb_func_end EncounterSlot_WildMonSlotRoll_Surfing
|
||||
|
||||
thumb_func_start ov02_02247764
|
||||
ov02_02247764: ; 0x02247764
|
||||
thumb_func_start EncounterSlot_WildMonSlotRoll_Fishing
|
||||
EncounterSlot_WildMonSlotRoll_Fishing: ; 0x02247764
|
||||
push {r3, lr}
|
||||
bl LCRandom
|
||||
mov r1, #0x64
|
||||
@ -3620,10 +3620,10 @@ _02247790:
|
||||
_02247798:
|
||||
mov r0, #4
|
||||
pop {r3, pc}
|
||||
thumb_func_end ov02_02247764
|
||||
thumb_func_end EncounterSlot_WildMonSlotRoll_Fishing
|
||||
|
||||
thumb_func_start ov02_0224779C
|
||||
ov02_0224779C: ; 0x0224779C
|
||||
thumb_func_start EncounterSlot_WildMonSlotRoll_RockSmash
|
||||
EncounterSlot_WildMonSlotRoll_RockSmash: ; 0x0224779C
|
||||
push {r3, lr}
|
||||
bl LCRandom
|
||||
mov r1, #0x64
|
||||
@ -3642,10 +3642,11 @@ _022477BA:
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x18
|
||||
pop {r3, pc}
|
||||
thumb_func_end ov02_0224779C
|
||||
thumb_func_end EncounterSlot_WildMonSlotRoll_RockSmash
|
||||
|
||||
thumb_func_start ov02_022477C0
|
||||
ov02_022477C0: ; 0x022477C0
|
||||
; 50-15-15-10-5-5
|
||||
thumb_func_start EncounterSlot_WildMonSlotRoll_Headbutt
|
||||
EncounterSlot_WildMonSlotRoll_Headbutt: ; 0x022477C0
|
||||
push {r3, lr}
|
||||
bl LCRandom
|
||||
mov r1, #0x64
|
||||
@ -3681,7 +3682,7 @@ _022477F4:
|
||||
_022477FC:
|
||||
mov r0, #5
|
||||
pop {r3, pc}
|
||||
thumb_func_end ov02_022477C0
|
||||
thumb_func_end EncounterSlot_WildMonSlotRoll_Headbutt
|
||||
|
||||
thumb_func_start ApplyLeadMonHeldItemEffectToEncounterRate
|
||||
ApplyLeadMonHeldItemEffectToEncounterRate: ; 0x02247800
|
||||
@ -3773,8 +3774,8 @@ _02247890:
|
||||
pop {r4, pc}
|
||||
thumb_func_end ov02_02247854
|
||||
|
||||
thumb_func_start ov02_022478A4
|
||||
ov02_022478A4: ; 0x022478A4
|
||||
thumb_func_start EncounterSlot_WildMonLevelRoll
|
||||
EncounterSlot_WildMonLevelRoll: ; 0x022478A4
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r7, r1, #0
|
||||
ldrh r2, [r0, #6]
|
||||
@ -3831,7 +3832,7 @@ _02247908:
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x18
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end ov02_022478A4
|
||||
thumb_func_end EncounterSlot_WildMonLevelRoll
|
||||
|
||||
thumb_func_start ov02_02247910
|
||||
ov02_02247910: ; 0x02247910
|
||||
@ -4159,7 +4160,7 @@ _02247B96:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #0xc
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247BD4
|
||||
mov r0, #0xd
|
||||
@ -4172,7 +4173,7 @@ _02247B96:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #0xc
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247BD4
|
||||
bl ov02_0224768C
|
||||
@ -4204,7 +4205,7 @@ _02247BF4:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #2
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247C32
|
||||
mov r0, #0xd
|
||||
@ -4217,10 +4218,10 @@ _02247BF4:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #2
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247C32
|
||||
bl ov02_0224779C
|
||||
bl EncounterSlot_WildMonSlotRoll_RockSmash
|
||||
add r1, sp, #0x10
|
||||
strb r0, [r1]
|
||||
_02247C32:
|
||||
@ -4229,7 +4230,7 @@ _02247C32:
|
||||
add r1, r5, #0
|
||||
lsl r0, r0, #3
|
||||
add r0, r4, r0
|
||||
bl ov02_022478A4
|
||||
bl EncounterSlot_WildMonLevelRoll
|
||||
add r7, r0, #0
|
||||
b _02247D3A
|
||||
_02247C44:
|
||||
@ -4242,7 +4243,7 @@ _02247C44:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #5
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247C82
|
||||
mov r0, #0xd
|
||||
@ -4255,10 +4256,10 @@ _02247C44:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #5
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247C82
|
||||
bl ov02_02247720
|
||||
bl EncounterSlot_WildMonSlotRoll_Surfing
|
||||
add r1, sp, #0x10
|
||||
strb r0, [r1]
|
||||
_02247C82:
|
||||
@ -4267,7 +4268,7 @@ _02247C82:
|
||||
add r1, r5, #0
|
||||
lsl r0, r0, #3
|
||||
add r0, r4, r0
|
||||
bl ov02_022478A4
|
||||
bl EncounterSlot_WildMonLevelRoll
|
||||
add r7, r0, #0
|
||||
b _02247D3A
|
||||
_02247C94:
|
||||
@ -4280,7 +4281,7 @@ _02247C94:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #5
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247CD4
|
||||
mov r0, #0xd
|
||||
@ -4293,11 +4294,11 @@ _02247C94:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #5
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247CD4
|
||||
ldr r0, [sp, #0xc]
|
||||
bl ov02_02247764
|
||||
bl EncounterSlot_WildMonSlotRoll_Fishing
|
||||
add r1, sp, #0x10
|
||||
strb r0, [r1]
|
||||
_02247CD4:
|
||||
@ -4306,7 +4307,7 @@ _02247CD4:
|
||||
add r1, r5, #0
|
||||
lsl r0, r0, #3
|
||||
add r0, r4, r0
|
||||
bl ov02_022478A4
|
||||
bl EncounterSlot_WildMonLevelRoll
|
||||
add r7, r0, #0
|
||||
b _02247D3A
|
||||
_02247CE6:
|
||||
@ -4319,7 +4320,7 @@ _02247CE6:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #6
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck ; (leadMon, a2, encounterSlots, 6, TYPE_STEEL, ABILITY_MAGNET_PULL, &slot)
|
||||
cmp r0, #0
|
||||
bne _02247D24
|
||||
mov r0, #0xd
|
||||
@ -4332,10 +4333,10 @@ _02247CE6:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #6
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck ; (leadMon, a2, encounterSlots, 6, TYPE_ELECTRIC, ABILITY_STATIC, &slot)
|
||||
cmp r0, #0
|
||||
bne _02247D24
|
||||
bl ov02_022477C0
|
||||
bl EncounterSlot_WildMonSlotRoll_Headbutt
|
||||
add r1, sp, #0x10
|
||||
strb r0, [r1]
|
||||
_02247D24:
|
||||
@ -4344,7 +4345,7 @@ _02247D24:
|
||||
add r1, r5, #0
|
||||
lsl r0, r0, #3
|
||||
add r0, r4, r0
|
||||
bl ov02_022478A4
|
||||
bl EncounterSlot_WildMonLevelRoll
|
||||
add r7, r0, #0
|
||||
b _02247D3A
|
||||
_02247D36:
|
||||
@ -4473,7 +4474,7 @@ _02247E16:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #0xa
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
cmp r0, #0
|
||||
bne _02247E50
|
||||
mov r0, #0xd
|
||||
@ -4486,7 +4487,7 @@ _02247E16:
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
mov r3, #0xa
|
||||
bl ov02_02248150
|
||||
bl EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
_02247E50:
|
||||
cmp r0, #0
|
||||
bne _02247E62
|
||||
@ -4900,8 +4901,8 @@ _02248138:
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
thumb_func_end ov02_022480C0
|
||||
|
||||
thumb_func_start ov02_02248150
|
||||
ov02_02248150: ; 0x02248150
|
||||
thumb_func_start EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
EncounterSlot_AbilityInfluenceOnSlotChoiceCheck: ; 0x02248150
|
||||
push {r3, r4, r5, lr}
|
||||
ldrb r0, [r1, #0xd]
|
||||
add r5, r2, #0
|
||||
@ -4933,7 +4934,7 @@ ov02_02248150: ; 0x02248150
|
||||
_0224818C:
|
||||
mov r0, #0
|
||||
pop {r3, r4, r5, pc}
|
||||
thumb_func_end ov02_02248150
|
||||
thumb_func_end EncounterSlot_AbilityInfluenceOnSlotChoiceCheck
|
||||
|
||||
thumb_func_start ov02_02248190
|
||||
ov02_02248190: ; 0x02248190
|
||||
@ -25988,7 +25989,7 @@ _022520B8:
|
||||
lsr r0, r0, #0x18
|
||||
str r0, [sp, #0x14]
|
||||
ldr r0, [sp, #0x1c]
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
lsl r0, r0, #0x18
|
||||
lsr r0, r0, #0x18
|
||||
str r0, [sp, #0x10]
|
||||
|
@ -23564,7 +23564,7 @@ _021F2D62:
|
||||
cmp r0, #0x60
|
||||
bne _021F2D78
|
||||
ldr r0, [r5, #0x28]
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #0
|
||||
beq _021F2D78
|
||||
mov r0, #0
|
||||
@ -23595,7 +23595,7 @@ ov101_021F2D90: ; 0x021F2D90
|
||||
cmp r0, #0x60
|
||||
bne _021F2DB0
|
||||
ldr r0, [r5, #0x28]
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #0
|
||||
beq _021F2DB0
|
||||
mov r0, #0
|
||||
|
@ -3718,7 +3718,7 @@ _0225BD6A:
|
||||
pop {r3, r4, r5, pc}
|
||||
_0225BD78:
|
||||
add r0, r5, #0
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #0
|
||||
beq _0225BD86
|
||||
mov r0, #2
|
||||
|
@ -1,247 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "unk_02026C44.inc"
|
||||
.include "global.inc"
|
||||
|
||||
.rodata
|
||||
|
||||
_020F6450:
|
||||
.word sub_02026D88
|
||||
.word sub_02026DA4
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start TouchHitboxController_Create
|
||||
TouchHitboxController_Create: ; 0x02026C44
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
add r7, r1, #0
|
||||
add r5, r0, #0
|
||||
add r6, r2, #0
|
||||
str r3, [sp]
|
||||
cmp r7, #0
|
||||
bne _02026C56
|
||||
bl GF_AssertFail
|
||||
_02026C56:
|
||||
ldr r0, [sp, #0x18]
|
||||
mov r1, #0x14
|
||||
bl AllocFromHeap
|
||||
add r4, r0, #0
|
||||
beq _02026C9C
|
||||
str r5, [r4]
|
||||
str r7, [r4, #4]
|
||||
ldr r0, [sp]
|
||||
str r6, [r4, #8]
|
||||
str r0, [r4, #0xc]
|
||||
ldr r0, [sp, #0x18]
|
||||
lsl r1, r7, #2
|
||||
bl AllocFromHeap
|
||||
str r0, [r4, #0x10]
|
||||
cmp r0, #0
|
||||
beq _02026C94
|
||||
mov r6, #0
|
||||
cmp r7, #0
|
||||
bls _02026C9C
|
||||
add r5, r6, #0
|
||||
_02026C82:
|
||||
ldr r0, [r4, #0x10]
|
||||
add r0, r0, r5
|
||||
bl sub_02026CA0
|
||||
add r6, r6, #1
|
||||
add r5, r5, #4
|
||||
cmp r6, r7
|
||||
blo _02026C82
|
||||
b _02026C9C
|
||||
_02026C94:
|
||||
add r0, r4, #0
|
||||
bl FreeToHeap
|
||||
mov r4, #0
|
||||
_02026C9C:
|
||||
add r0, r4, #0
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
thumb_func_end TouchHitboxController_Create
|
||||
|
||||
thumb_func_start sub_02026CA0
|
||||
sub_02026CA0: ; 0x02026CA0
|
||||
mov r1, #0
|
||||
strb r1, [r0]
|
||||
strb r1, [r0, #1]
|
||||
strh r1, [r0, #2]
|
||||
bx lr
|
||||
.balign 4, 0
|
||||
thumb_func_end sub_02026CA0
|
||||
|
||||
thumb_func_start TouchHitboxController_Destroy
|
||||
TouchHitboxController_Destroy: ; 0x02026CAC
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
bne _02026CB6
|
||||
bl GF_AssertFail
|
||||
_02026CB6:
|
||||
ldr r0, [r4, #0x10]
|
||||
bl FreeToHeap
|
||||
add r0, r4, #0
|
||||
bl FreeToHeap
|
||||
pop {r4, pc}
|
||||
thumb_func_end TouchHitboxController_Destroy
|
||||
|
||||
thumb_func_start TouchHitboxController_IsTriggered
|
||||
TouchHitboxController_IsTriggered: ; 0x02026CC4
|
||||
push {r4, r5, r6, r7, lr}
|
||||
sub sp, #0xc
|
||||
add r5, r0, #0
|
||||
mov r0, #0
|
||||
str r0, [sp]
|
||||
bl System_GetTouchHeld
|
||||
str r0, [sp, #4]
|
||||
cmp r0, #0
|
||||
beq _02026D28
|
||||
bl System_GetTouchNew
|
||||
str r0, [sp, #8]
|
||||
ldr r0, [r5, #4]
|
||||
mov r6, #0
|
||||
cmp r0, #0
|
||||
bls _02026D46
|
||||
add r4, r6, #0
|
||||
_02026CE8:
|
||||
ldr r0, [r5, #0x10]
|
||||
add r0, r0, r4
|
||||
ldrb r0, [r0, #1]
|
||||
cmp r0, #0
|
||||
ldr r0, [r5]
|
||||
beq _02026D02
|
||||
add r0, r0, r4
|
||||
bl TouchscreenHitbox_TouchHeldIsIn
|
||||
ldr r1, [r5, #0x10]
|
||||
add r1, r1, r4
|
||||
strb r0, [r1, #1]
|
||||
b _02026D1C
|
||||
_02026D02:
|
||||
add r0, r0, r4
|
||||
bl TouchscreenHitbox_TouchNewIsIn
|
||||
ldr r1, [r5, #0x10]
|
||||
add r1, r1, r4
|
||||
strb r0, [r1, #1]
|
||||
ldr r0, [r5, #0x10]
|
||||
add r0, r0, r4
|
||||
ldrb r0, [r0, #1]
|
||||
cmp r0, #0
|
||||
beq _02026D1C
|
||||
mov r0, #1
|
||||
str r0, [sp]
|
||||
_02026D1C:
|
||||
ldr r0, [r5, #4]
|
||||
add r6, r6, #1
|
||||
add r4, r4, #4
|
||||
cmp r6, r0
|
||||
blo _02026CE8
|
||||
b _02026D46
|
||||
_02026D28:
|
||||
ldr r0, [r5, #4]
|
||||
mov r3, #0
|
||||
str r3, [sp, #8]
|
||||
cmp r0, #0
|
||||
bls _02026D46
|
||||
add r2, r3, #0
|
||||
add r1, r3, #0
|
||||
_02026D36:
|
||||
ldr r0, [r5, #0x10]
|
||||
add r3, r3, #1
|
||||
add r0, r0, r2
|
||||
strb r1, [r0, #1]
|
||||
ldr r0, [r5, #4]
|
||||
add r2, r2, #4
|
||||
cmp r3, r0
|
||||
blo _02026D36
|
||||
_02026D46:
|
||||
mov r4, #0
|
||||
cmp r0, #0
|
||||
bls _02026D7C
|
||||
add r7, r4, #0
|
||||
_02026D4E:
|
||||
ldr r3, [r5, #0x10]
|
||||
ldr r1, [sp, #4]
|
||||
add r0, r3, r7
|
||||
ldrb r3, [r3, r7]
|
||||
ldr r2, [sp, #8]
|
||||
lsl r6, r3, #2
|
||||
ldr r3, _02026D84 ; =_020F6450
|
||||
ldr r3, [r3, r6]
|
||||
blx r3
|
||||
add r1, r0, #0
|
||||
mov r0, #0
|
||||
mvn r0, r0
|
||||
cmp r1, r0
|
||||
beq _02026D72
|
||||
ldr r2, [r5, #0xc]
|
||||
ldr r3, [r5, #8]
|
||||
add r0, r4, #0
|
||||
blx r3
|
||||
_02026D72:
|
||||
ldr r0, [r5, #4]
|
||||
add r4, r4, #1
|
||||
add r7, r7, #4
|
||||
cmp r4, r0
|
||||
blo _02026D4E
|
||||
_02026D7C:
|
||||
ldr r0, [sp]
|
||||
add sp, #0xc
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
nop
|
||||
_02026D84: .word _020F6450
|
||||
thumb_func_end TouchHitboxController_IsTriggered
|
||||
|
||||
thumb_func_start sub_02026D88
|
||||
sub_02026D88: ; 0x02026D88
|
||||
push {r3, lr}
|
||||
ldrb r1, [r0, #1]
|
||||
cmp r1, #0
|
||||
beq _02026D9E
|
||||
cmp r2, #0
|
||||
beq _02026D9E
|
||||
mov r1, #1
|
||||
bl sub_02026DD8
|
||||
mov r0, #0
|
||||
pop {r3, pc}
|
||||
_02026D9E:
|
||||
mov r0, #0
|
||||
mvn r0, r0
|
||||
pop {r3, pc}
|
||||
thumb_func_end sub_02026D88
|
||||
|
||||
thumb_func_start sub_02026DA4
|
||||
sub_02026DA4: ; 0x02026DA4
|
||||
push {r3, lr}
|
||||
ldrb r2, [r0, #1]
|
||||
cmp r2, #0
|
||||
beq _02026DBC
|
||||
ldrh r2, [r0, #2]
|
||||
ldr r1, _02026DD4 ; =0x0000FFFF
|
||||
cmp r2, r1
|
||||
bhs _02026DB8
|
||||
add r1, r2, #1
|
||||
strh r1, [r0, #2]
|
||||
_02026DB8:
|
||||
mov r0, #2
|
||||
pop {r3, pc}
|
||||
_02026DBC:
|
||||
cmp r1, #0
|
||||
beq _02026DCA
|
||||
mov r1, #0
|
||||
bl sub_02026DD8
|
||||
mov r0, #3
|
||||
pop {r3, pc}
|
||||
_02026DCA:
|
||||
mov r1, #0
|
||||
bl sub_02026DD8
|
||||
mov r0, #1
|
||||
pop {r3, pc}
|
||||
.balign 4, 0
|
||||
_02026DD4: .word 0x0000FFFF
|
||||
thumb_func_end sub_02026DA4
|
||||
|
||||
thumb_func_start sub_02026DD8
|
||||
sub_02026DD8: ; 0x02026DD8
|
||||
strb r1, [r0]
|
||||
mov r1, #0
|
||||
strh r1, [r0, #2]
|
||||
bx lr
|
||||
thumb_func_end sub_02026DD8
|
@ -71,7 +71,7 @@ sub_0203BC28: ; 0x0203BC28
|
||||
_0203BC4E:
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Save_VarsFlags_Get
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #1
|
||||
bne _0203BC6A
|
||||
add r0, r5, #0
|
||||
@ -225,7 +225,7 @@ sub_0203BD64: ; 0x0203BD64
|
||||
_0203BD98:
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Save_VarsFlags_Get
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #1
|
||||
bne _0203BDB4
|
||||
add r0, r5, #0
|
||||
@ -3133,7 +3133,7 @@ sub_0203D488: ; 0x0203D488
|
||||
_0203D4CA:
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Save_VarsFlags_Get
|
||||
bl CheckFlag996
|
||||
bl Save_VarsFlags_CheckBugContestFlag
|
||||
cmp r0, #1
|
||||
bne _0203D4E4
|
||||
ldr r1, _0203D4FC ; =0x000028A4
|
||||
|
@ -203,15 +203,15 @@ _020517DC:
|
||||
_020517E4: .word _020FC40A + 2
|
||||
thumb_func_end BattleStartGetMusic
|
||||
|
||||
thumb_func_start sub_020517E8
|
||||
sub_020517E8: ; 0x020517E8
|
||||
thumb_func_start BattleSetup_GetWildTransitionEffect
|
||||
BattleSetup_GetWildTransitionEffect: ; 0x020517E8
|
||||
push {r4, lr}
|
||||
add r4, r0, #0
|
||||
bl BattleSetup_GetTransitionAndMusicParam
|
||||
add r1, r4, #0
|
||||
bl BattleStartGetTransition
|
||||
pop {r4, pc}
|
||||
thumb_func_end sub_020517E8
|
||||
thumb_func_end BattleSetup_GetWildTransitionEffect
|
||||
|
||||
thumb_func_start sub_020517F8
|
||||
sub_020517F8: ; 0x020517F8
|
||||
@ -219,8 +219,8 @@ sub_020517F8: ; 0x020517F8
|
||||
bx lr
|
||||
thumb_func_end sub_020517F8
|
||||
|
||||
thumb_func_start sub_020517FC
|
||||
sub_020517FC: ; 0x020517FC
|
||||
thumb_func_start BattleSetup_GetWildBattleMusic
|
||||
BattleSetup_GetWildBattleMusic: ; 0x020517FC
|
||||
push {r4, r5, r6, lr}
|
||||
add r5, r0, #0
|
||||
bl BattleSetup_GetTransitionAndMusicParam
|
||||
@ -271,7 +271,7 @@ _0205185C:
|
||||
.balign 4, 0
|
||||
_02051860: .word 0x0000045C
|
||||
_02051864: .word 0x00000467
|
||||
thumb_func_end sub_020517FC
|
||||
thumb_func_end BattleSetup_GetWildBattleMusic
|
||||
|
||||
thumb_func_start NPCTrainerGetBattleIntroAndMusicParam
|
||||
NPCTrainerGetBattleIntroAndMusicParam: ; 0x02051868
|
||||
|
Binary file not shown.
Binary file not shown.
2
files/arc/.gitignore
vendored
2
files/arc/.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
ppark.narc
|
||||
headbutt.*.narc
|
||||
*.o
|
||||
*.c
|
||||
*.s
|
||||
|
18733
files/arc/headbutt.json
Normal file
18733
files/arc/headbutt.json
Normal file
File diff suppressed because it is too large
Load Diff
90
files/arc/headbutt.json.txt
Normal file
90
files/arc/headbutt.json.txt
Normal file
@ -0,0 +1,90 @@
|
||||
{{ doNotModifyHeader }}
|
||||
|
||||
#include "constants/maps.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
.section .rodata
|
||||
{% for table in tables %}
|
||||
gHeadbuttMons_{{table.Map}}:
|
||||
.short {{length(table.Trees)}}
|
||||
.short {{length(table.SecretTrees)}}
|
||||
|
||||
{% if length(table.Trees) != 0 %}
|
||||
{% for mon in table.CommonMons %}
|
||||
{% if isObject(mon.species) %}
|
||||
#ifdef HEARTGOLD
|
||||
.short {{mon.species.gold}}
|
||||
#else
|
||||
.short {{mon.species.silver}}
|
||||
#endif
|
||||
{% else %}
|
||||
.short {{mon.species}}
|
||||
{% endif %}
|
||||
.byte {{mon.minLevel}}
|
||||
.byte {{mon.maxLevel}}
|
||||
{% endfor %}
|
||||
{% for i in range(6 - length(table.CommonMons)) %}
|
||||
.short SPECIES_NONE
|
||||
.byte 0
|
||||
.byte 0
|
||||
{% endfor %}
|
||||
|
||||
{% for mon in table.RareMons %}
|
||||
{% if isObject(mon.species) %}
|
||||
#ifdef HEARTGOLD
|
||||
.short {{mon.species.gold}}
|
||||
#else
|
||||
.short {{mon.species.silver}}
|
||||
#endif
|
||||
{% else %}
|
||||
.short {{mon.species}}
|
||||
{% endif %}
|
||||
.byte {{mon.minLevel}}
|
||||
.byte {{mon.maxLevel}}
|
||||
{% endfor %}
|
||||
{% for i in range(6 - length(table.RareMons)) %}
|
||||
.short SPECIES_NONE
|
||||
.byte 0
|
||||
.byte 0
|
||||
{% endfor %}
|
||||
|
||||
{% for mon in table.SecretMons %}
|
||||
{% if isObject(mon.species) %}
|
||||
#ifdef HEARTGOLD
|
||||
.short {{mon.species.gold}}
|
||||
#else
|
||||
.short {{mon.species.silver}}
|
||||
#endif
|
||||
{% else %}
|
||||
.short {{mon.species}}
|
||||
{% endif %}
|
||||
.byte {{mon.minLevel}}
|
||||
.byte {{mon.maxLevel}}
|
||||
{% endfor %}
|
||||
{% for i in range(6 - length(table.SecretMons)) %}
|
||||
.short SPECIES_NONE
|
||||
.byte 0
|
||||
.byte 0
|
||||
{% endfor %}
|
||||
|
||||
{% for tree in table.Trees %}
|
||||
{% for pos in tree %}
|
||||
.short {{pos.x}}, {{pos.y}}
|
||||
{% endfor %}
|
||||
{% for i in range(6 - length(tree) )%}
|
||||
.short -1, -1
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% for tree in table.SecretTrees %}
|
||||
{% for pos in tree %}
|
||||
.short {{pos.x}}, {{pos.y}}
|
||||
{% endfor %}
|
||||
{% for i in range(6 - length(tree) )%}
|
||||
.short -1, -1
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
.size gHeadbuttMons_{{table.Map}},.-gHeadbuttMons_{{table.Map}}
|
||||
{% endfor %}
|
10
files/arc/headbutt.mk
Normal file
10
files/arc/headbutt.mk
Normal file
@ -0,0 +1,10 @@
|
||||
HEADBUTT_DIR := files/arc/headbutt
|
||||
HEADBUTT_NARC := $(HEADBUTT_DIR).$(buildname).narc
|
||||
|
||||
$(HEADBUTT_NARC): %.$(buildname).narc: %.json %.json.txt
|
||||
$(JSONPROC) $^ $*.s
|
||||
$(WINE) $(MWAS) $(MWASFLAGS) -o $*.o $*.s
|
||||
$(O2NARC) $*.o $@ -n
|
||||
@$(RM) -f $*.s $*.o
|
||||
|
||||
FS_CLEAN_TARGETS += $(HEADBUTT_DIR).d
|
@ -1,3 +1,5 @@
|
||||
{{ doNotModifyHeader }}
|
||||
|
||||
#include "global.h"
|
||||
#include "pal_park.h"
|
||||
|
||||
|
@ -8,8 +8,9 @@ $(DATA_RESDAT_BIN): %.bin: %.json $(DATA_RESDAT_DIR).json.txt | $(WORK_DIR)/incl
|
||||
$(JSONPROC) $^ $*.c
|
||||
$(WINE) $(MWCC) $(MWCFLAGS) -c -o $*.o $*.c
|
||||
$(O2NARC) $*.o $@ -f
|
||||
@$(RM) $*.c $*.o
|
||||
|
||||
$(DATA_RESDAT_NARC): $(DATA_RESDAT_BIN)
|
||||
$(KNARC) -d $(DATA_RESDAT_DIR) -p $@ -i
|
||||
|
||||
FS_CLEAN_TARGETS += $(DATA_RESDAT_NARC) $(DATA_RESDAT_BIN:%.bin=%.c) $(DATA_RESDAT_BIN:%.bin=%.o)
|
||||
FS_CLEAN_TARGETS += $(DATA_RESDAT_NARC)
|
||||
|
@ -13,7 +13,7 @@ $(ZONE_EVENT_TEMPL):
|
||||
|
||||
$(ZONE_EVENT_JSON): $(ZONE_EVENT_TEMPL)
|
||||
|
||||
FS_CLEAN_TARGETS += $(ZONE_EVENT_NARC) $(ZONE_EVENT_O) $(ZONE_EVENT_S) $(ZONE_EVENT_BIN) $(ZONE_EVENT_DEPS)
|
||||
FS_CLEAN_TARGETS += $(ZONE_EVENT_NARC) $(ZONE_EVENT_BIN) $(ZONE_EVENT_DEPS)
|
||||
|
||||
$(ZONE_EVENT_BIN): MWASFLAGS += -DPM_ASM
|
||||
$(ZONE_EVENT_BIN): %.bin: %.json
|
||||
@ -21,4 +21,5 @@ $(ZONE_EVENT_BIN): %.bin: %.json
|
||||
@$(JSONPROC) $< $(ZONE_EVENT_TEMPL) $*.s
|
||||
@$(WINE) $(MWAS) $(MWASFLAGS) $(DEPFLAGS) -o $*.o $*.s
|
||||
@$(OBJCOPY) -O binary $*.o $@
|
||||
@$(RM) $*.s $*.o
|
||||
@echo event_data: gen $@ done
|
||||
|
@ -1,18 +1,18 @@
|
||||
PREVIEW_GRAPHIC_DIR := files/fielddata/graphic/preview_graphic/preview_graphic
|
||||
PREVIEW_GRAPHIC_NARC := $(PREVIEW_GRAPHIC_DIR).narc
|
||||
|
||||
PREVIEW_GRAPHIC_PNG := $(wildcard $(PREVIEW_GRAPHIC_DIR)/*.png)
|
||||
PREVIEW_GRAPHIC_NSCR := $(wildcard $(PREVIEW_GRAPHIC_DIR)/*.NSCR)
|
||||
|
||||
PREVIEW_GRAPHIC_NCGR := $(PREVIEW_GRAPHIC_PNG:%.png=%.NCGR)
|
||||
PREVIEW_GRAPHIC_NCLR := $(PREVIEW_GRAPHIC_PNG:%.png=%.NCLR)
|
||||
PREVIEW_GRAPHIC_NCGR_LZ := $(PREVIEW_GRAPHIC_NCGR:%.NCGR=%.NCGR.lz)
|
||||
PREVIEW_GRAPHIC_NSCR_LZ := $(PREVIEW_GRAPHIC_NSCR:%.NSCR=%.NSCR.lz)
|
||||
|
||||
8BPP_NOPAD_NCLR_PNG_FILES += $(PREVIEW_GRAPHIC_NCLR)
|
||||
VERSION101_SOPC_8BPP_NCGR_FILES += $(PREVIEW_GRAPHIC_NCGR)
|
||||
|
||||
$(PREVIEW_GRAPHIC_NARC): $(PREVIEW_GRAPHIC_NCGR_LZ) $(PREVIEW_GRAPHIC_NSCR_LZ) $(PREVIEW_GRAPHIC_NCLR)
|
||||
$(KNARC) -p $(PREVIEW_GRAPHIC_NARC) -d $(PREVIEW_GRAPHIC_DIR) -i
|
||||
|
||||
FS_CLEAN_TARGETS += $(PREVIEW_GRAPHIC_NCGR_LZ) $(PREVIEW_GRAPHIC_NSCR_LZ) $(PREVIEW_GRAPHIC_NCLR)
|
||||
PREVIEW_GRAPHIC_DIR := files/fielddata/graphic/preview_graphic/preview_graphic
|
||||
PREVIEW_GRAPHIC_NARC := $(PREVIEW_GRAPHIC_DIR).narc
|
||||
|
||||
PREVIEW_GRAPHIC_PNG := $(wildcard $(PREVIEW_GRAPHIC_DIR)/*.png)
|
||||
PREVIEW_GRAPHIC_NSCR := $(wildcard $(PREVIEW_GRAPHIC_DIR)/*.NSCR)
|
||||
|
||||
PREVIEW_GRAPHIC_NCGR := $(PREVIEW_GRAPHIC_PNG:%.png=%.NCGR)
|
||||
PREVIEW_GRAPHIC_NCLR := $(PREVIEW_GRAPHIC_PNG:%.png=%.NCLR)
|
||||
PREVIEW_GRAPHIC_NCGR_LZ := $(PREVIEW_GRAPHIC_NCGR:%.NCGR=%.NCGR.lz)
|
||||
PREVIEW_GRAPHIC_NSCR_LZ := $(PREVIEW_GRAPHIC_NSCR:%.NSCR=%.NSCR.lz)
|
||||
|
||||
8BPP_NOPAD_NCLR_PNG_FILES += $(PREVIEW_GRAPHIC_NCLR)
|
||||
VERSION101_SOPC_8BPP_NCGR_FILES += $(PREVIEW_GRAPHIC_NCGR)
|
||||
|
||||
$(PREVIEW_GRAPHIC_NARC): $(PREVIEW_GRAPHIC_NCGR_LZ) $(PREVIEW_GRAPHIC_NSCR_LZ) $(PREVIEW_GRAPHIC_NCLR)
|
||||
$(KNARC) -p $(PREVIEW_GRAPHIC_NARC) -d $(PREVIEW_GRAPHIC_DIR) -i
|
||||
|
||||
FS_CLEAN_TARGETS += $(PREVIEW_GRAPHIC_NCGR_LZ) $(PREVIEW_GRAPHIC_NSCR_LZ) $(PREVIEW_GRAPHIC_NCLR) $(PREVIEW_GRAPHIC_NARC)
|
||||
|
@ -1738,12 +1738,12 @@ scr_seq_0003_063:
|
||||
scr_seq_0003_064:
|
||||
play_se SEQ_SE_DP_SELECT
|
||||
lockall
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8005
|
||||
npc_msg msg_0040_00099
|
||||
closemsg
|
||||
scrcmd_806
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8005
|
||||
npc_msg msg_0040_00100
|
||||
wait_button
|
||||
|
@ -56,7 +56,7 @@ _009E:
|
||||
_00AD:
|
||||
get_party_slot_with_move VAR_SPECIAL_RESULT, MOVE_CUT
|
||||
copyvar VAR_SPECIAL_x8004, VAR_SPECIAL_RESULT
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
bufferpartymonnick 0, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0211_00001
|
||||
closemsg
|
||||
@ -113,7 +113,7 @@ scr_seq_0146_007:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8000
|
||||
npc_msg msg_0211_00001
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8004
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8004
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -207,7 +207,7 @@ _02E6:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8004
|
||||
npc_msg msg_0211_00005
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -267,7 +267,7 @@ scr_seq_0146_008:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8000
|
||||
npc_msg msg_0211_00005
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8004
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8004
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -376,7 +376,7 @@ _0573:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0211_00011
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -436,7 +436,7 @@ _0648:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8000
|
||||
npc_msg msg_0211_00011
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8004
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8004
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -607,7 +607,7 @@ scr_seq_0146_013:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8000
|
||||
npc_msg msg_0211_00028
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -798,7 +798,7 @@ _0AC2:
|
||||
_0AD1:
|
||||
get_party_slot_with_move VAR_SPECIAL_RESULT, MOVE_HEADBUTT
|
||||
copyvar VAR_SPECIAL_x8004, VAR_SPECIAL_RESULT
|
||||
scrcmd_727 VAR_SPECIAL_x8005
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8005
|
||||
bufferpartymonnick 0, VAR_SPECIAL_RESULT
|
||||
npc_msg msg_0211_00033
|
||||
closemsg
|
||||
@ -856,7 +856,7 @@ _0BB4:
|
||||
compare VAR_SPECIAL_x8005, 0
|
||||
goto_if_eq _0BB4
|
||||
releaseall
|
||||
scrcmd_754 VAR_SPECIAL_RESULT
|
||||
try_headbutt_encounter VAR_SPECIAL_RESULT
|
||||
end
|
||||
|
||||
scr_seq_0146_018:
|
||||
@ -865,7 +865,7 @@ scr_seq_0146_018:
|
||||
bufferpartymonnick 0, VAR_SPECIAL_x8000
|
||||
npc_msg msg_0211_00033
|
||||
closemsg
|
||||
scrcmd_727 VAR_SPECIAL_x8004
|
||||
get_follow_poke_party_index VAR_SPECIAL_x8004
|
||||
get_player_state VAR_SPECIAL_RESULT
|
||||
scrcmd_730 VAR_SPECIAL_x8006
|
||||
compare VAR_SPECIAL_RESULT, 2
|
||||
@ -920,7 +920,7 @@ _0CAA:
|
||||
compare VAR_SPECIAL_x8005, 0
|
||||
goto_if_eq _0CAA
|
||||
releaseall
|
||||
scrcmd_754 VAR_SPECIAL_RESULT
|
||||
try_headbutt_encounter VAR_SPECIAL_RESULT
|
||||
end
|
||||
|
||||
_0CC5:
|
||||
|
@ -76,7 +76,7 @@ _00B1:
|
||||
|
||||
_00E4:
|
||||
buffer_players_name 0
|
||||
scrcmd_727 VAR_SPECIAL_RESULT
|
||||
get_follow_poke_party_index VAR_SPECIAL_RESULT
|
||||
bufferpartymonnick 1, VAR_SPECIAL_RESULT
|
||||
gender_msgbox msg_0549_T20R0402_00015, msg_0549_T20R0402_00016
|
||||
closemsg
|
||||
|
@ -444,7 +444,7 @@ $(eval $(call arc_strip_name,files/pbr/dp_height_o.narc,files/a/1/9/5))
|
||||
$(eval $(call arc_strip_name,files/resource/eng/pms_aikotoba/pms_aikotoba.narc,files/a/2/1/2))
|
||||
$(eval $(call arc_strip_name,files/application/zukanlist/zukan_data/zukan_data_gira.narc,files/a/2/1/4))
|
||||
$(eval $(call arc_strip_name,files/fielddata/sodateya/kowaza_list.narc,files/a/2/2/9))
|
||||
$(eval $(call arc_strip_name,files/a/2/5/2.$(buildname),files/a/2/5/2))
|
||||
$(eval $(call arc_strip_name,files/arc/headbutt.$(buildname).narc,files/a/2/5/2))
|
||||
$(eval $(call arc_strip_name,files/application/voltorb_flip.narc,files/a/2/6/4))
|
||||
$(eval $(call arc_strip_name,files/poketool/icongra/poke_icon/poke_icon.narc,files/a/0/2/0))
|
||||
|
||||
@ -502,6 +502,7 @@ include files/application/voltorb_flip.mk
|
||||
include files/application/annon/puzzle_gra.mk
|
||||
include files/data/resdat.mk
|
||||
include files/demo/title/titledemo.mk
|
||||
include files/arc/headbutt.mk
|
||||
include files/poketool/personal/personal.mk
|
||||
include files/fielddata/graphic/preview_graphic/preview_graphic.mk
|
||||
|
||||
|
@ -23,7 +23,7 @@ typedef struct WildEncounter {
|
||||
|
||||
void CallTask_020509F0(TaskManager *taskManager, BattleSetup *battleSetup, s32 effect, s32 bgm, u32 *winFlag);
|
||||
void sub_02050B08(FieldSystem *fieldSystem, BattleSetup *setup);
|
||||
void sub_02050B90(FieldSystem *fieldSystem, TaskManager *taskManager, BattleSetup *setup);
|
||||
void FieldSystem_StartForcedWildBattle(FieldSystem *fieldSystem, TaskManager *taskManager, BattleSetup *setup);
|
||||
void SetupAndStartWildBattle(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canFlee, BOOL shiny);
|
||||
void SetupAndStartFatefulWildBattle(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canRun);
|
||||
void sub_020511F8(FieldSystem *fieldSystem, BattleSetup *setup);
|
||||
|
19
include/field/headbutt.h
Normal file
19
include/field/headbutt.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef POKEHEARTGOLD_FIELD_HEADBUTT_H
|
||||
#define POKEHEARTGOLD_FIELD_HEADBUTT_H
|
||||
|
||||
typedef struct HeadbuttSlot {
|
||||
u16 species;
|
||||
u8 minLevel;
|
||||
u8 maxLevel;
|
||||
} HeadbuttSlot;
|
||||
|
||||
typedef struct HeadbuttEncounterData {
|
||||
u16 numRegularTrees;
|
||||
u16 numSecretTrees;
|
||||
HeadbuttSlot common[6];
|
||||
HeadbuttSlot rare[6];
|
||||
HeadbuttSlot secret[6];
|
||||
s16 treeCoords[][2];
|
||||
} HeadbuttEncounterData;
|
||||
|
||||
#endif //POKEHEARTGOLD_FIELD_HEADBUTT_H
|
@ -259,7 +259,7 @@ typedef enum NarcId
|
||||
NARC_a_2_4_9 = 251,
|
||||
NARC_a_2_5_0 = 252,
|
||||
NARC_a_2_5_1 = 253,
|
||||
NARC_a_2_5_2 = 254,
|
||||
NARC_arc_headbutt = 254,
|
||||
NARC_a_2_5_3 = 255,
|
||||
NARC_a_2_5_4 = 256,
|
||||
NARC_a_2_5_5 = 257,
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef POKEHEARTGOLD_OV_01_02204ED8_H
|
||||
#define POKEHEARTGOLD_OV_01_02204ED8_H
|
||||
|
||||
void ov01_02204ED8(FieldSystem *fieldSystem, u16 *varPointer);
|
||||
void FieldSystem_TryHeadbuttEncounter(FieldSystem *fieldSystem, u16 *varPointer);
|
||||
|
||||
#endif //POKEHEARTGOLD_OV_01_02204ED8_H
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "script.h"
|
||||
#include "sys_task.h"
|
||||
#include "unk_0203BC10.h"
|
||||
#include "field/headbutt.h"
|
||||
|
||||
struct FieldLongWarpTaskData;
|
||||
|
||||
@ -98,7 +99,7 @@ BOOL ov02_02253188(SaveData *saveData);
|
||||
int ov02_022531B4(SaveData *saveData);
|
||||
BOOL ov02_022470A0(FieldSystem *fieldSystem, BattleSetup **setupPtr);
|
||||
void ov02_BattleExit_HandleRoamerAction(FieldSystem *fieldSystem, BattleSetup *setup);
|
||||
BOOL ov02_02247374(FieldSystem *fieldSystem, BattleSetup **setup, void *arg2);
|
||||
BOOL FieldSystem_ChooseHeadbuttEncounter(FieldSystem *fieldSystem, BattleSetup **setup, const HeadbuttSlot *headbuttSlots);
|
||||
void ov02_02247F30(FieldSystem *fieldSystem, u16 mon, u8 level, BOOL shiny, BattleSetup *setup);
|
||||
void ov02_02246714(TaskManager *man, u32 a1, u32 a2, u32 a3, u32 a4);
|
||||
void ov02_022469B4(TaskManager *man, LocalMapObject *obj1, LocalMapObject *obj2);
|
||||
|
@ -761,7 +761,7 @@ BOOL ScrCmd_723(ScriptContext* ctx);
|
||||
BOOL ScrCmd_724(ScriptContext* ctx);
|
||||
BOOL ScrCmd_725(ScriptContext* ctx);
|
||||
BOOL ScrCmd_726(ScriptContext* ctx);
|
||||
BOOL ScrCmd_727(ScriptContext* ctx);
|
||||
BOOL ScrCmd_GetFollowPokePartyIndex(ScriptContext* ctx);
|
||||
BOOL ScrCmd_728(ScriptContext* ctx);
|
||||
BOOL ScrCmd_729(ScriptContext* ctx);
|
||||
BOOL ScrCmd_730(ScriptContext* ctx);
|
||||
@ -788,7 +788,7 @@ BOOL ScrCmd_MenuInit(ScriptContext* ctx);
|
||||
BOOL ScrCmd_MenuItemAdd(ScriptContext* ctx);
|
||||
BOOL ScrCmd_MenuExec(ScriptContext* ctx);
|
||||
BOOL ScrCmd_RockSmashItemCheck(ScriptContext* ctx);
|
||||
BOOL ScrCmd_754(ScriptContext* ctx);
|
||||
BOOL ScrCmd_TryHeadbuttEncounter(ScriptContext* ctx);
|
||||
BOOL ScrCmd_755(ScriptContext* ctx);
|
||||
BOOL ScrCmd_756(ScriptContext* ctx);
|
||||
BOOL ScrCmd_757(ScriptContext* ctx);
|
||||
|
@ -36,7 +36,7 @@ void ClearFlag975(SaveVarsFlags* state);
|
||||
void Save_VarsFlags_SetSafariSysFlag(SaveVarsFlags* state);
|
||||
void Save_VarsFlags_ClearSafariSysFlag(SaveVarsFlags* state);
|
||||
BOOL Save_VarsFlags_CheckSafariSysFlag(SaveVarsFlags* state);
|
||||
BOOL CheckFlag996(SaveVarsFlags* state);
|
||||
BOOL Save_VarsFlags_CheckBugContestFlag(SaveVarsFlags* state);
|
||||
void Save_VarsFlags_SetPalParkSysFlag(SaveVarsFlags* state);
|
||||
void Save_VarsFlags_ClearPalParkSysFlag(SaveVarsFlags* state);
|
||||
BOOL Save_VarsFlags_CheckPalParkSysFlag(SaveVarsFlags* state);
|
||||
|
27
include/touch_hitbox_controller.h
Normal file
27
include/touch_hitbox_controller.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef POKEHEARTGOLD_TOUCH_HITBOX_CONTROLLER_H
|
||||
#define POKEHEARTGOLD_TOUCH_HITBOX_CONTROLLER_H
|
||||
|
||||
#include "heap.h"
|
||||
#include "touchscreen.h"
|
||||
|
||||
typedef struct TouchHitboxControllerTemplate {
|
||||
u8 unkCallbackNum;
|
||||
u8 touchActive; // FIXME: bool8
|
||||
u16 numFramesActive; // unused, only read in one place to make sure it doesn't overflow
|
||||
} TouchHitboxControllerTemplate;
|
||||
|
||||
typedef void (*TouchHitboxControllerCallback)(u32 index, u32 event, void *arg);
|
||||
|
||||
typedef struct TouchHitboxController {
|
||||
const TouchscreenHitbox *hitboxes;
|
||||
u32 numTemplates;
|
||||
TouchHitboxControllerCallback callback;
|
||||
void *callbackArg;
|
||||
TouchHitboxControllerTemplate *templates;
|
||||
} TouchHitboxController;
|
||||
|
||||
TouchHitboxController *TouchHitboxController_Create(const TouchscreenHitbox *hitboxes, u32 num_templates, TouchHitboxControllerCallback callback, void *callbackArg, HeapID heapId);
|
||||
BOOL TouchHitboxController_IsTriggered(TouchHitboxController *controller);
|
||||
void TouchHitboxController_Destroy(TouchHitboxController *controller);
|
||||
|
||||
#endif //POKEHEARTGOLD_TOUCH_HITBOX_CONTROLLER_H
|
@ -1,13 +0,0 @@
|
||||
#ifndef POKEHEARTGOLD_UNK_02026C44_H
|
||||
#define POKEHEARTGOLD_UNK_02026C44_H
|
||||
|
||||
#include "heap.h"
|
||||
#include "touchscreen.h"
|
||||
|
||||
typedef struct TouchHitboxController TouchHitboxController;
|
||||
|
||||
TouchHitboxController *TouchHitboxController_Create(const TouchscreenHitbox *hitboxes, u32 num_templates, void (*callback)(u32, u32, void *), void *arg, HeapID heapId);
|
||||
BOOL TouchHitboxController_IsTriggered(TouchHitboxController *controller);
|
||||
void TouchHitboxController_Destroy(TouchHitboxController *controller);
|
||||
|
||||
#endif //POKEHEARTGOLD_UNK_02026C44_H
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "battle/battle_setup.h"
|
||||
|
||||
int sub_020517E8(BattleSetup *setup);
|
||||
int sub_020517FC(BattleSetup *setup);
|
||||
int BattleSetup_GetWildTransitionEffect(BattleSetup *setup);
|
||||
int BattleSetup_GetWildBattleMusic(BattleSetup *setup);
|
||||
|
||||
#endif
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "heap.h"
|
||||
#include "bg_window.h"
|
||||
#include "palette.h"
|
||||
#include "unk_02026C44.h"
|
||||
#include "touch_hitbox_controller.h"
|
||||
|
||||
typedef enum YesNoResponse {
|
||||
YESNORESPONSE_WAIT = 0,
|
||||
|
4
main.lsf
4
main.lsf
@ -87,7 +87,7 @@ Static main
|
||||
Object asm/unk_02025C44.o
|
||||
Object src/font_data.o
|
||||
Object src/pm_string.o
|
||||
Object asm/unk_02026C44.o
|
||||
Object src/touch_hitbox_controller.o
|
||||
Object asm/unk_02026DE0.o
|
||||
Object src/unk_02026E30.o
|
||||
Object asm/unk_02026E84.o
|
||||
@ -514,7 +514,7 @@ Overlay field
|
||||
Object asm/overlay_01_02204004.o
|
||||
Object src/field/overlay_01_apricorn_tree_anim.o
|
||||
Object src/field/overlay_01_rock_smash_item.o
|
||||
Object src/overlay_01_02204ED8.o
|
||||
Object src/field/headbutt.o
|
||||
Object asm/overlay_01_022051EC.o
|
||||
Object asm/overlay_01_022053EC.o
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ void sub_0205239C(BattleSetup* setup, FieldSystem* fieldSystem) {
|
||||
vars_flags = Save_VarsFlags_Get(fieldSystem->saveData);
|
||||
if (Save_VarsFlags_CheckSafariSysFlag(vars_flags)) {
|
||||
balls_ptr = LocalFieldData_GetSafariBallsCounter(Save_LocalFieldData_Get(fieldSystem->saveData));
|
||||
} else if (CheckFlag996(vars_flags)) {
|
||||
} else if (Save_VarsFlags_CheckBugContestFlag(vars_flags)) {
|
||||
balls_ptr = BugContest_GetSportBallsAddr(FieldSystem_BugContest_Get(fieldSystem));
|
||||
}
|
||||
if (balls_ptr != NULL) {
|
||||
|
@ -726,7 +726,7 @@ BOOL ScrCmd_723(ScriptContext *ctx);
|
||||
BOOL ScrCmd_724(ScriptContext *ctx);
|
||||
BOOL ScrCmd_725(ScriptContext *ctx);
|
||||
BOOL ScrCmd_726(ScriptContext *ctx);
|
||||
BOOL ScrCmd_727(ScriptContext *ctx);
|
||||
BOOL ScrCmd_GetFollowPokePartyIndex(ScriptContext *ctx);
|
||||
BOOL ScrCmd_728(ScriptContext *ctx);
|
||||
BOOL ScrCmd_729(ScriptContext *ctx);
|
||||
BOOL ScrCmd_730(ScriptContext *ctx);
|
||||
@ -753,7 +753,7 @@ BOOL ScrCmd_MenuInit(ScriptContext *ctx);
|
||||
BOOL ScrCmd_MenuItemAdd(ScriptContext *ctx);
|
||||
BOOL ScrCmd_MenuExec(ScriptContext *ctx);
|
||||
BOOL ScrCmd_RockSmashItemCheck(ScriptContext *ctx);
|
||||
BOOL ScrCmd_754(ScriptContext *ctx);
|
||||
BOOL ScrCmd_TryHeadbuttEncounter(ScriptContext *ctx);
|
||||
BOOL ScrCmd_755(ScriptContext *ctx);
|
||||
BOOL ScrCmd_756(ScriptContext *ctx);
|
||||
BOOL ScrCmd_757(ScriptContext *ctx);
|
||||
@ -1581,7 +1581,7 @@ const ScrCmdFunc gScriptCmdTable[] = {
|
||||
ScrCmd_724,
|
||||
ScrCmd_725,
|
||||
ScrCmd_726,
|
||||
ScrCmd_727,
|
||||
ScrCmd_GetFollowPokePartyIndex,
|
||||
ScrCmd_728,
|
||||
ScrCmd_729,
|
||||
ScrCmd_730,
|
||||
@ -1608,7 +1608,7 @@ const ScrCmdFunc gScriptCmdTable[] = {
|
||||
ScrCmd_MenuItemAdd,
|
||||
ScrCmd_MenuExec,
|
||||
ScrCmd_RockSmashItemCheck,
|
||||
ScrCmd_754,
|
||||
ScrCmd_TryHeadbuttEncounter,
|
||||
ScrCmd_755,
|
||||
ScrCmd_756,
|
||||
ScrCmd_757,
|
||||
|
@ -316,13 +316,13 @@ static void WildEncounter_Delete(WildEncounter *encounter) {
|
||||
|
||||
void sub_02050B08(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
SaveVarsFlags *flags = Save_VarsFlags_Get(fieldSystem->saveData);
|
||||
s32 effect = sub_020517E8(setup);
|
||||
s32 bgm = sub_020517FC(setup);
|
||||
s32 effect = BattleSetup_GetWildTransitionEffect(setup);
|
||||
s32 bgm = BattleSetup_GetWildBattleMusic(setup);
|
||||
|
||||
if (Save_VarsFlags_CheckSafariSysFlag(flags)) {
|
||||
Encounter *encounter = Encounter_New(setup, effect, bgm, NULL);
|
||||
FieldSystem_CreateTask(fieldSystem, Task_SafariEncounter, encounter);
|
||||
} else if (CheckFlag996(flags)) {
|
||||
} else if (Save_VarsFlags_CheckBugContestFlag(flags)) {
|
||||
Encounter *encounter = Encounter_New(setup, effect, bgm, NULL);
|
||||
FieldSystem_CreateTask(fieldSystem, Task_BugContestEncounter, encounter);
|
||||
} else {
|
||||
@ -331,15 +331,15 @@ void sub_02050B08(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_02050B90(FieldSystem *fieldSystem, TaskManager *taskManager, BattleSetup *setup) {
|
||||
void FieldSystem_StartForcedWildBattle(FieldSystem *fieldSystem, TaskManager *taskManager, BattleSetup *setup) {
|
||||
SaveVarsFlags *flags = Save_VarsFlags_Get(fieldSystem->saveData);
|
||||
s32 effect = sub_020517E8(setup);
|
||||
s32 bgm = sub_020517FC(setup);
|
||||
s32 effect = BattleSetup_GetWildTransitionEffect(setup);
|
||||
s32 bgm = BattleSetup_GetWildBattleMusic(setup);
|
||||
|
||||
if (Save_VarsFlags_CheckSafariSysFlag(flags)) {
|
||||
Encounter *encounter = Encounter_New(setup, effect, bgm, NULL);
|
||||
TaskManager_Jump(taskManager, Task_SafariEncounter, encounter);
|
||||
} else if (CheckFlag996(flags)) {
|
||||
} else if (Save_VarsFlags_CheckBugContestFlag(flags)) {
|
||||
Encounter *encounter = Encounter_New(setup, effect, bgm, NULL);
|
||||
TaskManager_Jump(taskManager, Task_BugContestEncounter, encounter);
|
||||
} else {
|
||||
@ -554,7 +554,7 @@ void SetupAndStartWildBattle(TaskManager *taskManager, u16 species, u8 level, u3
|
||||
|
||||
GameStats_Inc(Save_GameStats_Get(fieldSystem->saveData), GAME_STAT_UNK8);
|
||||
|
||||
CallTask_StartEncounter(taskManager, setup, sub_020517E8(setup), sub_020517FC(setup), winFlag);
|
||||
CallTask_StartEncounter(taskManager, setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), winFlag);
|
||||
}
|
||||
|
||||
void SetupAndStartFatefulWildBattle(TaskManager *taskManager, u16 species, u8 level, u32 *winFlag, BOOL canRun) {
|
||||
@ -574,7 +574,7 @@ void SetupAndStartFatefulWildBattle(TaskManager *taskManager, u16 species, u8 le
|
||||
|
||||
GameStats_Inc(Save_GameStats_Get(fieldSystem->saveData), GAME_STAT_UNK8);
|
||||
|
||||
CallTask_StartEncounter(taskManager, setup, sub_020517E8(setup), sub_020517FC(setup), winFlag);
|
||||
CallTask_StartEncounter(taskManager, setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), winFlag);
|
||||
}
|
||||
|
||||
static BOOL Task_PalParkEncounter(TaskManager *taskManager) {
|
||||
@ -628,7 +628,7 @@ static BOOL Task_PalParkEncounter(TaskManager *taskManager) {
|
||||
}
|
||||
|
||||
void sub_020511F8(FieldSystem *fieldSystem, BattleSetup *setup) {
|
||||
Encounter *encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
Encounter *encounter = Encounter_New(setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
FieldSystem_CreateTask(fieldSystem, Task_PalParkEncounter, encounter);
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ void SetupAndStartFirstBattle(TaskManager *taskManager, u16 species, u8 level) {
|
||||
|
||||
GameStats_Inc(Save_GameStats_Get(fieldSystem->saveData), GAME_STAT_UNK8);
|
||||
|
||||
CallTask_StartEncounter(taskManager, setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
CallTask_StartEncounter(taskManager, setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
}
|
||||
|
||||
static BOOL Task_TutorialBattle(TaskManager *taskManager) {
|
||||
@ -690,7 +690,7 @@ void SetupAndStartTutorialBattle(TaskManager *taskManager) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
|
||||
setup = BattleSetup_New_Tutorial(HEAP_ID_FIELD, fieldSystem);
|
||||
encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
encounter = Encounter_New(setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
|
||||
TaskManager_Call(taskManager, Task_TutorialBattle, encounter);
|
||||
}
|
||||
@ -734,7 +734,7 @@ void SetupAndStartTrainerBattle(TaskManager *taskManager, u32 opponentTrainer1,
|
||||
}
|
||||
}
|
||||
|
||||
CallTask_StartEncounter(taskManager, setup, sub_020517E8(setup), sub_020517FC(setup), winFlag);
|
||||
CallTask_StartEncounter(taskManager, setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), winFlag);
|
||||
}
|
||||
|
||||
void CallTask_020508B8(TaskManager *taskManager, void *param1, u32 battleType) {
|
||||
@ -746,7 +746,7 @@ void CallTask_020508B8(TaskManager *taskManager, void *param1, u32 battleType) {
|
||||
|
||||
sub_020522F0(setup, fieldSystem, param1);
|
||||
|
||||
encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
encounter = Encounter_New(setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
TaskManager_Call(taskManager, Task_020508B8, encounter);
|
||||
}
|
||||
|
||||
@ -798,7 +798,7 @@ void CallTask_02050960(TaskManager *taskManager, s32 target, s32 maxLevel, u32 f
|
||||
|
||||
setup->unk1B2 = mode;
|
||||
|
||||
encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
encounter = Encounter_New(setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
encounter->unkC = target;
|
||||
|
||||
TaskManager_Call(taskManager, Task_02050960, encounter);
|
||||
@ -834,7 +834,7 @@ void sub_02051598(FieldSystem *fieldSystem, void *param1, s32 battleType) {
|
||||
|
||||
setup->unk1B2 = sub_02051474(fieldSystem->unkA4, battleType);
|
||||
|
||||
encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
encounter = Encounter_New(setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
|
||||
FieldSystem_CreateTask(fieldSystem, sub_02051540, encounter);
|
||||
}
|
||||
@ -849,7 +849,7 @@ void sub_020515FC(FieldSystem *fieldSystem, Party *party, s32 battleType) {
|
||||
|
||||
setup->unk1B2 = sub_02051474(fieldSystem->unkA4, battleType);
|
||||
|
||||
encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL);
|
||||
encounter = Encounter_New(setup, BattleSetup_GetWildTransitionEffect(setup), BattleSetup_GetWildBattleMusic(setup), NULL);
|
||||
|
||||
FieldSystem_CreateTask(fieldSystem, sub_02051540, encounter);
|
||||
}
|
||||
|
235
src/field/headbutt.c
Normal file
235
src/field/headbutt.c
Normal file
@ -0,0 +1,235 @@
|
||||
#include "global.h"
|
||||
#include "field/headbutt.h"
|
||||
#include "assert.h"
|
||||
#include "encounter.h"
|
||||
#include "follow_mon.h"
|
||||
#include "field_map_object.h"
|
||||
#include "fieldmap.h"
|
||||
#include "filesystem.h"
|
||||
#include "heap.h"
|
||||
#include "overlay_01_021EDAFC.h"
|
||||
#include "overlay_01_02204ED8.h"
|
||||
#include "overlay_02.h"
|
||||
#include "player_data.h"
|
||||
#include "scrcmd.h"
|
||||
#include "script.h"
|
||||
#include "task.h"
|
||||
#include "unk_0205CB48.h"
|
||||
#include "unk_0205FD20.h"
|
||||
|
||||
static BOOL Task_TryHeadbuttEncounter(TaskManager *taskManager);
|
||||
static s8 Headbutt_GetTreeTypeFromTable(u16 numRegularTrees, u16 numSecretTrees, u32 trainerId, u32 x, u32 y, s16 treeCoords[][2]);
|
||||
static s8 Headbutt_GetTreeType_Regular(u8 whichTree, u8 numTrees, u32 trainerId);
|
||||
static void GetCoordsOfFacingTree(FieldSystem *fieldSystem, u32 *x, u32 *y);
|
||||
|
||||
enum TreeType {
|
||||
TREETYPE_COMMON,
|
||||
TREETYPE_RARE,
|
||||
TREETYPE_SECRET,
|
||||
TREETYPE_NONE = -1
|
||||
};
|
||||
|
||||
static const s8 sRareTreeLUT_1[][1] = {
|
||||
{TREETYPE_COMMON},
|
||||
{TREETYPE_RARE},
|
||||
{TREETYPE_COMMON},
|
||||
{TREETYPE_RARE},
|
||||
{TREETYPE_COMMON},
|
||||
{TREETYPE_RARE},
|
||||
{TREETYPE_COMMON},
|
||||
{TREETYPE_RARE},
|
||||
{TREETYPE_COMMON},
|
||||
{TREETYPE_RARE},
|
||||
{TREETYPE_COMMON},
|
||||
{TREETYPE_COMMON},
|
||||
};
|
||||
|
||||
static const s8 sRareTreeLUT_2[][2] = {
|
||||
{TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{TREETYPE_RARE, TREETYPE_COMMON},
|
||||
};
|
||||
|
||||
static const s8 sRareTreeLUT_3[][3] = {
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE},
|
||||
{ TREETYPE_COMMON, TREETYPE_NONE, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_NONE},
|
||||
{ TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON},
|
||||
{TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{TREETYPE_NONE, TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE},
|
||||
{ TREETYPE_COMMON, TREETYPE_NONE, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_NONE},
|
||||
{ TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON},
|
||||
};
|
||||
|
||||
static const s8 sRareTreeLUT_4[][4] = {
|
||||
{TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_COMMON},
|
||||
{ TREETYPE_RARE, TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_RARE, TREETYPE_NONE},
|
||||
{ TREETYPE_COMMON, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_RARE},
|
||||
{TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{ TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON},
|
||||
{ TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
};
|
||||
|
||||
static const s8 sRareTreeLUT_5Plus[][5] = {
|
||||
{TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_COMMON},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON},
|
||||
{ TREETYPE_COMMON, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_RARE, TREETYPE_NONE},
|
||||
{TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_COMMON},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON, TREETYPE_RARE},
|
||||
{ TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE, TREETYPE_COMMON},
|
||||
{ TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_COMMON, TREETYPE_RARE, TREETYPE_NONE},
|
||||
};
|
||||
|
||||
typedef struct TaskData_TryHeadbuttEncounter {
|
||||
u16 *resultPtr;
|
||||
} TaskData_TryHeadbuttEncounter;
|
||||
|
||||
void FieldSystem_TryHeadbuttEncounter(FieldSystem *fieldSystem, u16 *varPointer) {
|
||||
TaskData_TryHeadbuttEncounter *didHeadbuttStartBattle = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(didHeadbuttStartBattle));
|
||||
didHeadbuttStartBattle->resultPtr = varPointer;
|
||||
*varPointer = FALSE;
|
||||
TaskManager_Call(fieldSystem->taskman, Task_TryHeadbuttEncounter, didHeadbuttStartBattle);
|
||||
}
|
||||
|
||||
static BOOL Task_TryHeadbuttEncounter(TaskManager *taskManager) {
|
||||
HeadbuttEncounterData *headbuttTable;
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
TaskData_TryHeadbuttEncounter *didHeadbuttStartBattle = TaskManager_GetEnvironment(taskManager);
|
||||
headbuttTable = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_arc_headbutt, fieldSystem->location->mapId, HEAP_ID_FIELD);
|
||||
if (headbuttTable->numRegularTrees != 0 || headbuttTable->numSecretTrees != 0) {
|
||||
BattleSetup *setup;
|
||||
u32 x;
|
||||
u32 y;
|
||||
GetCoordsOfFacingTree(fieldSystem, &x, &y);
|
||||
u32 trainerId = PlayerProfile_GetTrainerID(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
|
||||
enum TreeType treeType = (enum TreeType)Headbutt_GetTreeTypeFromTable(headbuttTable->numRegularTrees, headbuttTable->numSecretTrees, trainerId, x, y, headbuttTable->treeCoords);
|
||||
if (treeType == TREETYPE_NONE) {
|
||||
FreeToHeap(headbuttTable);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
}
|
||||
HeadbuttSlot *headbuttEncounterSlots;
|
||||
if (treeType == TREETYPE_COMMON) {
|
||||
headbuttEncounterSlots = headbuttTable->common;
|
||||
} else if (treeType == TREETYPE_RARE) {
|
||||
headbuttEncounterSlots = headbuttTable->rare;
|
||||
} else if (treeType == TREETYPE_SECRET) {
|
||||
headbuttEncounterSlots = headbuttTable->secret;
|
||||
} else {
|
||||
GF_ASSERT(FALSE);
|
||||
FreeToHeap(headbuttTable);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
}
|
||||
if (FieldSystem_ChooseHeadbuttEncounter(fieldSystem, &setup, headbuttEncounterSlots)) {
|
||||
*didHeadbuttStartBattle->resultPtr = TRUE;
|
||||
FreeToHeap(headbuttTable);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
FieldSystem_StartForcedWildBattle(fieldSystem, taskManager, setup);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
FreeToHeap(headbuttTable);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static s8 Headbutt_GetTreeTypeFromTable(u16 numRegularTrees, u16 numSecretTrees, u32 trainerId, u32 x, u32 y, s16 treeCoords[][2]) {
|
||||
// Based on your trainer ID and the tree you're facing, choose which encounter table applies
|
||||
// Not all trees are headbuttable, this is determined by trainer ID
|
||||
u16 i;
|
||||
u16 numCoordsRegular = numRegularTrees * 6;
|
||||
u16 numCoordsSecret = numSecretTrees * 6;
|
||||
for (i = 0; i < numCoordsRegular; i++) {
|
||||
if (x == treeCoords[i][0] && y == treeCoords[i][1]) {
|
||||
return Headbutt_GetTreeType_Regular(i / 6, numRegularTrees, trainerId);
|
||||
}
|
||||
}
|
||||
// Check whether the facing tree is in the rare table
|
||||
for (i = numCoordsRegular; i < numCoordsRegular + numCoordsSecret; i++) {
|
||||
if (x == treeCoords[i][0] && y == treeCoords[i][1]) {
|
||||
return TREETYPE_SECRET;
|
||||
}
|
||||
}
|
||||
return TREETYPE_NONE;
|
||||
}
|
||||
|
||||
static s8 Headbutt_GetTreeType_Regular(u8 whichTree, u8 numTrees, u32 trainerId) {
|
||||
s8 ret = TREETYPE_NONE;
|
||||
u8 trainerIdLastDigit = trainerId % 10;
|
||||
if (numTrees >= 5) {
|
||||
u8 column = whichTree % 5;
|
||||
ret = sRareTreeLUT_5Plus[trainerIdLastDigit][column];
|
||||
} else if (numTrees == 4) {
|
||||
ret = sRareTreeLUT_4[trainerIdLastDigit][whichTree];
|
||||
} else if (numTrees == 3) {
|
||||
ret = sRareTreeLUT_3[trainerIdLastDigit][whichTree];
|
||||
} else if (numTrees == 2) {
|
||||
ret = sRareTreeLUT_2[trainerIdLastDigit][whichTree];
|
||||
} else if (numTrees == 1) {
|
||||
ret = sRareTreeLUT_1[trainerIdLastDigit][0];
|
||||
} else {
|
||||
// numTrees == 0 --> unreachable
|
||||
GF_ASSERT(FALSE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void GetCoordsOfFacingTree(FieldSystem *fieldSystem, u32 *x, u32 *y) {
|
||||
int inFrontX, inFrontY;
|
||||
PlayerAvatar_GetCoordsInFront(fieldSystem->playerAvatar, &inFrontX, &inFrontY);
|
||||
if (FollowMon_IsActive(fieldSystem)) {
|
||||
LocalMapObject *object = FollowMon_GetMapObject(fieldSystem);
|
||||
u32 followingMonX = MapObject_GetCurrentX(object);
|
||||
u32 followingMonY = MapObject_GetCurrentY(object);
|
||||
if (inFrontX == followingMonX && inFrontY == followingMonY) {
|
||||
u8 dir = MapObject_GetFacingDirection(object);
|
||||
inFrontX = GetDeltaXByFacingDirection(dir) + followingMonX;
|
||||
inFrontY = GetDeltaYByFacingDirection(dir) + followingMonY;
|
||||
}
|
||||
}
|
||||
*x = inFrontX;
|
||||
*y = inFrontY;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- //
|
||||
// Not related to headbutt, should these be a separate file object? //
|
||||
// ---------------------------------------------------------------- //
|
||||
|
||||
BOOL ScrCmd_795(ScriptContext *ctx) {
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u8 x = ScriptGetVar(ctx);
|
||||
u8 y = ScriptGetVar(ctx);
|
||||
Window **moneyBox = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
*moneyBox = ov01_021EED60(ctx->fieldSystem, x, y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_796(ScriptContext *ctx) {
|
||||
Window **moneyBox = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
ov01_021EEE30(*moneyBox);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Unused
|
||||
BOOL ScrCmd_797(ScriptContext *ctx) {
|
||||
Window **moneyBox = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
ov01_021EEE44(ctx->fieldSystem, *moneyBox);
|
||||
return FALSE;
|
||||
}
|
@ -109,7 +109,7 @@ static BOOL Task_RockSmashItemCheck(TaskManager *taskman) {
|
||||
*env->itemFound = FALSE;
|
||||
*env->item = ITEM_NONE;
|
||||
FreeToHeap(env);
|
||||
sub_02050B90(fieldSystem, taskman, setup);
|
||||
FieldSystem_StartForcedWildBattle(fieldSystem, taskman, setup);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -763,7 +763,7 @@ int UseRegisteredItemButtonInField(FieldSystem *fieldSystem, u8 slot) {
|
||||
if (Save_VarsFlags_CheckPalParkSysFlag(Save_VarsFlags_Get(fieldSystem->saveData)) == TRUE) {
|
||||
return 0;
|
||||
}
|
||||
if (CheckFlag996(Save_VarsFlags_Get(fieldSystem->saveData)) == TRUE) {
|
||||
if (Save_VarsFlags_CheckBugContestFlag(Save_VarsFlags_Get(fieldSystem->saveData)) == TRUE) {
|
||||
return 0;
|
||||
}
|
||||
if (ov01_021F6B10(fieldSystem) != TRUE) {
|
||||
|
@ -1,217 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "assert.h"
|
||||
#include "encounter.h"
|
||||
#include "follow_mon.h"
|
||||
#include "field_map_object.h"
|
||||
#include "fieldmap.h"
|
||||
#include "filesystem.h"
|
||||
#include "heap.h"
|
||||
#include "overlay_01_021EDAFC.h"
|
||||
#include "overlay_01_02204ED8.h"
|
||||
#include "overlay_02.h"
|
||||
#include "player_data.h"
|
||||
#include "scrcmd.h"
|
||||
#include "script.h"
|
||||
#include "task.h"
|
||||
#include "unk_0205CB48.h"
|
||||
#include "unk_0205FD20.h"
|
||||
|
||||
typedef struct UnkStruct_02204EFC {
|
||||
u16 unk00;
|
||||
u16 unk02;
|
||||
void *unk04;
|
||||
u8 filler08[20];
|
||||
void *unk1c;
|
||||
u8 filler20[20];
|
||||
void *unk34;
|
||||
u8 filler38[20];
|
||||
s16 unk4c[][2];
|
||||
} UnkStruct_02204EFC;
|
||||
|
||||
static BOOL ov01_02204EFC(TaskManager*);
|
||||
static s8 ov01_02204FE0(u16, u16, u32, u32, u32, s16[][2]);
|
||||
static s8 ov01_02205074(u8, u8, u32);
|
||||
static void ov01_022050F8(FieldSystem*, u32*, u32*);
|
||||
|
||||
const s8 ov01_02209634[] = {
|
||||
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
|
||||
};
|
||||
|
||||
const s8 ov01_02209640[][2] = {
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
{0, 1},
|
||||
{1, 0},
|
||||
};
|
||||
|
||||
const s8 ov01_02209654[][3] = {
|
||||
{ 0, 1, -1},
|
||||
{ 0, -1, 1},
|
||||
{ 1, 0, -1},
|
||||
{ 1, -1, 0},
|
||||
{-1, 0, 1},
|
||||
{-1, 1, 0},
|
||||
{ 0, 1, -1},
|
||||
{ 0, -1, 1},
|
||||
{ 1, 0, -1},
|
||||
{ 1, -1, 0},
|
||||
};
|
||||
|
||||
const s8 ov01_02209672[][4] = {
|
||||
{-1, 0, 0, 1},
|
||||
{ 1, -1, 0, 0},
|
||||
{ 1, 1, -1, 0},
|
||||
{ 0, 1, 1, -1},
|
||||
{ 0, 0, 1, 1},
|
||||
{-1, 0, 1, 0},
|
||||
{ 1, -1, 0, 1},
|
||||
{ 0, 1, -1, 0},
|
||||
{ 1, 0, 1, -1},
|
||||
{ 0, 1, 0, 1},
|
||||
};
|
||||
|
||||
const s8 ov01_0220969A[][5] = {
|
||||
{-1, 0, 0, 1, 1},
|
||||
{ 1, -1, 0, 0, 1},
|
||||
{ 1, 1, -1, 0, 0},
|
||||
{ 0, 1, 1, -1, 0},
|
||||
{ 0, 0, 1, 1, -1},
|
||||
{-1, 0, 1, 0, 1},
|
||||
{ 1, -1, 0, 1, 0},
|
||||
{ 0, 1, -1, 0, 1},
|
||||
{ 1, 0, 1, -1, 0},
|
||||
{ 0, 1, 0, 1, -1},
|
||||
};
|
||||
|
||||
void ov01_02204ED8(FieldSystem *fieldSystem, u16 *varPointer) {
|
||||
u16 **didHeadbuttStartBattle = AllocFromHeapAtEnd(HEAP_ID_FIELD, sizeof(didHeadbuttStartBattle));
|
||||
*didHeadbuttStartBattle = varPointer;
|
||||
*varPointer = FALSE;
|
||||
TaskManager_Call(fieldSystem->taskman, ov01_02204EFC, didHeadbuttStartBattle);
|
||||
}
|
||||
|
||||
static BOOL ov01_02204EFC(TaskManager *taskManager) {
|
||||
UnkStruct_02204EFC *unk4;
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager);
|
||||
u16 **didHeadbuttStartBattle = TaskManager_GetEnvironment(taskManager);
|
||||
unk4 = AllocAtEndAndReadWholeNarcMemberByIdPair(NARC_a_2_5_2, fieldSystem->location->mapId, HEAP_ID_FIELD);
|
||||
if (unk4->unk00 != 0 || unk4->unk02 != 0) {
|
||||
BattleSetup *setup;
|
||||
u32 x;
|
||||
u32 y;
|
||||
ov01_022050F8(fieldSystem, &x, &y);
|
||||
u32 trainerId = PlayerProfile_GetTrainerID(Save_PlayerData_GetProfileAddr(fieldSystem->saveData));
|
||||
s32 unk0 = ov01_02204FE0(unk4->unk00, unk4->unk02, trainerId, x, y, unk4->unk4c);
|
||||
if (unk0 == -1) {
|
||||
FreeToHeap(unk4);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
}
|
||||
void *unk2;
|
||||
if (unk0 == 0) {
|
||||
unk2 = &unk4->unk04;
|
||||
} else if (unk0 == 1) {
|
||||
unk2 = &unk4->unk1c;
|
||||
} else if (unk0 == 2) {
|
||||
unk2 = &unk4->unk34;
|
||||
} else {
|
||||
GF_ASSERT(FALSE);
|
||||
FreeToHeap(unk4);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
}
|
||||
if (ov02_02247374(fieldSystem, &setup, unk2)) {
|
||||
**didHeadbuttStartBattle = TRUE;
|
||||
FreeToHeap(unk4);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
sub_02050B90(fieldSystem, taskManager, setup);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
FreeToHeap(unk4);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static s8 ov01_02204FE0(u16 a0, u16 a1, u32 trainerId, u32 x, u32 y, s16 a5[][2]) {
|
||||
u16 i;
|
||||
u16 j = a0 * 6;
|
||||
u16 unkC = a1 * 6;
|
||||
for (i = 0; i < j; i++) {
|
||||
if (x == a5[i][0] && y == a5[i][1]) {
|
||||
return ov01_02205074(i / 6, a0, trainerId);
|
||||
}
|
||||
}
|
||||
s32 unk5 = j + unkC;
|
||||
for (; j < unk5; j++) {
|
||||
if (x == a5[j][0] && y == a5[j][1]) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static s8 ov01_02205074(u8 a0, u8 a1, u32 trainerId) {
|
||||
s8 unk7 = -1;
|
||||
u8 unk4 = trainerId % 10;
|
||||
if (a1 >= 5) {
|
||||
u8 unk1 = a0 % 5;
|
||||
unk7 = ov01_0220969A[unk4][unk1];
|
||||
} else if (a1 == 4) {
|
||||
unk7 = ov01_02209672[unk4][a0];
|
||||
} else if (a1 == 3) {
|
||||
unk7 = ov01_02209654[unk4][a0];
|
||||
} else if (a1 == 2) {
|
||||
unk7 = ov01_02209640[unk4][a0];
|
||||
} else if (a1 == 1) {
|
||||
unk7 = ov01_02209634[unk4];
|
||||
} else {
|
||||
GF_ASSERT(FALSE);
|
||||
}
|
||||
return unk7;
|
||||
}
|
||||
|
||||
static void ov01_022050F8(FieldSystem *fieldSystem, u32 *x, u32 *y) {
|
||||
int inFrontX, inFrontY;
|
||||
PlayerAvatar_GetCoordsInFront(fieldSystem->playerAvatar, &inFrontX, &inFrontY);
|
||||
if (FollowMon_IsActive(fieldSystem)) {
|
||||
LocalMapObject *object = FollowMon_GetMapObject(fieldSystem);
|
||||
u32 followingMonX = MapObject_GetCurrentX(object);
|
||||
u32 followingMonY = MapObject_GetCurrentY(object);
|
||||
if (inFrontX == followingMonX && inFrontY == followingMonY) {
|
||||
u8 dir = MapObject_GetFacingDirection(object);
|
||||
inFrontX = GetDeltaXByFacingDirection(dir) + followingMonX;
|
||||
inFrontY = GetDeltaYByFacingDirection(dir) + followingMonY;
|
||||
}
|
||||
}
|
||||
*x = inFrontX;
|
||||
*y = inFrontY;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_795(ScriptContext *ctx) {
|
||||
FieldSystem *fieldSystem = ctx->fieldSystem;
|
||||
u8 x = ScriptGetVar(ctx);
|
||||
u8 y = ScriptGetVar(ctx);
|
||||
Window **moneyBox = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
*moneyBox = ov01_021EED60(ctx->fieldSystem, x, y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_796(ScriptContext *ctx) {
|
||||
Window **moneyBox = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
ov01_021EEE30(*moneyBox);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Unused
|
||||
BOOL ScrCmd_797(ScriptContext *ctx) {
|
||||
Window **moneyBox = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MONEY_BOX);
|
||||
ov01_021EEE44(ctx->fieldSystem, *moneyBox);
|
||||
return FALSE;
|
||||
}
|
@ -163,8 +163,8 @@ void TrainerHouse_StartBattle(FieldSystem *fieldSystem, u32 trainerNum) {
|
||||
setup = TrainerHouse_NewBattleSetup(fieldSystem, &trainerHouse->sets[trainerNum]);
|
||||
}
|
||||
fieldSystem->unkA0 = NULL;
|
||||
u32 effect = sub_020517E8(setup);
|
||||
u32 bgm = sub_020517FC(setup);
|
||||
u32 effect = BattleSetup_GetWildTransitionEffect(setup);
|
||||
u32 bgm = BattleSetup_GetWildBattleMusic(setup);
|
||||
u32 *winFlag = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_BATTLE_WIN_FLAG);
|
||||
CallTask_020509F0(fieldSystem->taskman, setup, effect, bgm, winFlag);
|
||||
}
|
||||
|
@ -4859,7 +4859,7 @@ BOOL ScrCmd_Cinematic(ScriptContext *ctx) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_727(ScriptContext *ctx) {
|
||||
BOOL ScrCmd_GetFollowPokePartyIndex(ScriptContext *ctx) {
|
||||
u16 *p_ret = ScriptGetVarPointer(ctx);
|
||||
*p_ret = GetIdxOfFirstAliveMonInParty_CrashIfNone(SaveArray_Party_Get(ctx->fieldSystem->saveData));
|
||||
return FALSE;
|
||||
@ -5149,9 +5149,9 @@ BOOL ScrCmd_RockSmashItemCheck(ScriptContext *ctx) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ScrCmd_754(ScriptContext *ctx) {
|
||||
BOOL ScrCmd_TryHeadbuttEncounter(ScriptContext *ctx) {
|
||||
u16 *r1 = ScriptGetVarPointer(ctx);
|
||||
ov01_02204ED8(ctx->fieldSystem, r1);
|
||||
FieldSystem_TryHeadbuttEncounter(ctx->fieldSystem, r1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ BOOL Save_VarsFlags_CheckSafariSysFlag(SaveVarsFlags* state) {
|
||||
return CheckScriptFlag(state, FLAG_SYS_SAFARI);
|
||||
}
|
||||
|
||||
BOOL CheckFlag996(SaveVarsFlags* state) {
|
||||
BOOL Save_VarsFlags_CheckBugContestFlag(SaveVarsFlags* state) {
|
||||
return CheckScriptFlag(state, FLAG_UNK_996);
|
||||
}
|
||||
|
||||
|
114
src/touch_hitbox_controller.c
Normal file
114
src/touch_hitbox_controller.c
Normal file
@ -0,0 +1,114 @@
|
||||
#include "global.h"
|
||||
#include "touch_hitbox_controller.h"
|
||||
|
||||
static void TouchHitboxControllerTemplate_Init(TouchHitboxControllerTemplate *template);
|
||||
static int sub_02026D88(TouchHitboxControllerTemplate *template, u32 unused, u32 touchNew);
|
||||
static int sub_02026DA4(TouchHitboxControllerTemplate *template, u32 touchHeld, u32 unused);
|
||||
static void sub_02026DD8(TouchHitboxControllerTemplate *template, u8 a1);
|
||||
|
||||
TouchHitboxController *TouchHitboxController_Create(const TouchscreenHitbox *hitboxes, u32 numTemplates, TouchHitboxControllerCallback callback, void *callbackArg, HeapID heapId) {
|
||||
GF_ASSERT(numTemplates != 0);
|
||||
|
||||
TouchHitboxController *controller = AllocFromHeap(heapId, sizeof(TouchHitboxController));
|
||||
if (controller != NULL) {
|
||||
controller->hitboxes = hitboxes;
|
||||
controller->numTemplates = numTemplates;
|
||||
controller->callback = callback;
|
||||
controller->callbackArg = callbackArg;
|
||||
|
||||
controller->templates = AllocFromHeap(heapId, numTemplates * sizeof(TouchHitboxControllerTemplate));
|
||||
if (controller->templates != NULL) {
|
||||
for (u32 i = 0; i < numTemplates; i++) {
|
||||
TouchHitboxControllerTemplate_Init(&controller->templates[i]);
|
||||
}
|
||||
} else {
|
||||
FreeToHeap(controller);
|
||||
controller = NULL;
|
||||
}
|
||||
}
|
||||
return controller;
|
||||
}
|
||||
|
||||
static void TouchHitboxControllerTemplate_Init(TouchHitboxControllerTemplate *template) {
|
||||
template->unkCallbackNum = 0;
|
||||
template->touchActive = FALSE;
|
||||
template->numFramesActive = 0;
|
||||
}
|
||||
|
||||
void TouchHitboxController_Destroy(TouchHitboxController *controller) {
|
||||
GF_ASSERT(controller != NULL);
|
||||
FreeToHeap(controller->templates);
|
||||
FreeToHeap(controller);
|
||||
}
|
||||
|
||||
typedef int (*TouchHitboxControllerTemplate_UnkCallback)(TouchHitboxControllerTemplate *template, u32 touchHeld, u32 touchNew);
|
||||
static const TouchHitboxControllerTemplate_UnkCallback _020F6450[] = {
|
||||
sub_02026D88,
|
||||
sub_02026DA4,
|
||||
};
|
||||
|
||||
BOOL TouchHitboxController_IsTriggered(TouchHitboxController *controller) {
|
||||
u32 i;
|
||||
u32 touchNew, touchHeld; // these are BOOLs but they have to be unsigned to match
|
||||
|
||||
BOOL triggered = FALSE;
|
||||
touchHeld = System_GetTouchHeld();
|
||||
if (touchHeld) {
|
||||
touchNew = System_GetTouchNew();
|
||||
for (i = 0; i < controller->numTemplates; i++) {
|
||||
if (controller->templates[i].touchActive) {
|
||||
controller->templates[i].touchActive = TouchscreenHitbox_TouchHeldIsIn(&controller->hitboxes[i]);
|
||||
} else {
|
||||
controller->templates[i].touchActive = TouchscreenHitbox_TouchNewIsIn(&controller->hitboxes[i]);
|
||||
if (controller->templates[i].touchActive) {
|
||||
triggered = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
touchNew = FALSE;
|
||||
for (i = 0; i < controller->numTemplates; i++) {
|
||||
controller->templates[i].touchActive = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < controller->numTemplates; i++) {
|
||||
int event = _020F6450[controller->templates[i].unkCallbackNum](&controller->templates[i], touchHeld, touchNew);
|
||||
if (event != -1) {
|
||||
controller->callback(i, event, controller->callbackArg);
|
||||
}
|
||||
}
|
||||
|
||||
return triggered;
|
||||
}
|
||||
|
||||
static int sub_02026D88(TouchHitboxControllerTemplate *template, u32 unused, u32 touchNew) {
|
||||
if (template->touchActive && touchNew) {
|
||||
sub_02026DD8(template, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int sub_02026DA4(TouchHitboxControllerTemplate *template, u32 touchHeld, u32 unused) {
|
||||
if (template->touchActive) {
|
||||
if (template->numFramesActive < 0xFFFF) {
|
||||
template->numFramesActive++;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (touchHeld) {
|
||||
sub_02026DD8(template, 0);
|
||||
return 3;
|
||||
} else {
|
||||
sub_02026DD8(template, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_02026DD8(TouchHitboxControllerTemplate *template, u8 a1) {
|
||||
template->unkCallbackNum = a1;
|
||||
template->numFramesActive = 0;
|
||||
}
|
@ -382,7 +382,7 @@ u16 *BugContest_GetSportBallsAddr(BugContest *contest) {
|
||||
|
||||
void FieldSystem_IncrementBugContestTimer(FieldSystem *fieldSystem, int duration) {
|
||||
BugContest *contest = FieldSystem_BugContest_Get(fieldSystem);
|
||||
if (contest && CheckFlag996(Save_VarsFlags_Get(fieldSystem->saveData))) {
|
||||
if (contest && Save_VarsFlags_CheckBugContestFlag(Save_VarsFlags_Get(fieldSystem->saveData))) {
|
||||
contest->elapsed_time += duration;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static void YesNoPrompt_InitPixelDataFromTemplate(YesNoPrompt *yesno, const YesN
|
||||
static void YesNoPrompt_InitPlttFromTemplate(YesNoPrompt *yesno, const YesNoPromptTemplate *template);
|
||||
static void YesNoPrompt_InitButtonsFromTemplate(YesNoPrompt *yesno, const YesNoPromptTemplate *template);
|
||||
static void SetupTouchHitboxesController(YesNoPrompt *yesno, const YesNoPromptTemplate *template);
|
||||
static void YesNoButton_TouchHitboxCB(u32 index, u32 event, void *arg);
|
||||
static void YesNoButton_TouchHitboxCB(u32 index, u32 event, YesNoPrompt *yesno);
|
||||
static void YesNoPromptButton_Draw(YesNoPromptButton *button, const struct UnkStruct_02016C28 *arg, HeapID heapId);
|
||||
static void YesNoPromptButton_Clear(YesNoPromptButton *button);
|
||||
static SysTask *LoadPixelDataFromNarcAndScheduleTransfer(NarcId narcId, s32 fileId, BgConfig *bgConfig, int bgId, u32 tileStart, HeapID heapId);
|
||||
@ -274,11 +274,10 @@ static void SetupTouchHitboxesController(YesNoPrompt *yesno, const YesNoPromptTe
|
||||
yesno->hitboxes[i].rect.bottom = (yesno->y * 8) + (i * yesno->height * 8) + (yesno->height * 8);
|
||||
yesno->hitboxes[i].rect.right = (yesno->x * 8) + (yesno->width * 8);
|
||||
}
|
||||
yesno->touchHitboxController = TouchHitboxController_Create(yesno->hitboxes, 2, YesNoButton_TouchHitboxCB, yesno, yesno->heapId);
|
||||
yesno->touchHitboxController = TouchHitboxController_Create(yesno->hitboxes, 2, (TouchHitboxControllerCallback)YesNoButton_TouchHitboxCB, yesno, yesno->heapId);
|
||||
}
|
||||
|
||||
static void YesNoButton_TouchHitboxCB(u32 index, u32 event, void *arg) {
|
||||
YesNoPrompt *yesno = (YesNoPrompt *)arg;
|
||||
static void YesNoButton_TouchHitboxCB(u32 index, u32 event, YesNoPrompt *yesno) {
|
||||
yesno->lastTouchEvent = event;
|
||||
if (event == 0) {
|
||||
yesno->result = index;
|
||||
|
@ -4,9 +4,11 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
using std::string; using std::to_string;
|
||||
using std::string;
|
||||
using std::to_string;
|
||||
|
||||
#include "inja.hpp"
|
||||
using namespace inja;
|
||||
@ -24,14 +26,49 @@ string get_custom_var(string key)
|
||||
return customVars[key];
|
||||
}
|
||||
|
||||
const string usage = "USAGE: jsonproc [-DKEY[=VALUE] ...] <json-filepath> <template-filepath> <output-filepath>\n";
|
||||
const string detail = "\n"
|
||||
" <json-filepath> Path to the JSON file to process\n"
|
||||
" <template-filepath>\n"
|
||||
" Path to the INJA template to process\n"
|
||||
" <output-filepath> Path to the file to generate\n"
|
||||
" -DKEY[=VALUE] Optional: Set a custom variable to the indicated value. If value is not set, defaults to 1.\n";
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 4)
|
||||
FATAL_ERROR("USAGE: jsonproc <json-filepath> <template-filepath> <output-filepath>\n");
|
||||
std::vector<string> args (argv + 1, argv + argc);
|
||||
string jsonfilepath, templateFilepath, outputFilepath;
|
||||
|
||||
string jsonfilepath = argv[1];
|
||||
string templateFilepath = argv[2];
|
||||
string outputFilepath = argv[3];
|
||||
for (auto it = args.begin(); it != args.end(); ++it) {
|
||||
if (it->substr(0, 2) == "-D") {
|
||||
string define = it->substr(2);
|
||||
if (define.empty()) {
|
||||
define = *++it;
|
||||
}
|
||||
string::size_type eqpos = define.find('=');
|
||||
string value = "1";
|
||||
if (eqpos != string::npos) {
|
||||
value = define.substr(eqpos + 1);
|
||||
define = define.substr(0, eqpos);
|
||||
}
|
||||
customVars[define] = value;
|
||||
} else if (*it == "-h" || *it == "--help") {
|
||||
std::cout << usage << detail;
|
||||
return 0;
|
||||
} else if (jsonfilepath.empty()) {
|
||||
jsonfilepath = *it;
|
||||
} else if (templateFilepath.empty()) {
|
||||
templateFilepath = *it;
|
||||
} else if (outputFilepath.empty()) {
|
||||
outputFilepath = *it;
|
||||
} else {
|
||||
FATAL_ERROR("%s", usage.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonfilepath.empty() || templateFilepath.empty() || outputFilepath.empty()) {
|
||||
FATAL_ERROR("%s", usage.c_str());
|
||||
}
|
||||
|
||||
Environment env;
|
||||
|
||||
@ -198,6 +235,11 @@ int main(int argc, char *argv[])
|
||||
return string{buf};
|
||||
});
|
||||
|
||||
env.add_void_callback("error", 1, [](Arguments& args) {
|
||||
std::cerr << "UserError: " << args.at(0)->get<std::string>() << "\n";
|
||||
std::exit(1);
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
env.write_with_json_file(templateFilepath, jsonfilepath, outputFilepath);
|
||||
|
@ -4598,7 +4598,7 @@
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "scrcmd_727",
|
||||
"name": "get_follow_poke_party_index",
|
||||
"args": [
|
||||
"var"
|
||||
]
|
||||
@ -4767,7 +4767,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "scrcmd_754",
|
||||
"name": "try_headbutt_encounter",
|
||||
"args": [
|
||||
"var"
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user