mirror of
https://github.com/notblisy/RUBYSAPPHIREDLC.git
synced 2026-04-26 17:16:48 -05:00
178 lines
4.1 KiB
Plaintext
178 lines
4.1 KiB
Plaintext
IsWaiting:
|
|
push {r0-r7}
|
|
mov r2, #255 @If my vblankintr is running during a save, game will crash.
|
|
add r2, #10 @IsWaiting is checking if a value in sUnused is 0.
|
|
ldr r1, sUnused @if it's not, it increments it by 1 until we reach 265. This is about how long the game takes to save.
|
|
ldr r0, [r1]
|
|
cmp r0, #0 @if the value here is 0, we go to the code that checks if we're currently saving.
|
|
beq AreInPartyMenu
|
|
add r0, #1
|
|
cmp r0, r2
|
|
beq ClearWait
|
|
str r0, [r1]
|
|
b ExitToVblankIntr
|
|
ClearWait:
|
|
mov r0, #0
|
|
str r0, [r1]
|
|
AreInPartyMenu:
|
|
ldr r0, gMain_CB2 @check if we're in party menu
|
|
ldr r2, [r0]
|
|
ldr r1, CB2_ReturnToFieldWithOpenMenu
|
|
cmp r2, r1 @if we are, exit to vblankintr
|
|
beq RestoreStats
|
|
ldr r2, [r0]
|
|
ldr r1, CB2_UpdatePartyMenu
|
|
cmp r2, r1
|
|
bne ExitToVblankIntr @if we're not, end.
|
|
sub r0, #4 @if we are in a battle, don't allow.
|
|
ldr r0, [r0]
|
|
ldr r1, BattleMainCB1
|
|
cmp r0, r1
|
|
beq ExitToVblankIntr
|
|
CheckButtonPress:
|
|
mov r4, #39
|
|
ldr r0, Buttons
|
|
ldr r0, [r0]
|
|
ldr r1, SelectR
|
|
cmp r0, r1
|
|
beq ChangeStats
|
|
ldr r1, SelectStart
|
|
cmp r0, r1
|
|
beq SetEVs
|
|
b ExitToVblankIntr
|
|
SetEVs:
|
|
mov r4, #26
|
|
ChangeStats:
|
|
ldr r0, sUnused @if not equal, hijack.
|
|
mov r1, #255 @Once success state is triggered, place 1 into sUnused for IsWaiting to begin its loop of 265 frames.
|
|
str r1, [r0]
|
|
ldr r0, gPlayerParty @load pokemon iv I want to edit
|
|
mov r5, r0 @copy r0 into r5
|
|
mov r6, r0
|
|
PokemonLoop:
|
|
mov r2, pc @preserve lr to return to after function
|
|
add r2, #9
|
|
mov lr, r2
|
|
mov r1, #11 @check if species is 0, if it is, exit loop.
|
|
ldr r3, GetMonData2
|
|
bx r3
|
|
cmp r0, #0
|
|
beq PlaySound
|
|
mov r0, r5
|
|
ldr r1, gEnemyParty
|
|
cmp r0, r1
|
|
beq PlaySound
|
|
mov r7, #0
|
|
add r5, #0x58
|
|
@cmp r4, #1
|
|
@beq EVLoop
|
|
IVLoop:
|
|
mov r2, pc @preserve lr to return to after function
|
|
add r2, #11
|
|
mov lr, r2
|
|
mov r1, r4
|
|
add r1, r7
|
|
ldr r3, GetMonData2
|
|
bx r3
|
|
add r7, #1
|
|
cmp r7, #6
|
|
bgt NextPokemon
|
|
strh r0, [r5]
|
|
add r5, #2
|
|
mov r0, r6
|
|
b IVLoop
|
|
@EVLoop:
|
|
@mov r2, pc @preserve lr to return to after function
|
|
@add r2, #11
|
|
@mov lr, r2
|
|
@mov r1, #26
|
|
@add r1, r7
|
|
@ldr r3, GetMonData2
|
|
@bx r3
|
|
@add r7, #1
|
|
@cmp r7, #6
|
|
@bgt NextPokemon
|
|
@strh r0, [r5]
|
|
@add r5, #2
|
|
@mov r0, r6
|
|
@.b EVLoop
|
|
NextPokemon:
|
|
mov r6, r5
|
|
mov r0, r6
|
|
b PokemonLoop
|
|
PlaySound:
|
|
mov r2, pc @preserve lr to return to after function
|
|
add r2, #9
|
|
mov lr, r2
|
|
ldr r3, PlaySE
|
|
mov r0, #01
|
|
bx r3
|
|
b ExitToVblankIntr
|
|
RestoreStats:
|
|
add r0, #8
|
|
ldr r2, [r0]
|
|
ldr r1, VBlankCB_PartyMenu
|
|
cmp r2, r1
|
|
bne ExitToVblankIntr
|
|
mov r7, #0
|
|
ldr r5, gPlayerParty
|
|
CalculateStatsLoop:
|
|
mov r4, r5
|
|
add r4, #86
|
|
ldrh r6, [r4]
|
|
mov r2, pc @preserve lr to return to after function
|
|
add r2, #9
|
|
mov lr, r2
|
|
ldr r3, CalculateMonStats
|
|
mov r0, r5
|
|
bx r3
|
|
add r7, #1
|
|
strh r6, [r4]
|
|
add r5, #100
|
|
cmp r7, #6
|
|
bne CalculateStatsLoop
|
|
ldr r0, sUnused @if not equal, hijack.
|
|
mov r1, #255 @Once success state is triggered, place 1 into sUnused for IsWaiting to begin its loop of 265 frames.
|
|
str r1, [r0]
|
|
ExitToVblankIntr:
|
|
ldr r0, VBlankIntrLR @Restore proper LR VblankIntr needs.
|
|
mov lr, r0
|
|
End:
|
|
pop {r0-r7}
|
|
ldr r3, VBlankIntr
|
|
bx r3
|
|
.align
|
|
VBlankIntr:
|
|
.long 0x08000739
|
|
VBlankIntrLR:
|
|
.long 0x0300287C
|
|
PlaySE:
|
|
.long 0x080a37a5
|
|
gMain_CB2:
|
|
.long 0x30022c4
|
|
CB2_UpdatePartyMenu:
|
|
.long 0x081b01b1
|
|
CB2_OverworldBasic:
|
|
.long 0x08085e5D
|
|
gPlayerParty:
|
|
.long 0x020244ec
|
|
gEnemyParty:
|
|
.long 0x02024744
|
|
GetMonData2:
|
|
.long 0x0806a519
|
|
SelectR:
|
|
.long 0x000002fb
|
|
SelectStart:
|
|
.long 0x000003f3
|
|
Buttons:
|
|
.long 0x04000130
|
|
sUnused: @where I store my timer for IsWaiting
|
|
.long 0x02022c34
|
|
BattleMainCB1:
|
|
.long 0x08039EF1
|
|
CB2_ReturnToFieldWithOpenMenu:
|
|
.long 0x08086195
|
|
VBlankCB_PartyMenu:
|
|
.long 0x081b01cd
|
|
CalculateMonStats:
|
|
.long 0x08068d0D |