mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
decompile roamer
This commit is contained in:
parent
3c8091393c
commit
f1fe0c217d
502
asm/roamer.s
502
asm/roamer.s
@ -1,502 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start ClearRoamerData
|
||||
ClearRoamerData: @ 8161B34
|
||||
push {r4,r5,lr}
|
||||
ldr r5, =gSaveBlock1Ptr
|
||||
ldr r0, [r5]
|
||||
ldr r4, =0x000031dc
|
||||
adds r0, r4
|
||||
movs r1, 0
|
||||
movs r2, 0x1C
|
||||
bl memset
|
||||
ldr r0, [r5]
|
||||
adds r0, r4
|
||||
ldr r1, =0x00000197
|
||||
strh r1, [r0, 0x8]
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end ClearRoamerData
|
||||
|
||||
thumb_func_start ClearRoamerLocationData
|
||||
ClearRoamerLocationData: @ 8161B60
|
||||
push {r4-r6,lr}
|
||||
movs r2, 0
|
||||
ldr r6, =sRoamerLocation
|
||||
ldr r4, =sLocationHistory
|
||||
movs r3, 0
|
||||
adds r5, r4, 0x1
|
||||
_08161B6C:
|
||||
lsls r1, r2, 1
|
||||
adds r0, r1, r4
|
||||
strb r3, [r0]
|
||||
adds r1, r5
|
||||
strb r3, [r1]
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, 0x2
|
||||
bls _08161B6C
|
||||
movs r0, 0
|
||||
strb r0, [r6]
|
||||
strb r0, [r6, 0x1]
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end ClearRoamerLocationData
|
||||
|
||||
thumb_func_start CreateInitialRoamerMon
|
||||
CreateInitialRoamerMon: @ 8161B94
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x10
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
bne _08161BBC
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r1, [r0]
|
||||
ldr r2, =0x000031dc
|
||||
adds r1, r2
|
||||
ldr r2, =0x00000197
|
||||
b _08161BC8
|
||||
.pool
|
||||
_08161BBC:
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r1, [r0]
|
||||
ldr r2, =0x000031dc
|
||||
adds r1, r2
|
||||
movs r2, 0xCC
|
||||
lsls r2, 1
|
||||
_08161BC8:
|
||||
strh r2, [r1, 0x8]
|
||||
adds r7, r0, 0
|
||||
ldr r6, =gEnemyParty
|
||||
ldr r0, [r7]
|
||||
ldr r5, =0x000031dc
|
||||
adds r0, r5
|
||||
ldrh r1, [r0, 0x8]
|
||||
movs r4, 0
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
str r4, [sp, 0x8]
|
||||
str r4, [sp, 0xC]
|
||||
adds r0, r6, 0
|
||||
movs r2, 0x28
|
||||
movs r3, 0x20
|
||||
bl CreateMon
|
||||
ldr r0, [r7]
|
||||
adds r0, r5
|
||||
movs r1, 0x28
|
||||
strb r1, [r0, 0xC]
|
||||
ldr r0, [r7]
|
||||
adds r0, r5
|
||||
strb r4, [r0, 0xD]
|
||||
ldr r0, [r7]
|
||||
adds r0, r5
|
||||
movs r1, 0x1
|
||||
strb r1, [r0, 0x13]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x42
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
str r0, [r1]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
str r0, [r1, 0x4]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x3A
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
movs r2, 0
|
||||
mov r8, r2
|
||||
strh r0, [r1, 0xA]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x16
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
strb r0, [r1, 0xE]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x17
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
strb r0, [r1, 0xF]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x18
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
strb r0, [r1, 0x10]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x21
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
strb r0, [r1, 0x11]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x2F
|
||||
bl GetMonData
|
||||
ldr r1, [r7]
|
||||
adds r1, r5
|
||||
strb r0, [r1, 0x12]
|
||||
ldr r4, =sRoamerLocation
|
||||
mov r0, r8
|
||||
strb r0, [r4]
|
||||
bl Random
|
||||
ldr r5, =sRoamerLocations
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0x14
|
||||
bl __umodsi3
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
lsls r1, r0, 1
|
||||
adds r1, r0
|
||||
lsls r1, 1
|
||||
adds r1, r5
|
||||
ldrb r0, [r1]
|
||||
strb r0, [r4, 0x1]
|
||||
add sp, 0x10
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end CreateInitialRoamerMon
|
||||
|
||||
thumb_func_start InitRoamer
|
||||
InitRoamer: @ 8161CBC
|
||||
push {lr}
|
||||
bl ClearRoamerData
|
||||
bl ClearRoamerLocationData
|
||||
ldr r0, =gSpecialVar_0x8004
|
||||
ldrh r0, [r0]
|
||||
bl CreateInitialRoamerMon
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end InitRoamer
|
||||
|
||||
thumb_func_start UpdateLocationHistoryForRoamer
|
||||
UpdateLocationHistoryForRoamer: @ 8161CD8
|
||||
ldr r0, =sLocationHistory
|
||||
ldrb r1, [r0, 0x2]
|
||||
strb r1, [r0, 0x4]
|
||||
ldrb r1, [r0, 0x3]
|
||||
strb r1, [r0, 0x5]
|
||||
ldrb r1, [r0]
|
||||
strb r1, [r0, 0x2]
|
||||
ldrb r1, [r0, 0x1]
|
||||
strb r1, [r0, 0x3]
|
||||
ldr r1, =gSaveBlock1Ptr
|
||||
ldr r2, [r1]
|
||||
ldrb r1, [r2, 0x4]
|
||||
strb r1, [r0]
|
||||
ldrb r1, [r2, 0x5]
|
||||
strb r1, [r0, 0x1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end UpdateLocationHistoryForRoamer
|
||||
|
||||
thumb_func_start RoamerMoveToOtherLocationSet
|
||||
RoamerMoveToOtherLocationSet: @ 8161D00
|
||||
push {r4,r5,lr}
|
||||
movs r1, 0
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r2, =0x000031dc
|
||||
adds r0, r2
|
||||
ldrb r0, [r0, 0x13]
|
||||
cmp r0, 0
|
||||
beq _08161D3E
|
||||
ldr r0, =sRoamerLocation
|
||||
strb r1, [r0]
|
||||
ldr r5, =sRoamerLocations
|
||||
adds r4, r0, 0
|
||||
_08161D1A:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0x14
|
||||
bl __umodsi3
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
lsls r1, r0, 1
|
||||
adds r1, r0
|
||||
lsls r1, 1
|
||||
adds r1, r5
|
||||
ldrb r1, [r1]
|
||||
ldrb r0, [r4, 0x1]
|
||||
cmp r0, r1
|
||||
beq _08161D1A
|
||||
strb r1, [r4, 0x1]
|
||||
_08161D3E:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end RoamerMoveToOtherLocationSet
|
||||
|
||||
thumb_func_start RoamerMove
|
||||
RoamerMove: @ 8161D54
|
||||
push {r4-r7,lr}
|
||||
movs r4, 0
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
movs r1, 0xF0
|
||||
lsls r1, 12
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
bne _08161D6E
|
||||
bl RoamerMoveToOtherLocationSet
|
||||
b _08161DE2
|
||||
_08161D6E:
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x000031dc
|
||||
adds r0, r1
|
||||
ldrb r0, [r0, 0x13]
|
||||
cmp r0, 0
|
||||
beq _08161DE2
|
||||
ldr r7, =sRoamerLocation
|
||||
ldr r3, =sRoamerLocations
|
||||
_08161D80:
|
||||
lsls r0, r4, 1
|
||||
adds r0, r4
|
||||
lsls r2, r0, 1
|
||||
adds r1, r2, r3
|
||||
ldrb r0, [r7, 0x1]
|
||||
ldrb r1, [r1]
|
||||
cmp r0, r1
|
||||
bne _08161DD8
|
||||
ldr r6, =sRoamerLocations
|
||||
adds r5, r2, 0x1
|
||||
ldr r4, =sLocationHistory
|
||||
_08161D96:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0x5
|
||||
bl __umodsi3
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
adds r0, r5
|
||||
adds r0, r6
|
||||
ldrb r1, [r0]
|
||||
ldrb r0, [r4, 0x4]
|
||||
cmp r0, 0
|
||||
bne _08161DBA
|
||||
ldrb r0, [r4, 0x5]
|
||||
cmp r0, r1
|
||||
beq _08161D96
|
||||
_08161DBA:
|
||||
cmp r1, 0xFF
|
||||
beq _08161D96
|
||||
strb r1, [r7, 0x1]
|
||||
b _08161DE2
|
||||
.pool
|
||||
_08161DD8:
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, 0x13
|
||||
bls _08161D80
|
||||
_08161DE2:
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end RoamerMove
|
||||
|
||||
thumb_func_start IsRoamerAt
|
||||
IsRoamerAt: @ 8161DE8
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r3, =0x000031dc
|
||||
adds r0, r3
|
||||
ldrb r0, [r0, 0x13]
|
||||
cmp r0, 0
|
||||
beq _08161E20
|
||||
ldr r0, =sRoamerLocation
|
||||
ldrb r3, [r0]
|
||||
cmp r2, r3
|
||||
bne _08161E20
|
||||
ldrb r0, [r0, 0x1]
|
||||
cmp r1, r0
|
||||
bne _08161E20
|
||||
movs r0, 0x1
|
||||
b _08161E22
|
||||
.pool
|
||||
_08161E20:
|
||||
movs r0, 0
|
||||
_08161E22:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end IsRoamerAt
|
||||
|
||||
thumb_func_start CreateRoamerMonInstance
|
||||
CreateRoamerMonInstance: @ 8161E28
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
ldr r5, =gEnemyParty
|
||||
bl ZeroEnemyPartyMons
|
||||
ldr r4, =gSaveBlock1Ptr
|
||||
ldr r0, [r4]
|
||||
ldr r1, =0x000031dc
|
||||
adds r0, r1
|
||||
ldrh r1, [r0, 0x8]
|
||||
ldrb r2, [r0, 0xC]
|
||||
ldr r3, [r0]
|
||||
ldr r0, [r0, 0x4]
|
||||
str r0, [sp]
|
||||
adds r0, r5, 0
|
||||
bl CreateMonWithIVsPersonality
|
||||
ldr r2, [r4]
|
||||
ldr r0, =0x000031e9
|
||||
adds r2, r0
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x37
|
||||
bl SetMonData
|
||||
ldr r2, [r4]
|
||||
ldr r1, =0x000031e6
|
||||
adds r2, r1
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x39
|
||||
bl SetMonData
|
||||
ldr r2, [r4]
|
||||
ldr r0, =0x000031ea
|
||||
adds r2, r0
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x16
|
||||
bl SetMonData
|
||||
ldr r2, [r4]
|
||||
ldr r1, =0x000031eb
|
||||
adds r2, r1
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x17
|
||||
bl SetMonData
|
||||
ldr r2, [r4]
|
||||
ldr r0, =0x000031ec
|
||||
adds r2, r0
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x18
|
||||
bl SetMonData
|
||||
ldr r2, [r4]
|
||||
ldr r1, =0x000031ed
|
||||
adds r2, r1
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x21
|
||||
bl SetMonData
|
||||
ldr r2, [r4]
|
||||
ldr r0, =0x000031ee
|
||||
adds r2, r0
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x2F
|
||||
bl SetMonData
|
||||
add sp, 0x4
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end CreateRoamerMonInstance
|
||||
|
||||
thumb_func_start TryStartRoamerEncounter
|
||||
TryStartRoamerEncounter: @ 8161EDC
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r1, 0x4]
|
||||
ldrb r1, [r1, 0x5]
|
||||
bl IsRoamerAt
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _08161F10
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
movs r1, 0xC0
|
||||
lsls r1, 10
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
bne _08161F10
|
||||
bl CreateRoamerMonInstance
|
||||
movs r0, 0x1
|
||||
b _08161F12
|
||||
.pool
|
||||
_08161F10:
|
||||
movs r0, 0
|
||||
_08161F12:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end TryStartRoamerEncounter
|
||||
|
||||
thumb_func_start UpdateRoamerHPStatus
|
||||
UpdateRoamerHPStatus: @ 8161F18
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
movs r1, 0x39
|
||||
bl GetMonData
|
||||
ldr r5, =gSaveBlock1Ptr
|
||||
ldr r1, [r5]
|
||||
ldr r4, =0x000031dc
|
||||
adds r1, r4
|
||||
strh r0, [r1, 0xA]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x37
|
||||
bl GetMonData
|
||||
ldr r1, [r5]
|
||||
adds r1, r4
|
||||
strb r0, [r1, 0xD]
|
||||
bl RoamerMoveToOtherLocationSet
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end UpdateRoamerHPStatus
|
||||
|
||||
thumb_func_start SetRoamerInactive
|
||||
SetRoamerInactive: @ 8161F4C
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x000031dc
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
strb r1, [r0, 0x13]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end SetRoamerInactive
|
||||
|
||||
thumb_func_start GetRoamerLocation
|
||||
GetRoamerLocation: @ 8161F64
|
||||
ldr r3, =sRoamerLocation
|
||||
ldrb r2, [r3]
|
||||
strb r2, [r0]
|
||||
ldrb r0, [r3, 0x1]
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end GetRoamerLocation
|
||||
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -81,156 +81,3 @@ gUnknown_085CEC10:: @ 85CEC10
|
||||
|
||||
gUnknown_085CEC28:: @ 85CEC28
|
||||
.incbin "baserom.gba", 0x5cec28, 0x8
|
||||
|
||||
sRoamerLocations:: @ 85CEC30
|
||||
.incbin "baserom.gba", 0x5cec30, 0x80
|
||||
|
||||
@ 85CECB0
|
||||
.include "data/battle_frontier/battle_frontier_held_items.inc"
|
||||
|
||||
@ 85CED2E
|
||||
.include "data/battle_frontier/battle_frontier_trainer_mons.inc"
|
||||
|
||||
@ 85D5ACC
|
||||
.include "data/battle_frontier/battle_frontier_trainers.inc"
|
||||
|
||||
@ 85D97BC
|
||||
.include "data/battle_frontier/battle_frontier_mons.inc"
|
||||
|
||||
gUnknown_085DCEDC:: @ 85DCEDC
|
||||
.incbin "baserom.gba", 0x5dcedc, 0x1e
|
||||
|
||||
gUnknown_085DCEFA:: @ 85DCEFA
|
||||
.incbin "baserom.gba", 0x5dcefa, 0x14
|
||||
|
||||
gUnknown_085DCF0E:: @ 85DCF0E
|
||||
.incbin "baserom.gba", 0x5dcf0e, 0x1e
|
||||
|
||||
gUnknown_085DCF2C:: @ 85DCF2C
|
||||
.incbin "baserom.gba", 0x5dcf2c, 0x14
|
||||
|
||||
gUnknown_085DCF40:: @ 85DCF40
|
||||
.incbin "baserom.gba", 0x5dcf40, 0x5c0
|
||||
|
||||
gUnknown_085DD500:: @ 85DD500
|
||||
.incbin "baserom.gba", 0x5dd500, 0x190
|
||||
|
||||
gUnknown_085DD690:: @ 85DD690
|
||||
.incbin "baserom.gba", 0x5dd690, 0x40
|
||||
|
||||
gUnknown_085DD6D0:: @ 85DD6D0
|
||||
.incbin "baserom.gba", 0x5dd6d0, 0x5
|
||||
|
||||
gUnknown_085DD6D5:: @ 85DD6D5
|
||||
.incbin "baserom.gba", 0x5dd6d5, 0x7
|
||||
|
||||
gUnknown_085DD6DC:: @ 85DD6DC
|
||||
.incbin "baserom.gba", 0x5dd6dc, 0x30
|
||||
|
||||
@ 85DD70C
|
||||
.include "data/battle_frontier/slateport_battle_tent_trainer_mons.inc"
|
||||
|
||||
@ 85DDA14
|
||||
.include "data/battle_frontier/slateport_battle_tent_trainers.inc"
|
||||
|
||||
@ 85DE02C
|
||||
.include "data/battle_frontier/slateport_battle_tent_mons.inc"
|
||||
|
||||
@ 85DE48C
|
||||
.include "data/battle_frontier/verdanturf_battle_tent_trainer_mons.inc"
|
||||
|
||||
@ 85DE610
|
||||
.include "data/battle_frontier/verdanturf_battle_tent_trainers.inc"
|
||||
|
||||
@ 85DEC28
|
||||
.include "data/battle_frontier/verdanturf_battle_tent_mons.inc"
|
||||
|
||||
@ 85DEEF8
|
||||
.include "data/battle_frontier/fallarbor_battle_tent_trainer_mons.inc"
|
||||
|
||||
@ 85DF084
|
||||
.include "data/battle_frontier/fallarbor_battle_tent_trainers.inc"
|
||||
|
||||
@ 85DF69C
|
||||
.include "data/battle_frontier/fallarbor_battle_tent_mons.inc"
|
||||
|
||||
gUnknown_085DF96C:: @ 85DF96C
|
||||
.incbin "baserom.gba", 0x5df96c, 0x40
|
||||
|
||||
gUnknown_085DF9AC:: @ 85DF9AC
|
||||
.incbin "baserom.gba", 0x5df9ac, 0x20
|
||||
|
||||
gUnknown_085DF9CC:: @ 85DF9CC
|
||||
.incbin "baserom.gba", 0x5df9cc, 0x20
|
||||
|
||||
gUnknown_085DF9EC:: @ 85DF9EC
|
||||
.incbin "baserom.gba", 0x5df9ec, 0xa
|
||||
|
||||
gUnknown_085DF9F6:: @ 85DF9F6
|
||||
.incbin "baserom.gba", 0x5df9f6, 0x4
|
||||
|
||||
gUnknown_085DF9FA:: @ 85DF9FA
|
||||
.incbin "baserom.gba", 0x5df9fa, 0x20
|
||||
|
||||
gUnknown_085DFA1A:: @ 85DFA1A
|
||||
.incbin "baserom.gba", 0x5dfa1a, 0x28
|
||||
|
||||
gUnknown_085DFA42:: @ 85DFA42
|
||||
.incbin "baserom.gba", 0x5dfa42, 0x4
|
||||
|
||||
gUnknown_085DFA46:: @ 85DFA46
|
||||
.incbin "baserom.gba", 0x5dfa46, 0xc
|
||||
|
||||
gUnknown_085DFA52:: @ 85DFA52
|
||||
.incbin "baserom.gba", 0x5dfa52, 0xe
|
||||
|
||||
gUnknown_085DFA60:: @ 85DFA60
|
||||
.incbin "baserom.gba", 0x5dfa60, 0x20
|
||||
|
||||
gUnknown_085DFA80:: @ 85DFA80
|
||||
.incbin "baserom.gba", 0x5dfa80, 0xe0
|
||||
|
||||
gUnknown_085DFB60:: @ 85DFB60
|
||||
.incbin "baserom.gba", 0x5dfb60, 0xac
|
||||
|
||||
gUnknown_085DFC0C:: @ 85DFC0C
|
||||
.incbin "baserom.gba", 0x5dfc0c, 0xa4
|
||||
|
||||
gUnknown_085DFCB0:: @ 85DFCB0
|
||||
.incbin "baserom.gba", 0x5dfcb0, 0x14
|
||||
|
||||
gUnknown_085DFCC4:: @ 85DFCC4
|
||||
.incbin "baserom.gba", 0x5dfcc4, 0x5
|
||||
|
||||
gUnknown_085DFCC9:: @ 85DFCC9
|
||||
.incbin "baserom.gba", 0x5dfcc9, 0x3
|
||||
|
||||
gUnknown_085DFCCC:: @ 85DFCCC
|
||||
.incbin "baserom.gba", 0x5dfccc, 0x10
|
||||
|
||||
gUnknown_085DFCDC:: @ 85DFCDC
|
||||
.incbin "baserom.gba", 0x5dfcdc, 0x20
|
||||
|
||||
gUnknown_085DFCFC:: @ 85DFCFC
|
||||
.incbin "baserom.gba", 0x5dfcfc, 0x8
|
||||
|
||||
gUnknown_085DFD04:: @ 85DFD04
|
||||
.incbin "baserom.gba", 0x5dfd04, 0x14
|
||||
|
||||
gUnknown_085DFD18:: @ 85DFD18
|
||||
.incbin "baserom.gba", 0x5dfd18, 0x8
|
||||
|
||||
gUnknown_085DFD20:: @ 85DFD20
|
||||
.incbin "baserom.gba", 0x5dfd20, 0x8
|
||||
|
||||
gUnknown_085DFD28:: @ 85DFD28
|
||||
.incbin "baserom.gba", 0x5dfd28, 0x34
|
||||
|
||||
gUnknown_085DFD5C:: @ 85DFD5C
|
||||
.incbin "baserom.gba", 0x5dfd5c, 0x44
|
||||
|
||||
gUnknown_085DFDA0:: @ 85DFDA0
|
||||
.incbin "baserom.gba", 0x5dfda0, 0x18
|
||||
|
||||
gUnknown_085DFDB8:: @ 85DFDB8
|
||||
.incbin "baserom.gba", 0x5dfdb8, 0x8
|
||||
|
154
data/rom_85CECB0.s
Normal file
154
data/rom_85CECB0.s
Normal file
@ -0,0 +1,154 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
@ 85CECB0
|
||||
.include "data/battle_frontier/battle_frontier_held_items.inc"
|
||||
|
||||
@ 85CED2E
|
||||
.include "data/battle_frontier/battle_frontier_trainer_mons.inc"
|
||||
|
||||
@ 85D5ACC
|
||||
.include "data/battle_frontier/battle_frontier_trainers.inc"
|
||||
|
||||
@ 85D97BC
|
||||
.include "data/battle_frontier/battle_frontier_mons.inc"
|
||||
|
||||
gUnknown_085DCEDC:: @ 85DCEDC
|
||||
.incbin "baserom.gba", 0x5dcedc, 0x1e
|
||||
|
||||
gUnknown_085DCEFA:: @ 85DCEFA
|
||||
.incbin "baserom.gba", 0x5dcefa, 0x14
|
||||
|
||||
gUnknown_085DCF0E:: @ 85DCF0E
|
||||
.incbin "baserom.gba", 0x5dcf0e, 0x1e
|
||||
|
||||
gUnknown_085DCF2C:: @ 85DCF2C
|
||||
.incbin "baserom.gba", 0x5dcf2c, 0x14
|
||||
|
||||
gUnknown_085DCF40:: @ 85DCF40
|
||||
.incbin "baserom.gba", 0x5dcf40, 0x5c0
|
||||
|
||||
gUnknown_085DD500:: @ 85DD500
|
||||
.incbin "baserom.gba", 0x5dd500, 0x190
|
||||
|
||||
gUnknown_085DD690:: @ 85DD690
|
||||
.incbin "baserom.gba", 0x5dd690, 0x40
|
||||
|
||||
gUnknown_085DD6D0:: @ 85DD6D0
|
||||
.incbin "baserom.gba", 0x5dd6d0, 0x5
|
||||
|
||||
gUnknown_085DD6D5:: @ 85DD6D5
|
||||
.incbin "baserom.gba", 0x5dd6d5, 0x7
|
||||
|
||||
gUnknown_085DD6DC:: @ 85DD6DC
|
||||
.incbin "baserom.gba", 0x5dd6dc, 0x30
|
||||
|
||||
@ 85DD70C
|
||||
.include "data/battle_frontier/slateport_battle_tent_trainer_mons.inc"
|
||||
|
||||
@ 85DDA14
|
||||
.include "data/battle_frontier/slateport_battle_tent_trainers.inc"
|
||||
|
||||
@ 85DE02C
|
||||
.include "data/battle_frontier/slateport_battle_tent_mons.inc"
|
||||
|
||||
@ 85DE48C
|
||||
.include "data/battle_frontier/verdanturf_battle_tent_trainer_mons.inc"
|
||||
|
||||
@ 85DE610
|
||||
.include "data/battle_frontier/verdanturf_battle_tent_trainers.inc"
|
||||
|
||||
@ 85DEC28
|
||||
.include "data/battle_frontier/verdanturf_battle_tent_mons.inc"
|
||||
|
||||
@ 85DEEF8
|
||||
.include "data/battle_frontier/fallarbor_battle_tent_trainer_mons.inc"
|
||||
|
||||
@ 85DF084
|
||||
.include "data/battle_frontier/fallarbor_battle_tent_trainers.inc"
|
||||
|
||||
@ 85DF69C
|
||||
.include "data/battle_frontier/fallarbor_battle_tent_mons.inc"
|
||||
|
||||
gUnknown_085DF96C:: @ 85DF96C
|
||||
.incbin "baserom.gba", 0x5df96c, 0x40
|
||||
|
||||
gUnknown_085DF9AC:: @ 85DF9AC
|
||||
.incbin "baserom.gba", 0x5df9ac, 0x20
|
||||
|
||||
gUnknown_085DF9CC:: @ 85DF9CC
|
||||
.incbin "baserom.gba", 0x5df9cc, 0x20
|
||||
|
||||
gUnknown_085DF9EC:: @ 85DF9EC
|
||||
.incbin "baserom.gba", 0x5df9ec, 0xa
|
||||
|
||||
gUnknown_085DF9F6:: @ 85DF9F6
|
||||
.incbin "baserom.gba", 0x5df9f6, 0x4
|
||||
|
||||
gUnknown_085DF9FA:: @ 85DF9FA
|
||||
.incbin "baserom.gba", 0x5df9fa, 0x20
|
||||
|
||||
gUnknown_085DFA1A:: @ 85DFA1A
|
||||
.incbin "baserom.gba", 0x5dfa1a, 0x28
|
||||
|
||||
gUnknown_085DFA42:: @ 85DFA42
|
||||
.incbin "baserom.gba", 0x5dfa42, 0x4
|
||||
|
||||
gUnknown_085DFA46:: @ 85DFA46
|
||||
.incbin "baserom.gba", 0x5dfa46, 0xc
|
||||
|
||||
gUnknown_085DFA52:: @ 85DFA52
|
||||
.incbin "baserom.gba", 0x5dfa52, 0xe
|
||||
|
||||
gUnknown_085DFA60:: @ 85DFA60
|
||||
.incbin "baserom.gba", 0x5dfa60, 0x20
|
||||
|
||||
gUnknown_085DFA80:: @ 85DFA80
|
||||
.incbin "baserom.gba", 0x5dfa80, 0xe0
|
||||
|
||||
gUnknown_085DFB60:: @ 85DFB60
|
||||
.incbin "baserom.gba", 0x5dfb60, 0xac
|
||||
|
||||
gUnknown_085DFC0C:: @ 85DFC0C
|
||||
.incbin "baserom.gba", 0x5dfc0c, 0xa4
|
||||
|
||||
gUnknown_085DFCB0:: @ 85DFCB0
|
||||
.incbin "baserom.gba", 0x5dfcb0, 0x14
|
||||
|
||||
gUnknown_085DFCC4:: @ 85DFCC4
|
||||
.incbin "baserom.gba", 0x5dfcc4, 0x5
|
||||
|
||||
gUnknown_085DFCC9:: @ 85DFCC9
|
||||
.incbin "baserom.gba", 0x5dfcc9, 0x3
|
||||
|
||||
gUnknown_085DFCCC:: @ 85DFCCC
|
||||
.incbin "baserom.gba", 0x5dfccc, 0x10
|
||||
|
||||
gUnknown_085DFCDC:: @ 85DFCDC
|
||||
.incbin "baserom.gba", 0x5dfcdc, 0x20
|
||||
|
||||
gUnknown_085DFCFC:: @ 85DFCFC
|
||||
.incbin "baserom.gba", 0x5dfcfc, 0x8
|
||||
|
||||
gUnknown_085DFD04:: @ 85DFD04
|
||||
.incbin "baserom.gba", 0x5dfd04, 0x14
|
||||
|
||||
gUnknown_085DFD18:: @ 85DFD18
|
||||
.incbin "baserom.gba", 0x5dfd18, 0x8
|
||||
|
||||
gUnknown_085DFD20:: @ 85DFD20
|
||||
.incbin "baserom.gba", 0x5dfd20, 0x8
|
||||
|
||||
gUnknown_085DFD28:: @ 85DFD28
|
||||
.incbin "baserom.gba", 0x5dfd28, 0x34
|
||||
|
||||
gUnknown_085DFD5C:: @ 85DFD5C
|
||||
.incbin "baserom.gba", 0x5dfd5c, 0x44
|
||||
|
||||
gUnknown_085DFDA0:: @ 85DFDA0
|
||||
.incbin "baserom.gba", 0x5dfda0, 0x18
|
||||
|
||||
gUnknown_085DFDB8:: @ 85DFDB8
|
||||
.incbin "baserom.gba", 0x5dfdb8, 0x8
|
@ -3,9 +3,15 @@
|
||||
|
||||
void ClearRoamerData(void);
|
||||
void ClearRoamerLocationData(void);
|
||||
void InitRoamer(void);
|
||||
void UpdateLocationHistoryForRoamer(void);
|
||||
void RoamerMoveToOtherLocationSet(void);
|
||||
void RoamerMove();
|
||||
void RoamerMove(void);
|
||||
bool8 IsRoamerAt(u8 mapGroup, u8 mapNum);
|
||||
void CreateRoamerMonInstance(void);
|
||||
u8 TryStartRoamerEncounter(void);
|
||||
void UpdateRoamerHPStatus(struct Pokemon *mon);
|
||||
void SetRoamerInactive(void);
|
||||
void GetRoamerLocation(u8 *mapGroup, u8 *mapNum);
|
||||
|
||||
#endif // GUARD_ROAMER_H
|
||||
|
@ -211,7 +211,7 @@ SECTIONS {
|
||||
asm/learn_move.o(.text);
|
||||
asm/fldeff_softboiled.o(.text);
|
||||
asm/decoration_inventory.o(.text);
|
||||
asm/roamer.o(.text);
|
||||
src/roamer.o(.text);
|
||||
asm/battle_tower.o(.text);
|
||||
asm/use_pokeblock.o(.text);
|
||||
asm/battle_controller_wally.o(.text);
|
||||
@ -421,6 +421,8 @@ SECTIONS {
|
||||
data/contest_ai.o(.rodata);
|
||||
data/battle_controller_safari.o(.rodata);
|
||||
data/rom_8158B30.o(.rodata);
|
||||
src/roamer.o(.rodata);
|
||||
data/rom_85CECB0.o(.rodata);
|
||||
data/battle_controller_wally.o(.rodata);
|
||||
data/player_pc.o(.rodata);
|
||||
data/intro.o(.rodata);
|
||||
|
218
src/roamer.c
Normal file
218
src/roamer.c
Normal file
@ -0,0 +1,218 @@
|
||||
#include "global.h"
|
||||
#include "roamer.h"
|
||||
#include "pokemon.h"
|
||||
#include "rng.h"
|
||||
#include "species.h"
|
||||
#include "event_data.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MAP_GRP = 0, // map group
|
||||
MAP_NUM = 1, // map number
|
||||
};
|
||||
|
||||
EWRAM_DATA static u8 sLocationHistory[3][2] = {0};
|
||||
EWRAM_DATA static u8 sRoamerLocation[2] = {0};
|
||||
|
||||
static const u8 sRoamerLocations[][6] =
|
||||
{
|
||||
{ 0x19, 0x1A, 0x20, 0x21, 0x31, 0xFF },
|
||||
{ 0x1A, 0x19, 0x20, 0x21, 0xFF, 0xFF },
|
||||
{ 0x20, 0x1A, 0x19, 0x21, 0xFF, 0xFF },
|
||||
{ 0x21, 0x20, 0x19, 0x1A, 0x22, 0x26 },
|
||||
{ 0x22, 0x21, 0x23, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x23, 0x22, 0x24, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x24, 0x23, 0x25, 0x26, 0xFF, 0xFF },
|
||||
{ 0x25, 0x24, 0x26, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x26, 0x25, 0x21, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x27, 0x24, 0x28, 0x29, 0xFF, 0xFF },
|
||||
{ 0x28, 0x27, 0x2A, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x29, 0x27, 0x2A, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x2A, 0x28, 0x29, 0x2B, 0xFF, 0xFF },
|
||||
{ 0x2B, 0x2A, 0x2C, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x2C, 0x2B, 0x2D, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x2D, 0x2C, 0x2E, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x2E, 0x2D, 0x2F, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x2F, 0x2E, 0x30, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x30, 0x2F, 0x31, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x31, 0x30, 0x19, 0xFF, 0xFF, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
};
|
||||
|
||||
void ClearRoamerData(void)
|
||||
{
|
||||
memset(&gSaveBlock1Ptr->roamer, 0, sizeof(struct Roamer));
|
||||
(&gSaveBlock1Ptr->roamer)->species = SPECIES_LATIAS;
|
||||
}
|
||||
|
||||
void ClearRoamerLocationData(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
sLocationHistory[i][MAP_GRP] = 0;
|
||||
sLocationHistory[i][MAP_NUM] = 0;
|
||||
}
|
||||
|
||||
sRoamerLocation[MAP_GRP] = 0;
|
||||
sRoamerLocation[MAP_NUM] = 0;
|
||||
}
|
||||
|
||||
static void CreateInitialRoamerMon(bool16 createLatios)
|
||||
{
|
||||
if (!createLatios)
|
||||
(&gSaveBlock1Ptr->roamer)->species = SPECIES_LATIAS;
|
||||
else
|
||||
(&gSaveBlock1Ptr->roamer)->species = SPECIES_LATIOS;
|
||||
|
||||
CreateMon(&gEnemyParty[0], (&gSaveBlock1Ptr->roamer)->species, 40, 0x20, 0, 0, 0, 0);
|
||||
(&gSaveBlock1Ptr->roamer)->level = 40;
|
||||
(&gSaveBlock1Ptr->roamer)->status = 0;
|
||||
(&gSaveBlock1Ptr->roamer)->active = TRUE;
|
||||
(&gSaveBlock1Ptr->roamer)->ivs = GetMonData(&gEnemyParty[0], MON_DATA_IVS);
|
||||
(&gSaveBlock1Ptr->roamer)->personality = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY);
|
||||
(&gSaveBlock1Ptr->roamer)->hp = GetMonData(&gEnemyParty[0], MON_DATA_MAX_HP);
|
||||
(&gSaveBlock1Ptr->roamer)->cool = GetMonData(&gEnemyParty[0], MON_DATA_COOL);
|
||||
(&gSaveBlock1Ptr->roamer)->beauty = GetMonData(&gEnemyParty[0], MON_DATA_BEAUTY);
|
||||
(&gSaveBlock1Ptr->roamer)->cute = GetMonData(&gEnemyParty[0], MON_DATA_CUTE);
|
||||
(&gSaveBlock1Ptr->roamer)->smart = GetMonData(&gEnemyParty[0], MON_DATA_SMART);
|
||||
(&gSaveBlock1Ptr->roamer)->tough = GetMonData(&gEnemyParty[0], MON_DATA_TOUGH);
|
||||
sRoamerLocation[MAP_GRP] = 0;
|
||||
sRoamerLocation[MAP_NUM] = sRoamerLocations[Random() % 20][0];
|
||||
}
|
||||
|
||||
void InitRoamer(void)
|
||||
{
|
||||
ClearRoamerData();
|
||||
ClearRoamerLocationData();
|
||||
CreateInitialRoamerMon(gSpecialVar_0x8004);
|
||||
}
|
||||
|
||||
void UpdateLocationHistoryForRoamer(void)
|
||||
{
|
||||
sLocationHistory[2][MAP_GRP] = sLocationHistory[1][MAP_GRP];
|
||||
sLocationHistory[2][MAP_NUM] = sLocationHistory[1][MAP_NUM];
|
||||
|
||||
sLocationHistory[1][MAP_GRP] = sLocationHistory[0][MAP_GRP];
|
||||
sLocationHistory[1][MAP_NUM] = sLocationHistory[0][MAP_NUM];
|
||||
|
||||
sLocationHistory[0][MAP_GRP] = gSaveBlock1Ptr->location.mapGroup;
|
||||
sLocationHistory[0][MAP_NUM] = gSaveBlock1Ptr->location.mapNum;
|
||||
}
|
||||
|
||||
void RoamerMoveToOtherLocationSet(void)
|
||||
{
|
||||
u8 val = 0;
|
||||
struct Roamer *roamer = &gSaveBlock1Ptr->roamer;
|
||||
|
||||
if (!roamer->active)
|
||||
return;
|
||||
|
||||
sRoamerLocation[MAP_GRP] = val;
|
||||
|
||||
while (1)
|
||||
{
|
||||
val = sRoamerLocations[Random() % 20][0];
|
||||
if (sRoamerLocation[MAP_NUM] != val)
|
||||
{
|
||||
sRoamerLocation[MAP_NUM] = val;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RoamerMove(void)
|
||||
{
|
||||
u8 locSet = 0;
|
||||
|
||||
if ((Random() % 16) == 0)
|
||||
{
|
||||
RoamerMoveToOtherLocationSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
struct Roamer *roamer = &gSaveBlock1Ptr->roamer;
|
||||
|
||||
if (!roamer->active)
|
||||
return;
|
||||
|
||||
while (locSet < 20)
|
||||
{
|
||||
if (sRoamerLocation[MAP_NUM] == sRoamerLocations[locSet][0])
|
||||
{
|
||||
u8 mapNum;
|
||||
while (1)
|
||||
{
|
||||
mapNum = sRoamerLocations[locSet][(Random() % 5) + 1];
|
||||
if (!(sLocationHistory[2][MAP_GRP] == 0 && sLocationHistory[2][MAP_NUM] == mapNum) && mapNum != 0xFF)
|
||||
break;
|
||||
}
|
||||
sRoamerLocation[MAP_NUM] = mapNum;
|
||||
return;
|
||||
}
|
||||
locSet++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8 IsRoamerAt(u8 mapGroup, u8 mapNum)
|
||||
{
|
||||
struct Roamer *roamer = &gSaveBlock1Ptr->roamer;
|
||||
|
||||
if (roamer->active && mapGroup == sRoamerLocation[MAP_GRP] && mapNum == sRoamerLocation[MAP_NUM])
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CreateRoamerMonInstance(void)
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
struct Roamer *roamer;
|
||||
|
||||
mon = &gEnemyParty[0];
|
||||
ZeroEnemyPartyMons();
|
||||
roamer = &gSaveBlock1Ptr->roamer;
|
||||
CreateMonWithIVsPersonality(mon, roamer->species, roamer->level, roamer->ivs, roamer->personality);
|
||||
SetMonData(mon, MON_DATA_STATUS, &gSaveBlock1Ptr->roamer.status);
|
||||
SetMonData(mon, MON_DATA_HP, &gSaveBlock1Ptr->roamer.hp);
|
||||
SetMonData(mon, MON_DATA_COOL, &gSaveBlock1Ptr->roamer.cool);
|
||||
SetMonData(mon, MON_DATA_BEAUTY, &gSaveBlock1Ptr->roamer.beauty);
|
||||
SetMonData(mon, MON_DATA_CUTE, &gSaveBlock1Ptr->roamer.cute);
|
||||
SetMonData(mon, MON_DATA_SMART, &gSaveBlock1Ptr->roamer.smart);
|
||||
SetMonData(mon, MON_DATA_TOUGH, &gSaveBlock1Ptr->roamer.tough);
|
||||
}
|
||||
|
||||
bool8 TryStartRoamerEncounter(void)
|
||||
{
|
||||
if (IsRoamerAt(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum) == TRUE && (Random() % 4) == 0)
|
||||
{
|
||||
CreateRoamerMonInstance();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateRoamerHPStatus(struct Pokemon *mon)
|
||||
{
|
||||
(&gSaveBlock1Ptr->roamer)->hp = GetMonData(mon, MON_DATA_HP);
|
||||
(&gSaveBlock1Ptr->roamer)->status = GetMonData(mon, MON_DATA_STATUS);
|
||||
|
||||
RoamerMoveToOtherLocationSet();
|
||||
}
|
||||
|
||||
void SetRoamerInactive(void)
|
||||
{
|
||||
struct Roamer *roamer = &gSaveBlock1Ptr->roamer;
|
||||
roamer->active = FALSE;
|
||||
}
|
||||
|
||||
void GetRoamerLocation(u8 *mapGroup, u8 *mapNum)
|
||||
{
|
||||
*mapGroup = sRoamerLocation[MAP_GRP];
|
||||
*mapNum = sRoamerLocation[MAP_NUM];
|
||||
}
|
@ -1550,11 +1550,7 @@ gUnknown_0203BC38: @ 203BC38
|
||||
gDecorationInventories: @ 203BC40
|
||||
.space 0x40
|
||||
|
||||
sLocationHistory: @ 203BC80
|
||||
.space 0x6
|
||||
|
||||
sRoamerLocation: @ 203BC86
|
||||
.space 0x2
|
||||
.include "src/roamer.o"
|
||||
|
||||
gUnknown_0203BC88: @ 203BC88
|
||||
.space 0x4
|
||||
|
Loading…
Reference in New Issue
Block a user