Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .thumb
- @in this example, pirouette form is 0xF1, and aria is 0xF0
- .equ asm_offset, 0x08800000
- .equ battle_script, 0x08810000
- .equ end_battle_hook_offset, 0x08820000
- .equ faint_hook_offset, 0x08830000
- .equ nopalfade_offset, 0x08840000
- .equ revert_offset, 0x08850000
- .align 2
- .org 0x080159DC
- end_battle:
- ldr r0, hooky_thing
- bx r0
- .align 2
- hooky_thing: .word end_battle_hook_offset + 1
- .align 2
- .org 0x080326C4
- fainting:
- ldr r3, faint_thingy
- bx r3
- .align 2
- faint_thingy: .word faint_hook_offset + 1
- .align 2
- .org 0x08034FFC
- nopalfade_hook:
- ldr r0, nopalfade
- bx r0
- .align 2
- nopalfade: .word nopalfade_offset + 1
- @@@@@@@@@@@@@@@@asm called in battle script
- .align 2
- .org asm_offset
- check_pkmn_id:
- push {lr}
- ldr r0, attacking_bank
- ldrb r1, [r0] @which mon did the attack
- ldr r0, ram_pointer
- ldr r0, [r0]
- add r0, r0, #0x60
- cmp r1, #0x0
- beq set_player_singles
- cmp r1, #0x1
- beq set_enemy_singles
- cmp r1, #0x2
- beq set_player_doubles
- cmp r1, #0x3
- beq set_enemy_doubles
- get_battle_struct:
- ldr r0, attacking_bank
- ldrb r1, [r0] @which mon did the attack
- mov r0, #0x58 @length of battle structs
- mul r1, r0, r1 @multiplies length of battle structs with which mon did the attack to get the the battle structure i'm working with
- ldr r0, battle_struct
- add r0, r1, r0 @r0 is the battle struct i'm working with
- check_if_aria:
- add r2, r2, #0x20
- ldrh r1, [r2]
- cmp r1, #0xF0
- bne end
- set_pirouette_forme:
- mov r1, #0xF1
- strh r1, [r0] @species in battle struct is now the correct thing
- strh r1, [r2] @species in party is now pirouette's
- sub r2, r2, #0x20 @makes r2 go to the beginning of the party again
- push {r0}
- mov r0, r2
- mov r1, r2
- push {r2}
- ldr r3, calc_stats0
- bl jump @stats should be calculated
- pop {r2}
- pop {r0} @r2 is the beginning of the party slot, r0 is the beginning of the battle struct
- update_type:
- add r0, #0x22
- mov r1, #0x1
- strb r1, [r0] @second type in battle struct is now fighting
- update_battle_struct:
- sub r0, r0, #0x20
- add r2, r2, #0x5A @r0 is at the attack stat, r2 is at the party attack stat
- mov r3, #0x0
- stat_loop:
- ldrh r1, [r2]
- strh r1, [r0]
- add r0, r0, #0x2
- add r2, r2, #0x2
- add r3, r3, #0x1
- cmp r3, #0x4
- bne stat_loop
- end:
- pop {pc}
- jump:
- mov pc, r3
- set_player_singles:
- ldrb r0, [r0]
- lsr r0, #0x4 @only one digit is left
- mov r1, #0x64 @length of party entry
- ldr r2, player_party0
- mul r0, r0, r1
- add r2, r0, r2 @gets r2 to the correct slot
- b get_battle_struct
- set_enemy_singles:
- add r0, r0, #0x3 @gets to party order for enemy
- ldrb r0, [r0]
- lsr r0, #0x4
- mov r1, #0x64
- ldr r2, enemy_party0
- mul r0, r0, r1
- add r2, r0, r2
- b get_battle_struct
- set_player_doubles:
- ldrb r0, [r0]
- lsl r0, #0x1C
- lsr r0, #0x1C @gets the second pokemon's location
- mov r1, #0x64
- ldr r2, player_party0
- mul r0, r0, r1
- add r2, r0, r2
- b get_battle_struct
- set_enemy_doubles:
- add r0, r0, #0x3
- ldrb r0, [r0]
- lsl r0, #0x1C
- lsr r0, #0x1C
- mov r1, #0x64
- ldr r2, enemy_party0
- mul r0, r0, r1
- add r2, r0, r2
- b get_battle_struct
- .align 2
- battle_struct: .word 0x02023BE4
- player_party0: .word 0x02024284
- enemy_party0: .word 0x0202402C
- order_pointer: .word 0x02023FE8
- attacking_bank: .word 0x02023D6B
- calc_stats0: .word 0x0803E47C
- ram_pointer: .word 0x02023FE8
- @@@@@@@@@@@@@@@@end battle hook
- .align 2
- .org end_battle_hook_offset
- start_end_battle:
- push {r0-r4}
- ldr r0, player_party1
- ldr r1, revert_to_aria_forme
- bl jump_with_r1
- ldr r0, ram_loc0
- mov r1, #0x0
- strh r1, [r0]
- pop {r0-r4}
- ldr r1, wut1
- ldr r0, wut2
- str r0, [r1]
- ldr r1, wut3
- ldr r0, continuing
- bx r0
- jump_with_r1:
- mov pc, r1
- .align 2
- revert_to_aria_forme: .word revert_offset
- ram_loc0: .word 0x020370D4
- player_party1: .word 0x02024284
- wut1: .word 0x03004F84
- wut2: .word 0x08015A31
- wut3: .word 0x0300537C
- continuing: .word 0x080159E5
- @@@@@@@@@@@@@@@@faint hook
- .align 2
- .org faint_hook_offset
- faint_hook:
- add r0, r2
- push {r0-r3}
- ldr r0, player_party
- ldr r3, revert_to_aria
- bl call_via_r3
- ldr r0, ram_loc1
- mov r1, #0x0
- strh r1, [r0]
- pop {r0-r3}
- continue_with_faint:
- ldr r3, fainting_call
- bl call_via_r3
- mov r1, #0x40
- ldr r3, return_fainting
- call_via_r3:
- bx r3
- .align 2
- revert_to_aria: .word revert_offset + 1
- player_party: .word 0x02024284
- ram_loc1: .word 0x020370D4
- fainting_call: .word 0x08035244 + 1
- return_fainting: .word 0x080326CC + 1
- @@@@@@@@@@@@@@@@
- .align 2
- .org nopalfade_offset
- start_nopalfade:
- ldr r0, current_move
- ldrh r0, [r0]
- cmp r0, #0x90 @compares move to Tranform
- bne skip
- continue_with_fade:
- ldr r3, thing
- mov r0, r10
- mov r1, #0x10
- mov r2, #0x6
- ldr r4, palfade
- bl jump_with_r4
- ldr r1, return
- mov pc, r1
- skip:
- ldr r0, return2
- mov pc, r0
- jump_with_r4:
- mov pc, r4
- .align 2
- current_move: .word 0x02023D4A
- thing: .word 0x7FFF
- palfade: .word 0x08045274
- return: .word 0x08035008
- return2: .word 0x08035028
- @@@@@@@@@@@@@@@@
- .align 2
- .org revert_offset
- .thumb @the hooks decide whether or not to use the enemy's party table or
- .align 2 @the player's, that's why they're not here.
- start:
- push {r0-r3, lr}
- add r0, r0, #0x20
- loop:
- ldrh r1, [r0]
- cmp r1, #0xF1 @compares the species to pirouette forme
- beq push_hp @if the pokemon is pirouette forme, reverts the pokemon
- add r0, r0, #0x64 @goes to the next slot
- add r2, r2, #0x1 @sets counter to one more
- cmp r2, #0x5 @checks if whole party has been scanned
- bne loop @if it hasn't happened 6 times it'll loop again
- end_if_no_pirouette:
- pop {r0-r3, pc} @ends if nothing in the party is pirouette forme
- push_hp:
- add r0, r0, #0x36
- ldrh r3, [r0]
- mov r4, r0
- push {r3}
- push {r4}
- revert:
- mov r1, #0x84
- strh r1, [r0] @makes species aria forme
- sub r0, r0, #0x56 @makes r0 the beginning of the party
- mov r1, r0 @r0 and r1 should be the same
- ldr r2, calc_stats
- bl jump_with_r2
- fix_hp:
- pop {r4}
- pop {r3} @r3 is the current hp, r4 is the offset of that
- strh r3, [r4]
- end_revert:
- pop {r0-r3, pc} @ends
- jump_with_r2:
- mov pc, r2 @executes calc_stats
- .align 2
- calc_stats: .word 0x0803E47C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement