Merge pull request #15 from camthesaxman/battle_ai

start decompiling battle_ai
This commit is contained in:
YamaArashi 2017-02-01 20:17:55 -08:00 committed by GitHub
commit 39299306e0
36 changed files with 2148 additions and 2478 deletions

4
.gitignore vendored
View File

@ -17,3 +17,7 @@ tools/*
*.map
*.ld
*.bat
*.dump
*.sav
Thumbs.db
.DS_Store

View File

@ -27,7 +27,7 @@ sub_814AEB0: @ 814AEB0
bx_exec_buffer_A_ch0_tbl4: @ 814AECC
push {lr}
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
lsls r0, r3, 2
@ -176,7 +176,7 @@ sub_814B004: @ 814B004
lsls r0, 24
cmp r0, 0
beq _0814B05C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -352,7 +352,7 @@ _0814B136:
lsls r0, 24
cmp r0, 0
beq _0814B1F0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -979,7 +979,7 @@ dp01_tbl4_exec_completed: @ 814B740
adds r0, r1
ldr r1, =bx_exec_buffer_A_ch0_tbl4
str r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -1002,7 +1002,7 @@ dp01_tbl4_exec_completed: @ 814B740
.pool
_0814B794:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
@ -3598,7 +3598,7 @@ sub_814CF30: @ 814CF30
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -5221,7 +5221,7 @@ _0814DCF8:
lsls r0, 24
cmp r0, 0
beq _0814DD18
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1

File diff suppressed because it is too large Load Diff

View File

@ -10736,7 +10736,7 @@ _08103DB6:
lsrs r0, 24
strh r0, [r4, 0x1C]
mov r9, r0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1
@ -16986,7 +16986,7 @@ _081070A6:
sub_81070AC: @ 81070AC
push {r4,r5,lr}
adds r5, r0, 0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1
@ -50436,7 +50436,7 @@ battle_intro_launch: @ 81181D4
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x80
lsls r1, 15
@ -50587,7 +50587,7 @@ _08118330:
.4byte _081183E4
.4byte _08118524
_08118344:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -50937,7 +50937,7 @@ _0811861C:
adds r2, r0, r1
movs r3, 0x10
strh r3, [r2, 0x10]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -51236,7 +51236,7 @@ _08118898:
lsls r0, 3
adds r2, r0, r1
strh r4, [r2, 0x10]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1

View File

@ -1261,7 +1261,7 @@ sub_8170F2C: @ 8170F2C
push {r6,r7}
lsls r0, 24
lsrs r7, r0, 24
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 2

View File

@ -114,7 +114,7 @@ _0814E1B4:
.4byte _0814E4F8
.4byte _0814E55C
_0814E1CC:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r2, [r0]
movs r0, 0x8
ands r0, r2
@ -219,7 +219,7 @@ _0814E2AC:
lsls r0, 24
cmp r0, 0
bne _0814E310
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x1
ands r0, r1
@ -258,7 +258,7 @@ _0814E308:
b _0814E6D8
.pool
_0814E310:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x1
ands r0, r1
@ -333,7 +333,7 @@ _0814E394:
_0814E3BC:
cmp r2, 0x1
beq _0814E3CC
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1
@ -357,7 +357,7 @@ _0814E3EC:
ldrh r1, [r0]
movs r0, 0x80
lsls r0, 4
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
cmp r1, r0
beq _0814E406
ldr r0, [r2]
@ -395,7 +395,7 @@ _0814E430:
ldrb r2, [r0]
cmp r2, 0
beq _0814E456
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1
@ -421,7 +421,7 @@ _0814E47C:
b _0814E6D8
.pool
_0814E488:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x02000002
ands r0, r1
@ -543,7 +543,7 @@ _0814E58A:
b _0814E6D8
.pool
_0814E5A4:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -570,7 +570,7 @@ _0814E5C4:
eors r0, r1
strb r0, [r4]
_0814E5E0:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x40
ands r0, r1
@ -774,7 +774,7 @@ get_battle_strings: @ 814E764
mov r8, r1
movs r6, 0
movs r4, 0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 18
@ -1100,7 +1100,7 @@ _0814EAF8:
adds r2, r4, 0
cmp r0, 0
beq _0814EB74
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -1225,7 +1225,7 @@ _0814EC38:
lsls r0, 24
cmp r0, 0
beq _0814ECA8
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -1290,7 +1290,7 @@ _0814ECD4:
lsls r0, 24
cmp r0, 0
beq _0814ED44
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -1355,7 +1355,7 @@ _0814ED70:
lsls r0, 24
cmp r0, 0
beq _0814EDE0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -1420,7 +1420,7 @@ _0814EE0C:
lsls r0, 24
cmp r0, 0
beq _0814EE7C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -1485,7 +1485,7 @@ _0814EEA8:
lsls r0, 24
cmp r0, 0
beq _0814EF18
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -1583,7 +1583,7 @@ _0814EF8A:
b _0814F5C0
.pool
_0814EF98:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x02000002
ands r0, r1
@ -1709,7 +1709,7 @@ _0814F0C0:
b _0814F5C0
.pool
_0814F0D8:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x80
lsls r0, 20
@ -1775,7 +1775,7 @@ _0814F14E:
b _0814F5A2
.pool
_0814F164:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x80
lsls r0, 20
@ -1922,7 +1922,7 @@ _0814F284:
b _0814F5C0
.pool
_0814F298:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -1938,7 +1938,7 @@ _0814F2B4:
b _0814F5C0
.pool
_0814F2C0:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x003f0100
ands r0, r1
@ -1965,7 +1965,7 @@ _0814F2F8:
adds r4, r0, 0
b _0814F5C0
_0814F300:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x003f0100
ands r0, r1
@ -1992,7 +1992,7 @@ _0814F330:
lsls r0, 24
cmp r0, 0
beq _0814F39C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x8
ands r1, r0
@ -2114,7 +2114,7 @@ _0814F456:
b _0814F5C0
.pool
_0814F468:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x003f0100
ands r0, r1
@ -2147,7 +2147,7 @@ _0814F49C:
b _0814F5A2
.pool
_0814F4B8:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x003f0100
ands r0, r1
@ -2179,7 +2179,7 @@ _0814F4F0:
b _0814F5C0
.pool
_0814F508:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x003f0100
ands r0, r1
@ -2206,7 +2206,7 @@ _0814F540:
adds r4, r0, 0
b _0814F5C0
_0814F548:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r0, =0x003f0100
ands r0, r1
@ -2479,7 +2479,7 @@ _0814F744:
b _0814F7A4
.pool
_0814F768:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x8
ands r0, r1
@ -2590,7 +2590,7 @@ _0814F858:
ldrb r0, [r0, 0x2]
lsls r0, 8
orrs r2, r0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1
@ -2898,7 +2898,7 @@ _0814FAE0:
_0814FAE8:
strb r1, [r0]
adds r3, r0, 0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r2, =0x01000002
ands r1, r2

View File

@ -114,7 +114,7 @@ sub_80B06BC: @ 80B06BC
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0AF8
str r0, [r1, 0x8]
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
movs r0, 0
str r0, [r4]
bl InBattlePyramid
@ -156,7 +156,7 @@ sub_80B072C: @ 80B072C
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0AF8
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x80
lsls r0, 3
str r0, [r1]
@ -185,7 +185,7 @@ sub_80B077C: @ 80B077C
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80FC190
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x80
str r0, [r1]
bl sub_80B0EC8
@ -207,7 +207,7 @@ sub_80B07B4: @ 80B07B4
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0AF8
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x80
lsls r0, 13
str r0, [r1]
@ -287,7 +287,7 @@ sub_80B086C: @ 80B086C
ldr r1, =gUnknown_030022C0
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x80
lsls r0, 2
str r0, [r1]
@ -306,7 +306,7 @@ sub_80B08A8: @ 80B08A8
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0
str r0, [r1]
bl sub_80B0EC8
@ -332,7 +332,7 @@ sub_80B08EC: @ 80B08EC
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x80
lsls r0, 6
str r0, [r1]
@ -359,7 +359,7 @@ sub_80B0934: @ 80B0934
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
movs r0, 0x80
lsls r0, 6
str r0, [r4]
@ -396,7 +396,7 @@ _080B0988:
cmp r1, r0
beq _080B09E4
_080B099A:
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x80
lsls r1, 21
@ -461,7 +461,7 @@ sub_80B0A18: @ 80B0A18
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0xC0
lsls r0, 6
str r0, [r1]
@ -498,7 +498,7 @@ sub_80B0A74: @ 80B0A74
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0xC0
lsls r0, 7
str r0, [r1]
@ -1380,7 +1380,7 @@ sub_80B11A8: @ 80B11A8
lsrs r0, 24
cmp r0, 0x1
bne _080B11F0
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x10
str r0, [r1]
ldr r1, =gUnknown_030022C0
@ -2104,12 +2104,12 @@ sub_80B17E0: @ 80B17E0
ldrb r0, [r0]
cmp r0, 0x2
bne _080B17FC
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x00008009
b _080B1800
.pool
_080B17FC:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x8
_080B1800:
str r0, [r1]
@ -2120,7 +2120,7 @@ _080B1800:
ldr r0, =0x0000400e
movs r1, 0
bl VarSet
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x80
lsls r1, 14
@ -2166,7 +2166,7 @@ _080B1884:
lsls r0, 24
cmp r0, 0
beq _080B18B8
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x80
lsls r1, 19
@ -2308,7 +2308,7 @@ _080B19E2:
thumb_func_start sub_80B19EC
sub_80B19EC: @ 80B19EC
push {lr}
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x8
str r0, [r1]
ldr r1, =gUnknown_030022C0

View File

@ -1270,7 +1270,7 @@ sub_80B2E4C: @ 80B2E4C
ldr r2, =0x00001133
adds r0, r2, 0
strh r0, [r1]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0
str r0, [r1]
movs r0, 0x2
@ -1291,7 +1291,7 @@ sub_80B2E74: @ 80B2E74
ldr r2, =0x00003311
adds r0, r2, 0
strh r0, [r1]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0
str r0, [r1]
movs r0, 0x2
@ -1458,7 +1458,7 @@ sub_80B2FD8: @ 80B2FD8
ldr r2, =0x00004411
adds r0, r2, 0
strh r0, [r1]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0
str r0, [r1]
movs r0, 0x2
@ -1476,7 +1476,7 @@ sub_80B3000: @ 80B3000
ldr r2, =0x00006601
adds r0, r2, 0
strh r0, [r1]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0
str r0, [r1]
movs r0, 0x4
@ -1494,7 +1494,7 @@ sub_80B3028: @ 80B3028
ldr r2, =0x00006602
adds r0, r2, 0
strh r0, [r1]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0
str r0, [r1]
movs r0, 0x2
@ -1751,23 +1751,23 @@ _080B3270:
beq _080B32A0
b _080B32A6
_080B327A:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0xA
b _080B32A4
.pool
_080B3284:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0xB
b _080B32A4
.pool
_080B3290:
bl sub_80F94E8
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x4B
b _080B32A4
.pool
_080B32A0:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x0000014b
_080B32A4:
str r0, [r1]
@ -2150,7 +2150,7 @@ _080B35FE:
thumb_func_start sub_80B360C
sub_80B360C: @ 80B360C
push {r4,r5,lr}
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x21
negs r1, r1

View File

@ -261,7 +261,7 @@ _08069790:
mov r0, r9
cmp r0, 0x22
bne _080697C6
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x003f0100
ands r0, r1
@ -288,7 +288,7 @@ _080697C6:
ldr r0, [sp, 0x20]
cmp r0, 0x22
bne _080697FC
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x003f0100
ands r0, r1
@ -728,7 +728,7 @@ _08069B48:
ldrb r1, [r4]
cmp r1, 0x1
bne _08069B8A
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ands r0, r1
cmp r0, 0
@ -750,7 +750,7 @@ _08069B84:
adds r0, r5, r0
asrs r5, r0, 1
_08069B8A:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1
@ -880,7 +880,7 @@ _08069C76:
ldrb r1, [r4]
cmp r1, 0x1
bne _08069CCA
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ands r0, r1
cmp r0, 0
@ -902,7 +902,7 @@ _08069CC4:
adds r0, r5, r0
asrs r5, r0, 1
_08069CCA:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1

View File

@ -1056,7 +1056,7 @@ _080D8004:
strb r3, [r1, 0x2]
movs r2, 0x2
strb r2, [r1, 0x3]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
str r4, [r0]
ldr r4, =gUnknown_0202420B
strb r2, [r4]

File diff suppressed because it is too large Load Diff

View File

@ -2618,7 +2618,7 @@ ItemUseInBattle_Escape: @ 80FE5E4
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x8
ands r0, r1

View File

@ -3065,7 +3065,7 @@ _0800ACCA:
_0800ACD0:
cmp r3, r2
bne _0800ACF4
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x21
negs r1, r1
@ -3169,7 +3169,7 @@ _0800ADAE:
_0800ADB6:
cmp r1, r3
bne _0800ADDA
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x21
negs r1, r1
@ -13509,7 +13509,7 @@ _080101E6:
ble _080101DC
cmp r2, r5
bne _08010220
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x21
negs r1, r1
@ -21074,7 +21074,7 @@ sub_8014210: @ 8014210
ldr r1, =gUnknown_030022C0
ldr r0, =sub_80B360C
str r0, [r1, 0x8]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
str r6, [r0]
bl sub_806E64C
pop {r4-r6}

View File

@ -489,7 +489,7 @@ _08000782:
ands r0, r1
cmp r0, 0
beq _080007BA
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x013f0102
ands r0, r1

View File

@ -1785,7 +1785,7 @@ _08068914:
.4byte _08068A00
.4byte _08068990
_0806892C:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -1802,7 +1802,7 @@ _0806892C:
b _080689B6
.pool
_08068958:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -1825,7 +1825,7 @@ _08068958:
b _080689CE
.pool
_08068990:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r2, [r0]
movs r3, 0x2
adds r0, r2, 0
@ -1889,7 +1889,7 @@ get_pokemon_data_3: @ 8068A10
push {r4-r6,lr}
adds r5, r0, 0
adds r6, r1, 0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x20
ands r0, r1
@ -2036,7 +2036,7 @@ _08068B34:
thumb_func_start sub_8068B48
sub_8068B48: @ 8068B48
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 18
@ -2084,7 +2084,7 @@ _08068B78:
thumb_func_start sub_8068BB0
sub_8068BB0: @ 8068BB0
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 18

View File

@ -28,7 +28,7 @@ _08069E0A:
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
ldr r4, =gUnknown_02024210
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
_08069E14:
cmp r5, r3
beq _08069E28
@ -63,7 +63,7 @@ _08069E42:
bne _08069E74
ldr r0, =gUnknown_02024210
ldrb r1, [r0]
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r0, r5, 2
adds r0, r2
ldr r0, [r0]
@ -95,7 +95,7 @@ _08069E8A:
bne _08069EBC
ldr r0, =gUnknown_02024210
ldrb r1, [r0]
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r0, r5, 2
adds r0, r2
ldr r0, [r0]
@ -124,7 +124,7 @@ sub_8069ED8: @ 8069ED8
lsrs r5, r0, 16
lsls r1, 24
lsrs r2, r1, 24
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
ldr r0, [r4]
ldr r1, =0x023f0902
ands r0, r1
@ -176,7 +176,7 @@ sub_8069F34: @ 8069F34
ands r4, r0
eors r4, r1
adds r5, r4, 0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ands r0, r6
cmp r0, 0
@ -205,7 +205,7 @@ _08069F7C:
_08069F80:
ldr r0, =gUnknown_02024210
ldrb r1, [r0]
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r0, r4, 2
adds r0, r2
ldr r0, [r0]
@ -1748,7 +1748,7 @@ _0806AB34:
ldrh r5, [r2]
adds r7, r1, 0
adds r2, r6, 0
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
_0806AB3E:
ldrh r3, [r2]
cmp r5, r3
@ -3664,7 +3664,7 @@ battle_data_fill: @ 806B9FC
movs r1, 0xB
movs r2, 0
bl pokemon_getattr
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
mov r8, r1
movs r1, 0x58
ldr r2, [sp, 0x14]

View File

@ -272,7 +272,7 @@ _0806BF2C:
ldr r0, [sp, 0x38]
cmp r0, 0x4
beq _0806BF76
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
movs r0, 0x58
ldr r2, [sp, 0x38]
muls r0, r2
@ -295,7 +295,7 @@ _0806BF76:
ands r0, r1
cmp r0, 0
beq _0806BFA4
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
ldr r0, =gUnknown_02024064
ldrb r2, [r0]
movs r0, 0x58
@ -321,7 +321,7 @@ _0806BFA4:
bne _0806BFB2
bl _0806CD4C
_0806BFB2:
ldr r6, =gUnknown_02024084
ldr r6, =gBattleMons
ldr r5, =gUnknown_02024064
ldrb r0, [r5]
movs r4, 0x58
@ -360,7 +360,7 @@ _0806BFFC:
adds r6, r2, 0
cmp r3, 0
beq _0806C042
ldr r7, =gUnknown_02024084
ldr r7, =gBattleMons
ldr r5, =gUnknown_02024064
ldrb r0, [r5]
movs r4, 0x58
@ -394,7 +394,7 @@ _0806C042:
bne _0806C050
bl _0806CD4C
_0806C050:
ldr r6, =gUnknown_02024084
ldr r6, =gBattleMons
ldr r5, =gUnknown_02024064
ldrb r0, [r5]
movs r4, 0x58
@ -431,7 +431,7 @@ _0806C08C:
adds r6, r2, 0
cmp r3, 0
beq _0806C0D2
ldr r7, =gUnknown_02024084
ldr r7, =gBattleMons
ldr r5, =gUnknown_02024064
ldrb r0, [r5]
movs r4, 0x58
@ -465,7 +465,7 @@ _0806C0D2:
bne _0806C0E0
bl _0806CD4C
_0806C0E0:
ldr r6, =gUnknown_02024084
ldr r6, =gBattleMons
ldr r5, =gUnknown_02024064
ldrb r0, [r5]
movs r4, 0x58
@ -591,7 +591,7 @@ _0806C1CA:
ldr r1, [sp, 0x38]
cmp r1, 0x4
beq _0806C202
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
movs r0, 0x58
ldr r3, [sp, 0x38]
adds r2, r3, 0
@ -692,7 +692,7 @@ _0806C2A8:
bne _0806C2B2
bl _0806CD4C
_0806C2B2:
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
movs r0, 0x58
ldr r2, [sp, 0x38]
muls r0, r2
@ -965,7 +965,7 @@ _0806C4FC:
cmp r3, 0x4
beq _0806C55C
ldr r2, =gUnknown_02024210
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
lsls r0, r3, 2
adds r0, r1
ldr r1, [r0]
@ -988,7 +988,7 @@ _0806C4FC:
.pool
_0806C55C:
ldr r3, =gUnknown_02024210
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r2, =gUnknown_02024064
ldrb r0, [r2]
eors r0, r4
@ -1123,7 +1123,7 @@ _0806C65E:
ldr r2, [sp, 0x38]
cmp r2, 0x4
beq _0806C6EC
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
movs r0, 0x58
muls r0, r2
adds r0, r1
@ -1286,7 +1286,7 @@ _0806C7CC:
ldr r2, [sp, 0x38]
cmp r2, 0x4
beq _0806C82E
ldr r4, =gUnknown_02024084
ldr r4, =gBattleMons
movs r0, 0x58
adds r3, r2, 0
muls r3, r0
@ -1306,7 +1306,7 @@ _0806C7CC:
adds r0, r1
ldrb r1, [r0, 0x18]
lsrs r1, 4
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r0, r5, 2
adds r0, r2
ldr r0, [r0]
@ -1437,7 +1437,7 @@ _0806C914:
ldr r2, [sp, 0x38]
cmp r2, 0x4
beq _0806C978
ldr r4, =gUnknown_02024084
ldr r4, =gBattleMons
movs r0, 0x58
adds r3, r2, 0
muls r3, r0
@ -1457,7 +1457,7 @@ _0806C914:
adds r0, r1
ldrb r1, [r0, 0x18]
lsrs r1, 4
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
ldr r5, [sp, 0x14]
lsls r0, r5, 2
adds r0, r2
@ -1996,7 +1996,7 @@ HealStatusConditions: @ 806CD6C
beq _0806CDBE
cmp r6, 0x4
beq _0806CDBE
ldr r0, =gUnknown_02024084
ldr r0, =gBattleMons
movs r1, 0x58
muls r1, r6
adds r0, 0x4C
@ -3607,7 +3607,7 @@ _0806D9E0:
_0806D9F0:
cmp r5, 0x3
bne _0806DA20
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x8
ands r0, r1
@ -3999,7 +3999,7 @@ _0806DCDA:
bl pokemon_getattr
cmp r0, 0
bne _0806DCDA
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
lsls r0, r5, 2
adds r0, r1
ldrb r1, [r0]
@ -4956,7 +4956,7 @@ _0806E41C:
thumb_func_start song_id_for_battle
song_id_for_battle: @ 806E42C
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x80
lsls r0, 5
@ -5110,7 +5110,7 @@ _0806E5E0:
lsls r0, 1
b _0806E646
_0806E5E6:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x003f0100
ands r0, r1
@ -5692,7 +5692,7 @@ sub_806EA68: @ 806EA68
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x00302008
ands r0, r1
@ -5871,7 +5871,7 @@ _0806EBEA:
thumb_func_start sub_806EBF8
sub_806EBF8: @ 806EBF8
push {r4,lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 15
@ -6000,7 +6000,7 @@ sub_806ECEC: @ 806ECEC
ands r0, r1
cmp r0, 0
beq _0806ED30
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1
@ -6209,7 +6209,7 @@ sub_806EEB4: @ 806EEB4
ands r0, r1
cmp r0, 0
beq _0806EEE8
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1
@ -6527,7 +6527,7 @@ sub_806F104: @ 806F104
ands r0, r1
cmp r0, 0
beq _0806F122
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x003f0100
ands r0, r1

View File

@ -8,7 +8,7 @@
thumb_func_start battle_wireless_setup_if_required_maybe
battle_wireless_setup_if_required_maybe: @ 8032654
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -78,8 +78,8 @@ _080326B8:
bl sub_80A3934
bl sub_806E414
movs r0, 0xF
bl sub_81308C8
ldr r0, =gUnknown_02022FEC
bl BattleAI_HandleItemUseBeforeAISetup
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x10
ands r0, r1
@ -117,7 +117,7 @@ _08032728:
thumb_func_start sub_8032768
sub_8032768: @ 8032768
push {r4,r5,lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -132,7 +132,7 @@ _08032784:
movs r0, 0x2
bl sub_8184DA4
_0803278A:
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
ldr r0, [r4]
movs r1, 0x80
lsls r1, 17
@ -153,7 +153,7 @@ _080327B0:
bl b_setup_bx
_080327B4:
bl sub_8033050
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -214,7 +214,7 @@ b_setup_bx: @ 8032824
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r3, [r0]
movs r5, 0x80
lsls r5, 15
@ -327,7 +327,7 @@ _08032934:
ldr r2, =gUnknown_0202406C
movs r7, 0x2
strb r7, [r2]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r3, [r0]
movs r0, 0x80
lsls r0, 17
@ -739,7 +739,7 @@ b_setup_bx_link: @ 8032CC0
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
ldr r1, [r4]
movs r5, 0x1
adds r3, r1, 0
@ -1127,7 +1127,7 @@ sub_8033050: @ 8033050
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -1264,7 +1264,7 @@ _0803317A:
bge _08033184
b _08033074
_08033184:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 8
@ -1296,7 +1296,7 @@ dp01_prepare_buffer: @ 80331B8
adds r5, r3, 0
lsls r2, 16
lsrs r2, 16
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -1690,7 +1690,7 @@ _080334F6:
b _08033640
.pool
_08033504:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x80
lsls r0, 1
@ -1861,7 +1861,7 @@ sub_8033648: @ 8033648
ldrb r0, [r0]
cmp r0, 0
beq _08033738
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x20
ands r0, r1
@ -1877,7 +1877,7 @@ _08033680:
bl sub_800A550
lsls r0, 24
lsrs r0, 24
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r1, r4, 2
adds r1, r2
ldr r1, [r1]
@ -2041,7 +2041,7 @@ _080337CC:
b _0803388A
_080337D2:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
lsls r0, r4, 2
adds r0, r1
ldr r1, [r2]
@ -2058,7 +2058,7 @@ _080337D2:
bl memcpy
adds r0, r4, 0
bl sub_803F850
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x4
ands r0, r1
@ -2105,7 +2105,7 @@ _0803385C:
_08033874:
ldrb r2, [r3, 0x8]
ldr r3, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
lsls r0, r4, 2
adds r0, r1
lsls r2, 2
@ -2636,7 +2636,7 @@ dp01_build_cmdbuf_x10_TODO: @ 8033BE4
ldr r0, =gUnknown_02022F78
mov r8, r0
adds r2, 0x10
ldr r0, =gUnknown_02024084
ldr r0, =gBattleMons
adds r4, r0, 0
adds r4, 0x20
_08033C6A:
@ -2735,7 +2735,7 @@ dp01_build_cmdbuf_x11_TODO: @ 8033CFC
mov r8, r7
mov r4, r9
adds r4, 0x10
ldr r0, =gUnknown_02024084
ldr r0, =gBattleMons
adds r2, r0, 0
adds r2, 0x20
_08033D5E:

View File

@ -376,7 +376,7 @@ _080A966C:
bl sub_805E7DC
b _080A96F4
_080A9676:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r2, 0x80
ands r1, r2
@ -599,7 +599,7 @@ _080A9786:
b _080A9A50
.pool
_080A986C:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r2, 0x80
ands r1, r2
@ -878,7 +878,7 @@ sub_80A9ADC: @ 80A9ADC
bcc _080A9AEC
b _080A9C5E
_080A9AEC:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r2, 0x80
ands r1, r2
@ -931,7 +931,7 @@ _080A9B24:
b _080A9BB8
.pool
_080A9B6C:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
ands r0, r1
@ -1011,7 +1011,7 @@ _080A9BFC:
b _080A9C5E
.pool
_080A9C34:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
ands r0, r1

View File

@ -11559,7 +11559,7 @@ _0813B52E:
sub_813B534: @ 813B534
push {lr}
ldr r2, =gUnknown_0203AB70
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, [r1]
str r0, [r2]
movs r0, 0
@ -11829,7 +11829,7 @@ _0813B7A8:
bne _0813B7B4
bl sub_800AC34
_0813B7B4:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, =gUnknown_0203AB70
ldr r1, [r1]
str r1, [r0]

File diff suppressed because it is too large Load Diff

View File

@ -2042,7 +2042,7 @@ _08073382:
bne _080733D0
b _080735A8
_080733D0:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r2, [r0]
movs r0, 0x80
ands r2, r0
@ -2127,7 +2127,7 @@ _08073468:
_080734B0:
cmp r4, 0x1
bne _0807355C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r2, [r0]
movs r0, 0x80
ands r2, r0
@ -2210,7 +2210,7 @@ _0807355C:
adds r1, r4
movs r2, 0x5
bl healthbar_draw_field_maybe
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
ands r0, r1
@ -2538,7 +2538,7 @@ _0807382C:
beq _0807383A
b _080739E8
_0807383A:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r2, 0x40
ands r1, r2
@ -2683,7 +2683,7 @@ _08073958:
adds r1, 0x3
b _080739D0
_08073970:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, [r1]
movs r1, 0x80
lsls r1, 11
@ -2696,7 +2696,7 @@ _08073970:
lsls r2, 2
adds r0, r2
ldrb r1, [r0]
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r0, r7, 2
adds r0, r2
ldr r0, [r0]
@ -2743,7 +2743,7 @@ _080739DE:
ble _0807390A
b _08073B9A
_080739E8:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
ldr r2, =0x00008040
ands r1, r2
@ -2889,7 +2889,7 @@ _08073B08:
adds r1, 0x3
b _08073B84
_08073B20:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, [r1]
movs r1, 0x80
lsls r1, 11
@ -2902,7 +2902,7 @@ _08073B20:
adds r0, r3
ldrb r1, [r0]
lsls r0, r7, 2
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
adds r0, r2
ldr r0, [r0]
ands r1, r0
@ -3882,7 +3882,7 @@ sub_8074310: @ 8074310
lsrs r2, r0, 24
lsls r1, 24
lsrs r7, r1, 24
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x80
lsls r0, 2
@ -7155,7 +7155,7 @@ _08075E00:
ands r0, r1
cmp r0, 0
beq _08075E56
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x42
ands r0, r1

View File

@ -43,7 +43,7 @@ _080A5CB0:
bl battle_get_per_side_status
lsls r0, 24
lsrs r0, 22
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r1, [r1]
movs r2, 0x1
ands r1, r2
@ -59,7 +59,7 @@ _080A5CD8:
bl battle_get_per_side_status
lsls r0, 24
lsrs r0, 22
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r1, [r1]
movs r2, 0x1
ands r1, r2
@ -480,7 +480,7 @@ _080A605C:
ldr r3, =gUnknown_08525F58
lsls r0, 24
lsrs r0, 22
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r1, [r1]
movs r2, 0x1
ands r1, r2
@ -1930,7 +1930,7 @@ _080A6B1A:
thumb_func_start battle_type_is_double
battle_type_is_double: @ 80A6B20
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x1
ands r0, r1

View File

@ -23812,7 +23812,7 @@ sub_80D352C: @ 80D352C
lsls r0, 24
lsrs r0, 24
lsls r1, 24
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsrs r1, 22
adds r1, r2
ldr r2, [r1]
@ -23841,7 +23841,7 @@ sub_80D355C: @ 80D355C
adds r2, r0
lsls r2, 3
adds r2, r3
ldr r0, =gUnknown_0832A328
ldr r0, =gBitTable
lsrs r1, 22
adds r1, r0
ldr r0, [r1]
@ -23863,7 +23863,7 @@ sub_80D3584: @ 80D3584
adds r2, r0
lsls r2, 3
adds r2, r3
ldr r0, =gUnknown_0832A328
ldr r0, =gBitTable
lsrs r1, 22
adds r1, r0
ldr r0, [r1]

View File

@ -1025,7 +1025,7 @@ sub_815936C: @ 815936C
bx_exec_buffer_A_ch0_tbl6: @ 8159388
push {lr}
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
lsls r0, r3, 2
@ -1439,7 +1439,7 @@ dp01_tbl6_exec_completed: @ 8159704
adds r0, r1
ldr r1, =bx_exec_buffer_A_ch0_tbl6
str r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -1462,7 +1462,7 @@ dp01_tbl6_exec_completed: @ 8159704
.pool
_08159758:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
@ -2381,7 +2381,7 @@ sub_8159E90: @ 8159E90
movs r0, 0x3
bl sub_80A2390
bl dp01_tbl6_exec_completed
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x6
ands r0, r1
@ -19377,7 +19377,7 @@ _08162B08:
ldr r0, =0x0000018f
cmp r4, r0
bhi _08162B64
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19407,7 +19407,7 @@ _08162B38:
b _08162BC8
.pool
_08162B64:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19515,7 +19515,7 @@ _08162C60:
ldr r0, =0x0000018f
cmp r4, r0
bhi _08162CBC
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19547,7 +19547,7 @@ _08162C90:
b _08162D1E
.pool
_08162CBC:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19629,7 +19629,7 @@ _08162D78:
ldr r0, =0x0000018f
cmp r4, r0
bhi _08162DC0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19654,7 +19654,7 @@ _08162DA0:
b _08162E0A
.pool
_08162DC0:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19772,7 +19772,7 @@ _08162EB4:
ldr r0, =0x0000018f
cmp r5, r0
bhi _08162F00
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -19800,7 +19800,7 @@ _08162ED8:
b _08162F62
.pool
_08162F00:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -21240,7 +21240,7 @@ _08163AF0:
.4byte _08163DF4
.4byte _08163DC8
_08163B1C:
ldr r5, =gUnknown_02022FEC
ldr r5, =gBattleTypeFlags
movs r0, 0x84
lsls r0, 1
str r0, [r5]
@ -21360,7 +21360,7 @@ _08163C18:
adds r5, 0x1
cmp r5, 0x2
ble _08163C18
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x00000808
str r0, [r1]
ldr r1, =gUnknown_02038BCA
@ -21375,7 +21375,7 @@ _08163C18:
b _08163E10
.pool
_08163C70:
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
ldr r0, =0x00010008
str r0, [r4]
ldr r0, =0x000040ce
@ -21405,7 +21405,7 @@ _08163C9A:
b _08163E10
.pool
_08163CC4:
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
ldr r0, =0x00020008
str r0, [r4]
ldr r0, =0x000040ce
@ -21444,7 +21444,7 @@ _08163D12:
b _08163E10
.pool
_08163D28:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x00040008
str r0, [r1]
ldr r0, =gSaveBlock2Ptr
@ -21473,7 +21473,7 @@ _08163D5E:
b _08163E10
.pool
_08163D74:
ldr r4, =gUnknown_02022FEC
ldr r4, =gBattleTypeFlags
ldr r0, =0x00080008
str r0, [r4]
ldr r0, =0x000040ce
@ -21496,7 +21496,7 @@ _08163D8E:
b _08163E10
.pool
_08163DB4:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
movs r0, 0x84
lsls r0, 1
str r0, [r1]
@ -21505,7 +21505,7 @@ _08163DB4:
b _08163E00
.pool
_08163DC8:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x00200008
str r0, [r1]
movs r0, 0x3
@ -21519,7 +21519,7 @@ _08163DC8:
b _08163E10
.pool
_08163DF4:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x00008109
str r0, [r1]
movs r0, 0x1
@ -21539,7 +21539,7 @@ _08163E10:
b _08163E68
.pool
_08163E2C:
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x00408049
str r0, [r1]
ldr r5, =0x00000c03
@ -25030,7 +25030,7 @@ _08165BB8:
ldr r0, =0x0000018f
cmp r2, r0
bhi _08165BFC
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -25053,7 +25053,7 @@ _08165BDC:
b _08165C28
.pool
_08165BFC:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -25751,7 +25751,7 @@ _08166182:
thumb_func_start sub_8166188
sub_8166188: @ 8166188
push {r4-r7,lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1
@ -29602,7 +29602,7 @@ bx_goto_buffer_A_ch0_tbl3: @ 81683B8
bx_exec_buffer_A_ch0_tbl2: @ 81683F4
push {lr}
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
lsls r0, r3, 2
@ -29989,7 +29989,7 @@ _081686D2:
lsls r0, 24
cmp r0, 0
beq _0816877A
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -30425,7 +30425,7 @@ dp01_tbl5_exec_completed: @ 8168AF8
adds r0, r1
ldr r1, =bx_exec_buffer_A_ch0_tbl2
str r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -30448,7 +30448,7 @@ dp01_tbl5_exec_completed: @ 8168AF8
.pool
_08168B4C:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
@ -34319,7 +34319,7 @@ sub_816AD94: @ 816AD94
movs r0, 0x3
bl sub_80A2390
bl dp01_tbl5_exec_completed
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x6
ands r0, r1

View File

@ -16,7 +16,7 @@ sub_817C95C: @ 817C95C
lsls r0, 16
lsrs r0, 16
str r0, [sp]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -525,7 +525,7 @@ _0817D070:
movs r2, 0x2
movs r3, 0
bl sub_817E684
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -542,7 +542,7 @@ _0817D098:
movs r2, 0x1
movs r3, 0
bl sub_817E684
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -2543,7 +2543,7 @@ sub_817E0FC: @ 817E0FC
lsls r1, 16
lsrs r1, 16
str r1, [sp]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -2801,7 +2801,7 @@ sub_817E32C: @ 817E32C
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -2961,7 +2961,7 @@ _0817E46A:
adds r6, 0x1
cmp r6, 0x5
ble _0817E434
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -3149,7 +3149,7 @@ _0817E5C8:
beq _0817E670
cmp r4, 0
beq _0817E670
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -4261,7 +4261,7 @@ sub_817EECC: @ 817EECC
mov r5, r8
push {r5-r7}
sub sp, 0x28
ldr r7, =gUnknown_02022FEC
ldr r7, =gBattleTypeFlags
ldr r0, [r7]
ldr r1, =0x02000003
ands r0, r1
@ -4278,7 +4278,7 @@ _0817EEE6:
bne _0817EEF8
b _0817F1FA
_0817EEF8:
ldr r5, =gUnknown_02024084
ldr r5, =gBattleMons
ldrb r4, [r4]
movs r1, 0x58
adds r6, r4, 0
@ -4395,7 +4395,7 @@ _0817EFC2:
movs r2, 0x58
muls r0, r2
adds r1, r0
ldr r0, =gUnknown_02024084
ldr r0, =gBattleMons
adds r0, 0xC
adds r1, r0
ldrh r0, [r1]
@ -4424,7 +4424,7 @@ _0817EFC2:
ldrb r0, [r2]
movs r4, 0x58
muls r0, r4
ldr r6, =gUnknown_02024084
ldr r6, =gBattleMons
adds r0, r6
mov r2, r9
ldrb r1, [r2]
@ -4694,7 +4694,7 @@ _0817F252:
_0817F270:
cmp r2, 0x95
bne _0817F294
ldr r2, =gUnknown_02024084
ldr r2, =gBattleMons
ldr r0, =gUnknown_0202420B
ldrb r1, [r0]
movs r0, 0x58
@ -4725,7 +4725,7 @@ _0817F2A0:
thumb_func_start sub_817F2A8
sub_817F2A8: @ 817F2A8
push {r4,r5,lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1

View File

@ -44,7 +44,7 @@ _08184DD0:
mov r3, r12
cmp r3, 0x1
bne _08184E1C
ldr r5, =gUnknown_02022FEC
ldr r5, =gBattleTypeFlags
movs r3, 0xFF
movs r1, 0xA6
lsls r1, 2
@ -116,7 +116,7 @@ _08184EA0:
ldr r1, [r1]
str r1, [r0]
_08184EAC:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r5, [r0]
movs r0, 0x2
ands r5, r0
@ -489,7 +489,7 @@ sub_81851A8: @ 81851A8
movs r1, 0x2
mov r0, sp
strb r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ands r0, r1
cmp r0, 0
@ -510,7 +510,7 @@ _081851DA:
lsrs r0, 24
cmp r5, r0
blt _081851D0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x4
ands r0, r1
@ -1539,7 +1539,7 @@ sub_8185AB0: @ 8185AB0
ldr r1, =gUnknown_0202433A
movs r0, 0
strb r0, [r1]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
movs r1, 0
str r1, [r0]
ldr r0, =gUnknown_02038BCA
@ -1707,7 +1707,7 @@ _08185C2A:
adds r0, r7, r3
ldr r0, [r0]
str r0, [r1]
ldr r2, =gUnknown_02022FEC
ldr r2, =gBattleTypeFlags
ldr r1, =0x000004ec
adds r0, r7, r1
ldr r0, [r0]
@ -2102,7 +2102,7 @@ sub_8185FD0: @ 8185FD0
lsrs r0, 24
cmp r0, 0x1
beq _0818601C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1
@ -2150,7 +2150,7 @@ sub_818603C: @ 818603C
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x24]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x02000002
ands r0, r1
@ -2297,7 +2297,7 @@ _08186142:
movs r1, 0x58
mov r0, r10
muls r0, r1
ldr r2, =gUnknown_02024084
ldr r2, =gBattleMons
adds r0, r2
adds r6, r0, 0
adds r6, 0x3B
@ -2316,7 +2316,7 @@ _0818617E:
cmp r5, 0x3
ble _0818617E
movs r5, 0
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
mov r9, r1
movs r2, 0x58
mov r7, r10
@ -2361,7 +2361,7 @@ _081861A6:
adds r0, r2
ldrb r1, [r0, 0x18]
lsrs r1, 4
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsls r0, r5, 2
adds r0, r2
ldr r0, [r0]
@ -2422,7 +2422,7 @@ _0818622C:
ands r0, r1
strb r0, [r2, 0x18]
movs r5, 0
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
adds r4, r1
adds r4, 0x3B
ldr r0, =gUnknown_020242BC
@ -2612,7 +2612,7 @@ _081863CA:
mov r1, r10
muls r1, r4
adds r0, r1
ldr r1, =gUnknown_02024084
ldr r1, =gBattleMons
adds r1, 0xC
adds r0, r1
ldrh r0, [r0]
@ -2768,7 +2768,7 @@ sub_81864EC: @ 81864EC
sub_8186508: @ 8186508
push {lr}
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
lsls r0, r3, 2
@ -2947,7 +2947,7 @@ sub_8186678: @ 8186678
lsls r0, 24
cmp r0, 0
beq _081866F8
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -3249,7 +3249,7 @@ _081868DE:
lsls r0, 24
cmp r0, 0
beq _08186964
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -3357,7 +3357,7 @@ _081869AE:
ands r0, r1
cmp r0, 0
bne _08186A4C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x42
ands r0, r1
@ -3487,7 +3487,7 @@ _08186B26:
lsls r0, 24
cmp r0, 0
beq _08186B8A
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -4208,7 +4208,7 @@ sub_81871AC: @ 81871AC
adds r0, r1
ldr r1, =sub_8186508
str r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -4231,7 +4231,7 @@ sub_81871AC: @ 81871AC
.pool
_08187200:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
@ -6754,7 +6754,7 @@ sub_818888C: @ 818888C
mov r7, r9
mov r6, r8
push {r6,r7}
ldr r5, =gUnknown_02022FEC
ldr r5, =gBattleTypeFlags
ldr r0, [r5]
movs r1, 0x40
ands r0, r1
@ -7513,7 +7513,7 @@ sub_8188F14: @ 8188F14
thumb_func_start sub_8188F20
sub_8188F20: @ 8188F20
push {r4,r5,lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 10
@ -8263,7 +8263,7 @@ c3_0803D564: @ 8189548
lsls r0, 24
cmp r0, 0
beq _08189582
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -8729,7 +8729,7 @@ sub_818994C: @ 818994C
sub_8189968: @ 8189968
push {lr}
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
lsls r0, r3, 2
@ -8889,7 +8889,7 @@ _08189ABA:
lsls r0, 24
cmp r0, 0
beq _08189B0C
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -9075,7 +9075,7 @@ _08189C60:
lsls r0, 24
cmp r0, 0
beq _08189CB0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -9266,7 +9266,7 @@ _08189DBE:
lsls r0, 24
cmp r0, 0
beq _08189E54
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -9381,7 +9381,7 @@ _08189EA2:
ands r0, r1
cmp r0, 0
bne _08189F44
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x42
ands r0, r1
@ -9452,7 +9452,7 @@ _08189F62:
lsls r0, 24
cmp r0, 0
beq _08189FC8
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -10056,7 +10056,7 @@ sub_818A514: @ 818A514
adds r0, r1
ldr r1, =sub_8189968
str r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -10079,7 +10079,7 @@ sub_818A514: @ 818A514
.pool
_0818A568:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
@ -12676,7 +12676,7 @@ sub_818BD04: @ 818BD04
mov r7, r9
mov r6, r8
push {r6,r7}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x80
lsls r0, 18
@ -12707,7 +12707,7 @@ _0818BD48:
_0818BD4A:
ldrb r4, [r0, 0x13]
_0818BD4C:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r2, 0x40
ands r1, r2
@ -13573,7 +13573,7 @@ _0818C4C6:
thumb_func_start sub_818C4D8
sub_818C4D8: @ 818C4D8
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 10
@ -13617,7 +13617,7 @@ sub_818C52C: @ 818C52C
thumb_func_start sub_818C538
sub_818C538: @ 818C538
push {r4,r5,lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 10
@ -14318,7 +14318,7 @@ sub_818CA64: @ 818CA64
bl AllocObjectPalette
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 18
@ -14451,7 +14451,7 @@ _0818CC50:
lsls r0, 24
cmp r0, 0
beq _0818CC70
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -19082,7 +19082,7 @@ _0818F37C:
strh r7, [r2]
movs r3, 0
mov r10, r3
ldr r6, =gUnknown_0832A328
ldr r6, =gBitTable
ldr r5, =gBaseStats
_0818F38A:
ldr r0, =gSaveBlock2Ptr
@ -19287,7 +19287,7 @@ _0818F4BC:
adds r1, r3
ldrb r0, [r1, 0x6]
lsls r0, 2
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
adds r0, r2
ldr r0, [r0]
orrs r7, r0
@ -20460,7 +20460,7 @@ _0818FECE:
cmp r1, 0
beq _0818FFAA
movs r3, 0
ldr r4, =gUnknown_0832A328
ldr r4, =gBitTable
_0818FEF0:
str r3, [sp, 0x14]
bl Random
@ -20546,7 +20546,7 @@ _0818FF84:
adds r3, 0x1
cmp r3, 0x1
ble _0818FF26
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
mov r1, sp
movs r3, 0x1
_0818FF96:
@ -30145,7 +30145,7 @@ _081951AA:
adds r1, r3
ldrb r0, [r1, 0x6]
lsls r0, 2
ldr r4, =gUnknown_0832A328
ldr r4, =gBitTable
adds r0, r4
ldr r0, [r0]
orrs r7, r0
@ -58095,7 +58095,7 @@ _081A37B8:
ldr r0, =0x0000018f
cmp r3, r0
bhi _081A37EC
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -58111,7 +58111,7 @@ _081A37B8:
b _081A38C4
.pool
_081A37EC:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -58163,7 +58163,7 @@ _081A3868:
ldr r0, =0x0000018f
cmp r3, r0
bhi _081A38A8
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -58185,7 +58185,7 @@ _081A3890:
b _081A38C4
.pool
_081A38A8:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -58739,7 +58739,7 @@ _081A3D94:
thumb_func_start sub_81A3DA0
sub_81A3DA0: @ 81A3DA0
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, =gUnknown_020375E2
ldrh r1, [r1]
ldr r2, [r0]
@ -60512,7 +60512,7 @@ _081A4C84:
thumb_func_start sub_81A4CB0
sub_81A4CB0: @ 81A4CB0
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -60548,7 +60548,7 @@ _081A4CDA:
thumb_func_start sub_81A4D00
sub_81A4D00: @ 81A4D00
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -60585,7 +60585,7 @@ _081A4D2A:
sub_81A4D50: @ 81A4D50
push {r4,lr}
adds r4, r0, 0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -61114,7 +61114,7 @@ sub_81A51A8: @ 81A51A8
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
@ -61547,7 +61547,7 @@ _081A55C4:
ldrsb r1, [r0, r1]
b _081A5612
_081A55D8:
ldr r3, =gUnknown_02024084
ldr r3, =gBattleMons
mov r9, r3
movs r5, 0x58
adds r0, r7, 0
@ -61668,7 +61668,7 @@ sub_81A56B4: @ 81A56B4
strb r0, [r1, 0x1]
strb r0, [r3]
strb r0, [r3, 0x1]
ldr r0, =gUnknown_02024084
ldr r0, =gBattleMons
ldrh r1, [r0, 0x28]
strh r1, [r2]
adds r0, 0x80
@ -61720,7 +61720,7 @@ sub_81A5718: @ 81A5718
ldr r0, =0x000002a2
adds r4, r2, r0
ldrb r2, [r4]
ldr r0, =gUnknown_0832A328
ldr r0, =gBitTable
lsls r1, r3, 2
adds r1, r0
ldr r1, [r1]
@ -61885,7 +61885,7 @@ sub_81A586C: @ 81A586C
adds r3, r1
lsls r2, r0, 1
adds r2, r3
ldr r5, =gUnknown_02024084
ldr r5, =gBattleMons
movs r4, 0x58
adds r1, r0, 0
muls r1, r4
@ -69301,7 +69301,7 @@ _081A9572:
ldr r1, =0x00000e2a
adds r0, r1
ldrb r2, [r0]
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
movs r6, 0x7
_081A958E:
ldr r0, [r1]
@ -69959,7 +69959,7 @@ GetBattlePyramidTrainerFlag: @ 81A9AC4
ldr r2, [r1]
ldr r1, =0x00000e2a
adds r2, r1
ldr r4, =gUnknown_0832A328
ldr r4, =gBitTable
ldr r3, =gUnknown_02037350
lsls r1, r0, 3
adds r1, r0
@ -69984,7 +69984,7 @@ sub_81A9B04: @ 81A9B04
ldr r0, =gUnknown_02038BCA
ldrh r0, [r0]
bl sub_81A9B44
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 8
@ -70023,7 +70023,7 @@ sub_81A9B44: @ 81A9B44
mov r9, r7
ldr r0, =0x00000cb4
mov r8, r0
ldr r4, =gUnknown_0832A328
ldr r4, =gBitTable
_081A9B68:
mov r1, r9
ldr r2, [r1]
@ -71089,7 +71089,7 @@ _081AA414:
cmp r0, 0
beq _081AA4B6
_081AA42E:
ldr r0, =gUnknown_0832A328
ldr r0, =gBitTable
mov r12, r0
ldr r6, =gSaveBlock2Ptr
ldr r7, =0x00000e28
@ -84210,7 +84210,7 @@ _081B11AA:
_081B11B4:
cmp r2, 0x2
bhi _081B11F6
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 11
@ -84283,7 +84283,7 @@ sub_81B120C: @ 81B120C
thumb_func_start sub_81B1250
sub_81B1250: @ 81B1250
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x49
ands r0, r1
@ -98262,7 +98262,7 @@ sub_81B8A2C: @ 81B8A2C
b _081B8A76
.pool
_081B8A5C:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 11

View File

@ -75,7 +75,7 @@ sub_81BADF4: @ 81BADF4
bx_exec_buffer_A_ch0_tbl3: @ 81BAE10
push {lr}
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldr r0, =gUnknown_02024064
ldrb r3, [r0]
lsls r0, r3, 2
@ -224,7 +224,7 @@ sub_81BAF48: @ 81BAF48
lsls r0, 24
cmp r0, 0
beq _081BAFA0
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -400,7 +400,7 @@ _081BB07A:
lsls r0, 24
cmp r0, 0
beq _081BB134
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -1601,7 +1601,7 @@ dp01_tbl3_exec_completed: @ 81BBB8C
adds r0, r1
ldr r1, =bx_exec_buffer_A_ch0_tbl3
str r1, [r0]
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
@ -1624,7 +1624,7 @@ dp01_tbl3_exec_completed: @ 81BBB8C
.pool
_081BBBE0:
ldr r2, =gUnknown_02024068
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r1
@ -5060,7 +5060,7 @@ sub_81BDAC8: @ 81BDAC8
ldr r0, =gUnknown_02023068
adds r4, r0
movs r0, 0xF
bl sub_8130950
bl BattleAI_SetupAIData
bl sub_8130BA4
lsls r0, 24
lsrs r5, r0, 24
@ -5097,7 +5097,7 @@ _081BDB02:
strb r0, [r4]
ldr r0, =gUnknown_02024210
ldrb r1, [r0]
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
ldrb r0, [r4]
lsls r0, 2
adds r0, r2
@ -6001,7 +6001,7 @@ _081BE2F4:
lsls r0, 24
cmp r0, 0
beq _081BE314
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1
@ -15147,7 +15147,7 @@ _081C32FE:
thumb_func_start sub_81C3304
sub_81C3304: @ 81C3304
push {lr}
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 15
@ -52825,7 +52825,7 @@ GetTrainerHillTrainerFlag: @ 81D619C
movs r2, 0xEE
lsls r2, 4
adds r1, r2
ldr r2, =gUnknown_0832A328
ldr r2, =gBitTable
lsrs r0, 22
adds r0, r2
ldr r0, [r0]
@ -52849,7 +52849,7 @@ sub_81D61E8: @ 81D61E8
ldr r0, =gUnknown_02038BCA
mov r8, r0
ldr r6, =gSaveBlock2Ptr
ldr r1, =gUnknown_0832A328
ldr r1, =gBitTable
mov r12, r1
adds r5, r6, 0
_081D6204:
@ -52882,7 +52882,7 @@ _081D6240:
cmp r3, 0x1
bls _081D6204
_081D624A:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 8
@ -52891,7 +52891,7 @@ _081D624A:
beq _081D62A2
movs r3, 0
ldr r5, =gUnknown_02038BCC
ldr r0, =gUnknown_0832A328
ldr r0, =gBitTable
mov r8, r0
_081D6260:
ldr r2, [r6]

View File

@ -2899,7 +2899,7 @@ sub_80EA2E4: @ 80EA2E4
lsls r2, 3
adds r0, r2, 0
strh r0, [r1]
ldr r1, =gUnknown_02022FEC
ldr r1, =gBattleTypeFlags
ldr r0, =0x08000008
str r0, [r1]
pop {r0}

View File

@ -692,7 +692,7 @@ sub_80A3344: @ 80A3344
bl sub_80A344C
b _080A3394
_080A336E:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x40
ands r0, r1

View File

@ -2499,7 +2499,7 @@ _08005834:
b _08005B56
.pool
_0800584C:
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17

View File

@ -1511,7 +1511,7 @@ sub_80ECB00: @ 80ECB00
ldr r1, =gSaveBlock2Ptr
ldr r1, [r1]
bl StringCopy
ldr r0, =gUnknown_02022FEC
ldr r0, =gBattleTypeFlags
ldr r1, [r0]
movs r0, 0x40
ands r0, r1

View File

@ -1535,7 +1535,7 @@ gUnknown_08329F40:: @ 8329F40
gUnknown_0832A1C0:: @ 832A1C0
.incbin "baserom.gba", 0x32a1c0, 0x168
gUnknown_0832A328:: @ 832A328
gBitTable:: @ 832A328
.incbin "baserom.gba", 0x32a328, 0x80
gUnknown_0832A3A8:: @ 832A3A8

View File

@ -149,6 +149,7 @@ SECTIONS {
asm/decoration.o(.text);
asm/slot_machine.o(.text);
asm/contest_painting.o(.text);
src/battle_ai.o(.text);
asm/battle_ai.o(.text);
asm/trader.o(.text);
asm/starter_choose.o(.text);

789
src/battle_ai.c Normal file
View File

@ -0,0 +1,789 @@
#include "global.h"
#define AIScriptRead32(ptr) ((ptr)[0] | (ptr)[1] << 8 | (ptr)[2] << 16 | (ptr)[3] << 24)
#define AIScriptRead16(ptr) ((ptr)[0] | (ptr)[1] << 8)
#define AIScriptRead8(ptr) ((ptr)[0])
#define AIScriptReadPtr(ptr) (u8*) AIScriptRead32(ptr)
//Copied from pokeruby -- hopefully the same
struct Trainer
{
/*0x00*/ u8 partyFlags;
/*0x01*/ u8 trainerClass;
/*0x02*/ u8 encounterMusic:7;
/*0x02*/ u8 gender:1;
/*0x03*/ u8 trainerPic;
/*0x04*/ u8 trainerName[12];
/*0x10*/ u16 items[4];
/*0x18*/ bool8 doubleBattle;
/*0x1C*/ u32 aiFlags;
/*0x20*/ u8 partySize;
/*0x24*/ void *party;
};
#define POKEMON_NAME_LENGTH 10
struct BattlePokemon
{
/* 0x00 */ u16 species;
/* 0x02 */ u16 attack;
/* 0x04 */ u16 defense;
/* 0x06 */ u16 speed;
/* 0x08 */ u16 spAttack;
/* 0x0A */ u16 spDefense;
/* 0x0C */ u16 moves[4];
/* 0x14 */ u32 hpIV:5;
/* 0x14 */ u32 attackIV:5;
/* 0x15 */ u32 defenseIV:5;
/* 0x15 */ u32 speedIV:5;
/* 0x16 */ u32 spAttackIV:5;
/* 0x17 */ u32 spDefenseIV:5;
/* 0x17 */ u32 isEgg:1;
/* 0x17 */ u32 altAbility:1;
/* 0x18 */ s8 statStages[8];
/* 0x20 */ u8 ability;
/* 0x21 */ u8 type1;
/* 0x22 */ u8 type2;
/* 0x23 */ u8 unknown;
/* 0x24 */ u8 pp[4];
/* 0x28 */ u16 hp;
/* 0x2A */ u8 level;
/* 0x2B */ u8 friendship;
/* 0x2C */ u16 maxHP;
/* 0x2E */ u16 item;
/* 0x30 */ u8 nickname[POKEMON_NAME_LENGTH + 1];
/* 0x3B */ u8 ppBonuses;
/* 0x3C */ u8 otName[8];
/* 0x44 */ u32 experience;
/* 0x48 */ u32 personality;
/* 0x4C */ u32 status1;
/* 0x50 */ u32 status2;
/* 0x54 */ u32 otId;
};
//size should be 0x1C
struct UnknownStruct3
{
u8 unk0;
u8 unk1;
u16 unk2;
s8 unk4[4];
u8 filler8[4];
u32 unkC;
u8 unk10;
u8 unk11;
u8 filler12[6];
u8 unk18[4];
};
//size should be 0x54
struct UnknownStruct2
{
u16 unk0[2][8];
u8 filler20[0x20];
u8 unk40[4];
u8 unk44[4];
u16 unk48[4];
u8 unk50;
};
struct UnknownStruct4
{
u8 filler0[0x20];
u8 unk20;
};
struct UnknownStruct1
{
u8 unk0;
u8 filler1[0x13];
struct UnknownStruct3 *unk14;
struct UnknownStruct2 *unk18;
struct UnknownStruct4 *unk1C;
};
extern u32 gBattleTypeFlags;
extern u8 gUnknown_02024064;
extern struct BattlePokemon gBattleMons[];
extern u16 gUnknown_020241EA;
extern u8 gUnknown_0202420C;
extern u8 gUnknown_02024210;
extern u16 gUnknown_02024248[];
extern u8 *gUnknown_0202449C;
extern struct UnknownStruct1 *gUnknown_020244A8;
extern u16 gUnknown_02038BCA;
extern u16 gUnknown_02038BCC;
extern const u8 *gAIScriptPtr;
extern u8 gUnknown_0203AB3C;
extern struct Trainer gTrainers[];
extern const u32 gBitTable[];
extern const u8 *const gUnknown_082DBEF8[];
typedef void (*BattleAICmdFunc)(void);
extern const BattleAICmdFunc gUnknown_085B083C[];
extern u8 sub_803FECC();
extern u16 Random();
extern u32 battle_side_get_owner();
extern u32 sub_8186438();
extern u32 sub_81A6FB4();
void BattleAI_SetupAIData(u8 a);
u8 sub_8130BDC(void);
u8 sub_8130CF4(void);
void sub_8131074(void);
void BattleAI_DoAIProcessing(void);
void BattleAI_HandleItemUseBeforeAISetup(u8 a)
{
s32 i;
u8 *data = (u8 *)gUnknown_020244A8->unk18;
for (i = 0; (u32)i < 0x54; i++)
data[i] = 0;
if ((gBattleTypeFlags & 0x0A7F098A) == 8)
{
for (i = 0; i < 4; i++)
{
if (gTrainers[gUnknown_02038BCA].items[i] != 0)
{
gUnknown_020244A8->unk18->unk48[gUnknown_020244A8->unk18->unk50] = gTrainers[gUnknown_02038BCA].items[i];
gUnknown_020244A8->unk18->unk50++;
}
}
}
BattleAI_SetupAIData(a);
}
void BattleAI_SetupAIData(u8 a)
{
s32 i;
u8 *data = (u8 *)gUnknown_020244A8->unk14;
u8 r6;
for (i = 0; (u32)i < 0x1C; i++)
data[i] = 0;
for (i = 0; i < 4; i++)
{
if (a & 1)
gUnknown_020244A8->unk14->unk4[i] = 100;
else
gUnknown_020244A8->unk14->unk4[i] = 0;
a >>= 1;
}
r6 = sub_803FECC(gUnknown_02024064, 0, 0xFF);
for (i = 0; i < 4; i++)
{
if (gBitTable[i] & r6)
gUnknown_020244A8->unk14->unk4[i] = 0;
gUnknown_020244A8->unk14->unk18[i] = 100 - (Random() % 16);
}
gUnknown_020244A8->unk1C->unk20 = 0;
gUnknown_0203AB3C = gUnknown_02024064;
if (gBattleTypeFlags & 1)
{
gUnknown_0202420C = (Random() & 2) + (battle_side_get_owner(gUnknown_02024064) ^ 1);
if (gUnknown_02024210 & gBitTable[gUnknown_0202420C])
gUnknown_0202420C ^= 2;
}
else
{
//_08130A60
gUnknown_0202420C = gUnknown_0203AB3C ^ 1;
}
//_08130A68
if (gBattleTypeFlags & 0x1000000)
gUnknown_020244A8->unk14->unkC = sub_8186438();
else if (gBattleTypeFlags & 0x80)
gUnknown_020244A8->unk14->unkC = 0x40000000;
else if (gBattleTypeFlags & 0x400)
gUnknown_020244A8->unk14->unkC = 0x20000000;
else if (gBattleTypeFlags & 0x10)
gUnknown_020244A8->unk14->unkC = 0x80000000;
else if (gBattleTypeFlags & 0x80000)
gUnknown_020244A8->unk14->unkC = sub_81A6FB4();
else if (gBattleTypeFlags & 0x0C3F0900)
gUnknown_020244A8->unk14->unkC = 7;
else if (gBattleTypeFlags & 0x8000)
gUnknown_020244A8->unk14->unkC = gTrainers[gUnknown_02038BCA].aiFlags | gTrainers[gUnknown_02038BCC].aiFlags;
else
gUnknown_020244A8->unk14->unkC = gTrainers[gUnknown_02038BCA].aiFlags;
if (gBattleTypeFlags & 1)
gUnknown_020244A8->unk14->unkC |= 0x80;
}
u8 sub_8130BA4(void)
{
u16 r4 = gUnknown_020241EA;
u8 ret;
if (!(gBattleTypeFlags & 1))
ret = sub_8130BDC();
else
ret = sub_8130CF4();
gUnknown_020241EA = r4;
return ret;
}
u8 sub_8130BDC(void)
{
u8 r6;
s32 i;
u8 arr1[4];
u8 arr2[4];
sub_8131074();
while (gUnknown_020244A8->unk14->unkC != 0)
{
if (gUnknown_020244A8->unk14->unkC & 1)
{
gUnknown_020244A8->unk14->unk0 = 0;
BattleAI_DoAIProcessing();
}
gUnknown_020244A8->unk14->unkC >>= 1;
gUnknown_020244A8->unk14->unk11++;
gUnknown_020244A8->unk14->unk1 = 0;
}
//_08130C2C
if (gUnknown_020244A8->unk14->unk10 & 2)
return 4;
if (gUnknown_020244A8->unk14->unk10 & 4)
return 5;
r6 = 1;
arr1[0] = gUnknown_020244A8->unk14->unk4[0];
arr2[0] = 0;
for (i = 1; i < 4; i++)
{
if (gBattleMons[gUnknown_0203AB3C].moves[i] != 0)
{
if (arr1[0] == gUnknown_020244A8->unk14->unk4[i])
{
arr1[r6] = gUnknown_020244A8->unk14->unk4[i];
arr2[r6++] = i;
}
//_08130CAA
if (arr1[0] < gUnknown_020244A8->unk14->unk4[i])
{
r6 = 1;
arr1[0] = gUnknown_020244A8->unk14->unk4[i];
arr2[0] = i;
}
}
//_08130CC6
}
return arr2[Random() % r6];
}
#ifdef NONMATCHING
u8 sub_8130CF4(void)
{
s32 i;
s32 j;
//s32 r4_2;
#define r4_2 r4
s32 r5;
s16 r5_2;
s32 r4;
s16 sp0[4];
s8 sp8[4];
s8 spC[4];
u8 sp10[4]; // definitely unsigned
u8 sp14[4];
//u8 *sp1C = spC;
//u8 *sp18 = sp8;
//u8 *sp20 = spC;
for (i = 0; i < 4; i++) //_08130D14
{
if (i == gUnknown_0203AB3C || gBattleMons[i].hp == 0)
{
//_08130D2E
spC[i] = -1;
sp0[i] = -1;
}
//_08130D48
else
{
if (gBattleTypeFlags & 0x20000)
BattleAI_SetupAIData(gUnknown_0202449C[0x92] >> 4);
else
BattleAI_SetupAIData(0xF);
//_08130D76
gUnknown_0202420C = i;
if ((i & 1) != (gUnknown_0203AB3C & 1))
sub_8131074();
//_08130D90
gUnknown_020244A8->unk14->unk11 = 0;
gUnknown_020244A8->unk14->unk1 = 0;
r4 = gUnknown_020244A8->unk14->unkC;
while (r4 != 0)
{
if (r4 & 1)
{
gUnknown_020244A8->unk14->unk0 = 0;
BattleAI_DoAIProcessing();
}
r4 >>= 1;
gUnknown_020244A8->unk14->unk11++;
gUnknown_020244A8->unk14->unk1 = 0;
}
//_08130DD8
if (gUnknown_020244A8->unk14->unk10 & 2)
spC[i] = 4;
else if (gUnknown_020244A8->unk14->unk10 & 4)
spC[i] = 5;
else
{
//_08130E10
sp10[0] = gUnknown_020244A8->unk14->unk4[0];
sp14[0] = 0;
r5 = 1;
for (j = 1; j < 4; j++)
{
if (gBattleMons[gUnknown_0203AB3C].moves[j] != 0)
{
if (sp10[0] == gUnknown_020244A8->unk14->unk4[j])
{
sp10[r5] = gUnknown_020244A8->unk14->unk4[j];
sp14[r5] = j;
r5++;
}
if (sp10[0] < gUnknown_020244A8->unk14->unk4[j])
{
sp10[0] = gUnknown_020244A8->unk14->unk4[j];
sp14[0] = j;
r5 = 1;
}
}
//_08130E72
}
spC[i] = sp14[Random() % r5];
//asm("":::"r3");
sp0[i] = sp10[0];
if (i == (gUnknown_0203AB3C ^ 2) && sp0[i] < 100)
sp0[i] = -1;
}
}
//_08130EAE
}
//#define i r5
//_08130EC4
r5_2 = sp0[0];
sp8[0] = 0;
r4_2 = 1;
for (i = 1; i < 4; i++)
{
//_08130EDA
if (r5_2 == sp0[i])
{
sp8[r4_2] = i;
r4_2++;
}
//_08130EEE
if (r5_2 < sp0[i])
{
r5_2 = sp0[i];
sp8[0] = i;
r4_2 = 1;
}
}
gUnknown_0202420C = sp8[Random() % r4_2];
return spC[gUnknown_0202420C];
}
#else
__attribute__((naked))
u8 sub_8130CF4(void)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x24\n\
movs r0, 0\n\
mov r8, r0\n\
mov r1, sp\n\
adds r1, 0xC\n\
str r1, [sp, 0x1C]\n\
mov r2, sp\n\
adds r2, 0x8\n\
str r2, [sp, 0x18]\n\
str r1, [sp, 0x20]\n\
mov r10, sp\n\
_08130D14:\n\
ldr r0, =gUnknown_0203AB3C\n\
ldrb r0, [r0]\n\
cmp r8, r0\n\
beq _08130D2E\n\
movs r0, 0x58\n\
mov r7, r8\n\
muls r7, r0\n\
adds r0, r7, 0\n\
ldr r1, =gBattleMons\n\
adds r0, r1\n\
ldrh r0, [r0, 0x28]\n\
cmp r0, 0\n\
bne _08130D48\n\
_08130D2E:\n\
movs r0, 0xFF\n\
ldr r2, [sp, 0x20]\n\
strb r0, [r2]\n\
ldr r0, =0x0000ffff\n\
mov r7, r10\n\
strh r0, [r7]\n\
b _08130EAE\n\
.pool\n\
_08130D48:\n\
ldr r0, =gBattleTypeFlags\n\
ldr r0, [r0]\n\
movs r1, 0x80\n\
lsls r1, 10\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _08130D70\n\
ldr r0, =gUnknown_0202449C\n\
ldr r0, [r0]\n\
adds r0, 0x92\n\
ldrb r0, [r0]\n\
lsrs r0, 4\n\
bl BattleAI_SetupAIData\n\
b _08130D76\n\
.pool\n\
_08130D70:\n\
movs r0, 0xF\n\
bl BattleAI_SetupAIData\n\
_08130D76:\n\
ldr r0, =gUnknown_0202420C\n\
mov r1, r8\n\
strb r1, [r0]\n\
movs r1, 0x1\n\
mov r2, r8\n\
ands r2, r1\n\
ldr r0, =gUnknown_0203AB3C\n\
ldrb r0, [r0]\n\
ands r1, r0\n\
cmp r2, r1\n\
beq _08130D90\n\
bl sub_8131074\n\
_08130D90:\n\
ldr r2, =gUnknown_020244A8\n\
ldr r0, [r2]\n\
ldr r0, [r0, 0x14]\n\
movs r1, 0\n\
strb r1, [r0, 0x11]\n\
ldr r0, [r2]\n\
ldr r0, [r0, 0x14]\n\
strb r1, [r0, 0x1]\n\
ldr r0, [r2]\n\
ldr r0, [r0, 0x14]\n\
ldr r4, [r0, 0xC]\n\
mov r9, r2\n\
cmp r4, 0\n\
beq _08130DD8\n\
mov r5, r9\n\
movs r6, 0\n\
_08130DB0:\n\
movs r0, 0x1\n\
ands r0, r4\n\
cmp r0, 0\n\
beq _08130DC2\n\
ldr r0, [r5]\n\
ldr r0, [r0, 0x14]\n\
strb r6, [r0]\n\
bl BattleAI_DoAIProcessing\n\
_08130DC2:\n\
asrs r4, 1\n\
ldr r0, [r5]\n\
ldr r1, [r0, 0x14]\n\
ldrb r0, [r1, 0x11]\n\
adds r0, 0x1\n\
strb r0, [r1, 0x11]\n\
ldr r0, [r5]\n\
ldr r0, [r0, 0x14]\n\
strb r6, [r0, 0x1]\n\
cmp r4, 0\n\
bne _08130DB0\n\
_08130DD8:\n\
mov r2, r9\n\
ldr r0, [r2]\n\
ldr r3, [r0, 0x14]\n\
ldrb r1, [r3, 0x10]\n\
movs r0, 0x2\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _08130DFC\n\
movs r0, 0x4\n\
ldr r7, [sp, 0x20]\n\
strb r0, [r7]\n\
b _08130EAE\n\
.pool\n\
_08130DFC:\n\
movs r0, 0x4\n\
ands r0, r1\n\
lsls r0, 24\n\
lsrs r2, r0, 24\n\
cmp r2, 0\n\
beq _08130E10\n\
movs r0, 0x5\n\
ldr r1, [sp, 0x20]\n\
strb r0, [r1]\n\
b _08130EAE\n\
_08130E10:\n\
add r1, sp, 0x10\n\
ldrb r0, [r3, 0x4]\n\
strb r0, [r1]\n\
add r0, sp, 0x14\n\
strb r2, [r0]\n\
movs r5, 0x1\n\
movs r3, 0x1\n\
adds r6, r1, 0\n\
ldr r0, =gUnknown_0203AB3C\n\
ldrb r1, [r0]\n\
movs r0, 0x58\n\
muls r0, r1\n\
ldr r2, =gUnknown_02024090\n\
adds r0, r2\n\
adds r4, r0, 0x2\n\
add r7, sp, 0x14\n\
_08130E30:\n\
ldrh r0, [r4]\n\
cmp r0, 0\n\
beq _08130E72\n\
ldrb r1, [r6]\n\
mov r2, r9\n\
ldr r0, [r2]\n\
ldr r0, [r0, 0x14]\n\
adds r0, 0x4\n\
adds r2, r0, r3\n\
movs r0, 0\n\
ldrsb r0, [r2, r0]\n\
cmp r1, r0\n\
bne _08130E56\n\
adds r0, r6, r5\n\
ldrb r1, [r2]\n\
strb r1, [r0]\n\
adds r0, r7, r5\n\
strb r3, [r0]\n\
adds r5, 0x1\n\
_08130E56:\n\
ldrb r1, [r6]\n\
mov r2, r9\n\
ldr r0, [r2]\n\
ldr r0, [r0, 0x14]\n\
adds r0, 0x4\n\
adds r2, r0, r3\n\
movs r0, 0\n\
ldrsb r0, [r2, r0]\n\
cmp r1, r0\n\
bge _08130E72\n\
ldrb r0, [r2]\n\
strb r0, [r6]\n\
strb r3, [r7]\n\
movs r5, 0x1\n\
_08130E72:\n\
adds r4, 0x2\n\
adds r3, 0x1\n\
cmp r3, 0x3\n\
ble _08130E30\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
adds r1, r5, 0\n\
bl __modsi3\n\
add r0, sp\n\
adds r0, 0x14\n\
ldrb r0, [r0]\n\
ldr r7, [sp, 0x20]\n\
strb r0, [r7]\n\
ldrb r2, [r6]\n\
mov r0, r10\n\
strh r2, [r0]\n\
ldr r0, =gUnknown_0203AB3C\n\
ldrb r1, [r0]\n\
movs r0, 0x2\n\
eors r0, r1\n\
cmp r8, r0\n\
bne _08130EAE\n\
cmp r2, 0x63\n\
bgt _08130EAE\n\
ldr r0, =0x0000ffff\n\
mov r1, r10\n\
strh r0, [r1]\n\
_08130EAE:\n\
ldr r2, [sp, 0x20]\n\
adds r2, 0x1\n\
str r2, [sp, 0x20]\n\
movs r7, 0x2\n\
add r10, r7\n\
movs r0, 0x1\n\
add r8, r0\n\
mov r1, r8\n\
cmp r1, 0x3\n\
bgt _08130EC4\n\
b _08130D14\n\
_08130EC4:\n\
mov r0, sp\n\
ldrh r5, [r0]\n\
movs r0, 0\n\
ldr r2, [sp, 0x18]\n\
strb r0, [r2]\n\
movs r4, 0x1\n\
mov r8, r4\n\
ldr r6, =gUnknown_0202420C\n\
ldr r3, [sp, 0x18]\n\
mov r1, sp\n\
adds r1, 0x2\n\
_08130EDA:\n\
lsls r0, r5, 16\n\
asrs r2, r0, 16\n\
movs r7, 0\n\
ldrsh r0, [r1, r7]\n\
cmp r2, r0\n\
bne _08130EEE\n\
adds r0, r3, r4\n\
mov r7, r8\n\
strb r7, [r0]\n\
adds r4, 0x1\n\
_08130EEE:\n\
movs r7, 0\n\
ldrsh r0, [r1, r7]\n\
cmp r2, r0\n\
bge _08130EFE\n\
ldrh r5, [r1]\n\
mov r0, r8\n\
strb r0, [r3]\n\
movs r4, 0x1\n\
_08130EFE:\n\
adds r1, 0x2\n\
movs r2, 0x1\n\
add r8, r2\n\
mov r7, r8\n\
cmp r7, 0x3\n\
ble _08130EDA\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
adds r1, r4, 0\n\
bl __modsi3\n\
ldr r1, [sp, 0x18]\n\
adds r0, r1, r0\n\
ldrb r0, [r0]\n\
strb r0, [r6]\n\
ldrb r0, [r6]\n\
ldr r2, [sp, 0x1C]\n\
adds r0, r2, r0\n\
ldrb r0, [r0]\n\
add sp, 0x24\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
.pool\n\
.syntax divided\n");
}
#endif
void BattleAI_DoAIProcessing(void)
{
while (gUnknown_020244A8->unk14->unk0 != 2)
{
switch (gUnknown_020244A8->unk14->unk0)
{
case 3: //Needed to match.
break;
case 0:
gAIScriptPtr = gUnknown_082DBEF8[gUnknown_020244A8->unk14->unk11];
if (gBattleMons[gUnknown_0203AB3C].pp[gUnknown_020244A8->unk14->unk1] == 0)
{
gUnknown_020244A8->unk14->unk2 = 0;
}
else
{
gUnknown_020244A8->unk14->unk2 = gBattleMons[gUnknown_0203AB3C].moves[gUnknown_020244A8->unk14->unk1];
}
gUnknown_020244A8->unk14->unk0++;
break;
case 1:
if (gUnknown_020244A8->unk14->unk2 != 0)
gUnknown_085B083C[*gAIScriptPtr]();
else
{
gUnknown_020244A8->unk14->unk4[gUnknown_020244A8->unk14->unk1] = 0;
gUnknown_020244A8->unk14->unk10 |= 1;
}
if (gUnknown_020244A8->unk14->unk10 & 1)
{
gUnknown_020244A8->unk14->unk1++;
if (gUnknown_020244A8->unk14->unk1 < 4 && !(gUnknown_020244A8->unk14->unk10 & 8))
gUnknown_020244A8->unk14->unk0 = 0;
else
gUnknown_020244A8->unk14->unk0++;
gUnknown_020244A8->unk14->unk10 &= 0xFE;
}
break;
}
}
}
void sub_8131074(void)
{
s32 i;
for (i = 0; i < 4; i++)
{
if (gUnknown_020244A8->unk18->unk0[gUnknown_0202420C][i] == gUnknown_02024248[gUnknown_0202420C])
break;
if (gUnknown_020244A8->unk18->unk0[gUnknown_0202420C][i] != gUnknown_02024248[gUnknown_0202420C] //HACK: This redundant condition is a hack to make the asm match.
&& gUnknown_020244A8->unk18->unk0[gUnknown_0202420C][i] == 0)
{
gUnknown_020244A8->unk18->unk0[gUnknown_0202420C][i] = gUnknown_02024248[gUnknown_0202420C];
break;
}
}
}
void sub_81310F0(u8 a)
{
s32 i;
for (i = 0; i < 4; i++)
gUnknown_020244A8->unk18->unk0[a][i] = 0;
}
void b_history__record_ability_usage_of_player(u8 a, u8 b)
{
gUnknown_020244A8->unk18->unk40[a] = b;
}
void sub_8131130(u8 a)
{
gUnknown_020244A8->unk18->unk40[a] = 0;
}
void b_history__record_item_x12_of_player(u8 a, u8 b)
{
gUnknown_020244A8->unk18->unk44[a] = b;
}
void sub_8131160(u8 a)
{
gUnknown_020244A8->unk18->unk44[a] = 0;
}
void BattleAICmd_if_random(void)
{
u16 random = Random();
if ((random & 0xFF) < gAIScriptPtr[1])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
else
gAIScriptPtr += 6;
}

View File

@ -324,7 +324,7 @@ gUnknown_02022F78: @ 2022F78
gUnknown_02022F88: @ 2022F88
.space 0x64
gUnknown_02022FEC: @ 2022FEC
gBattleTypeFlags: @ 2022FEC
.space 0x4
gUnknown_02022FF0: @ 2022FF0
@ -390,7 +390,7 @@ gUnknown_02024082: @ 2024082
gUnknown_02024083: @ 2024083
.space 0x1
gUnknown_02024084: @ 2024084
gBattleMons: @ 2024084
.space 0xC
gUnknown_02024090: @ 2024090
@ -1719,7 +1719,7 @@ gUnknown_0203AB30: @ 203AB30
gUnknown_0203AB34: @ 203AB34
.space 0x4
gUnknown_0203AB38: @ 203AB38
gAIScriptPtr: @ 203AB38
.space 0x4
gUnknown_0203AB3C: @ 203AB3C