1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
|
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sp000_heal_pokemon
sp000_heal_pokemon: @ 80A0058
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
movs r0, 0
mov r8, r0
ldr r0, _080A0114 @ =gPlayerPartyCount
ldrb r0, [r0]
cmp r8, r0
bcs _080A0104
ldr r1, _080A0118 @ =gPlayerParty
mov r10, r1
mov r6, sp
_080A0076:
movs r0, 0x64
mov r4, r8
muls r4, r0
add r4, r10
adds r0, r4, 0
movs r1, 0x3A
bl GetMonData
lsls r1, r0, 16
strb r0, [r6]
lsrs r1, 24
strb r1, [r6, 0x1]
adds r0, r4, 0
movs r1, 0x39
mov r2, sp
bl SetMonData
adds r0, r4, 0
movs r1, 0x15
bl GetMonData
lsls r0, 24
lsrs r7, r0, 24
movs r5, 0
movs r1, 0x1
add r1, r8
mov r9, r1
_080A00AC:
adds r1, r5, 0
adds r1, 0xD
adds r0, r4, 0
bl GetMonData
lsls r0, 16
lsrs r0, 16
adds r1, r7, 0
adds r2, r5, 0
bl CalculatePPWithBonus
strb r0, [r6]
adds r1, r5, 0
adds r1, 0x11
adds r0, r4, 0
mov r2, sp
bl SetMonData
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x3
bls _080A00AC
movs r0, 0
strb r0, [r6]
strb r0, [r6, 0x1]
strb r0, [r6, 0x2]
strb r0, [r6, 0x3]
movs r1, 0x64
mov r0, r8
muls r0, r1
add r0, r10
movs r1, 0x37
mov r2, sp
bl SetMonData
mov r1, r9
lsls r0, r1, 24
lsrs r0, 24
mov r8, r0
ldr r0, _080A0114 @ =gPlayerPartyCount
ldrb r0, [r0]
cmp r8, r0
bcc _080A0076
_080A0104:
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080A0114: .4byte gPlayerPartyCount
_080A0118: .4byte gPlayerParty
thumb_func_end sp000_heal_pokemon
thumb_func_start ScriptGiveMon
ScriptGiveMon: @ 80A011C
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x14
adds r6, r0, 0
adds r4, r1, 0
adds r5, r2, 0
lsls r6, 16
lsrs r6, 16
lsls r4, 24
lsrs r4, 24
lsls r5, 16
lsrs r0, r5, 16
mov r8, r0
movs r0, 0x64
bl AllocZeroed
adds r7, r0, 0
movs r0, 0
str r0, [sp]
str r0, [sp, 0x4]
str r0, [sp, 0x8]
str r0, [sp, 0xC]
adds r0, r7, 0
adds r1, r6, 0
adds r2, r4, 0
movs r3, 0x20
bl CreateMon
add r0, sp, 0x10
mov r1, r8
strb r1, [r0]
lsrs r5, 24
strb r5, [r0, 0x1]
adds r0, r7, 0
movs r1, 0xC
add r2, sp, 0x10
bl SetMonData
adds r0, r7, 0
bl GiveMonToPlayer
lsls r0, 24
lsrs r4, r0, 24
adds r0, r6, 0
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r5, r0, 16
cmp r4, 0x1
bgt _080A0196
cmp r4, 0
blt _080A0196
adds r0, r5, 0
movs r1, 0x2
bl GetSetPokedexFlag
adds r0, r5, 0
movs r1, 0x3
bl GetSetPokedexFlag
_080A0196:
adds r0, r7, 0
bl Free
adds r0, r4, 0
add sp, 0x14
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end ScriptGiveMon
thumb_func_start ScriptGiveEgg
ScriptGiveEgg: @ 80A01AC
push {r4,r5,lr}
sub sp, 0x4
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
movs r0, 0x64
bl AllocZeroed
adds r5, r0, 0
adds r1, r4, 0
movs r2, 0x1
bl CreateEgg
movs r1, 0x1
mov r0, sp
strb r1, [r0]
adds r0, r5, 0
movs r1, 0x2D
mov r2, sp
bl SetMonData
adds r0, r5, 0
bl GiveMonToPlayer
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r5, 0
bl Free
adds r0, r4, 0
add sp, 0x4
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end ScriptGiveEgg
thumb_func_start CheckForAlivePartyMons
CheckForAlivePartyMons: @ 80A01F4
push {lr}
bl GetMonsStateToDoubles
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x1
beq _080A0210
cmp r1, 0x1
bgt _080A020C
cmp r1, 0
beq _080A0210
b _080A0214
_080A020C:
cmp r1, 0x2
bne _080A0214
_080A0210:
ldr r0, _080A0218 @ =gSpecialVar_Result
strh r1, [r0]
_080A0214:
pop {r0}
bx r0
.align 2, 0
_080A0218: .4byte gSpecialVar_Result
thumb_func_end CheckForAlivePartyMons
thumb_func_start CheckPartyMonHasHeldItem
CheckPartyMonHasHeldItem: @ 80A021C
push {r4-r7,lr}
lsls r0, 16
lsrs r6, r0, 16
movs r5, 0
movs r7, 0xCE
lsls r7, 1
_080A0228:
movs r0, 0x64
adds r1, r5, 0
muls r1, r0
ldr r0, _080A0258 @ =gPlayerParty
adds r4, r1, r0
adds r0, r4, 0
movs r1, 0x41
bl GetMonData
lsls r0, 16
lsrs r0, 16
cmp r0, 0
beq _080A025C
cmp r0, r7
beq _080A025C
adds r0, r4, 0
movs r1, 0xC
bl GetMonData
cmp r0, r6
bne _080A025C
movs r0, 0x1
b _080A0264
.align 2, 0
_080A0258: .4byte gPlayerParty
_080A025C:
adds r5, 0x1
cmp r5, 0x5
ble _080A0228
movs r0, 0
_080A0264:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end CheckPartyMonHasHeldItem
thumb_func_start GetNameOfEnigmaBerryInPlayerParty
GetNameOfEnigmaBerryInPlayerParty: @ 80A026C
push {r4,lr}
movs r0, 0xAF
bl CheckPartyMonHasHeldItem
lsls r0, 24
lsrs r0, 24
adds r4, r0, 0
cmp r4, 0x1
bne _080A028E
movs r0, 0xAF
bl ItemIdToBerryType
lsls r0, 24
lsrs r0, 24
ldr r1, _080A0298 @ =gStringVar1
bl GetBerryNameByBerryType
_080A028E:
adds r0, r4, 0
pop {r4}
pop {r1}
bx r1
.align 2, 0
_080A0298: .4byte gStringVar1
thumb_func_end GetNameOfEnigmaBerryInPlayerParty
thumb_func_start CreateScriptedWildMon
CreateScriptedWildMon: @ 80A029C
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x14
adds r4, r0, 0
adds r5, r1, 0
lsls r4, 16
lsrs r4, 16
lsls r5, 24
lsrs r5, 24
lsls r7, r2, 16
lsrs r6, r7, 16
bl ZeroEnemyPartyMons
ldr r0, _080A02F8 @ =gEnemyParty
mov r8, r0
movs r0, 0
str r0, [sp]
str r0, [sp, 0x4]
str r0, [sp, 0x8]
str r0, [sp, 0xC]
mov r0, r8
adds r1, r4, 0
adds r2, r5, 0
movs r3, 0x20
bl CreateMon
cmp r6, 0
beq _080A02EA
add r0, sp, 0x10
strb r6, [r0]
adds r1, r0, 0
lsrs r0, r7, 24
strb r0, [r1, 0x1]
mov r0, r8
movs r1, 0xC
add r2, sp, 0x10
bl SetMonData
_080A02EA:
add sp, 0x14
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080A02F8: .4byte gEnemyParty
thumb_func_end CreateScriptedWildMon
thumb_func_start ScriptSetMonMoveSlot
ScriptSetMonMoveSlot: @ 80A02FC
push {r4,lr}
lsls r0, 24
lsrs r3, r0, 24
lsls r1, 16
lsrs r4, r1, 16
lsls r2, 24
lsrs r2, 24
cmp r3, 0x6
bls _080A0318
ldr r0, _080A032C @ =gPlayerPartyCount
ldrb r0, [r0]
subs r0, 0x1
lsls r0, 24
lsrs r3, r0, 24
_080A0318:
movs r0, 0x64
muls r0, r3
ldr r1, _080A0330 @ =gPlayerParty
adds r0, r1
adds r1, r4, 0
bl SetMonMoveSlot
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A032C: .4byte gPlayerPartyCount
_080A0330: .4byte gPlayerParty
thumb_func_end ScriptSetMonMoveSlot
thumb_func_start sub_80A0334
sub_80A0334: @ 80A0334
push {lr}
ldr r1, _080A0348 @ =gMain
ldr r0, _080A034C @ =sub_80A0350
str r0, [r1, 0x8]
movs r0, 0
bl sub_81274A8
pop {r0}
bx r0
.align 2, 0
_080A0348: .4byte gMain
_080A034C: .4byte sub_80A0350
thumb_func_end sub_80A0334
thumb_func_start sub_80A0350
sub_80A0350: @ 80A0350
push {lr}
ldr r0, _080A0360 @ =gUnknown_203B0D4
ldrb r1, [r0]
cmp r1, 0
bne _080A0368
ldr r0, _080A0364 @ =gSpecialVar_Result
strh r1, [r0]
b _080A036E
.align 2, 0
_080A0360: .4byte gUnknown_203B0D4
_080A0364: .4byte gSpecialVar_Result
_080A0368:
ldr r1, _080A0378 @ =gSpecialVar_Result
movs r0, 0x1
strh r0, [r1]
_080A036E:
ldr r0, _080A037C @ =CB2_ReturnToFieldContinueScriptPlayMapMusic
bl SetMainCallback2
pop {r0}
bx r0
.align 2, 0
_080A0378: .4byte gSpecialVar_Result
_080A037C: .4byte CB2_ReturnToFieldContinueScriptPlayMapMusic
thumb_func_end sub_80A0350
thumb_func_start sub_80A0380
sub_80A0380: @ 80A0380
push {lr}
ldr r1, _080A0394 @ =gMain
ldr r0, _080A0398 @ =sub_80A039C
str r0, [r1, 0x8]
movs r0, 0x1
bl sub_81274A8
pop {r0}
bx r0
.align 2, 0
_080A0394: .4byte gMain
_080A0398: .4byte sub_80A039C
thumb_func_end sub_80A0380
thumb_func_start sub_80A039C
sub_80A039C: @ 80A039C
push {r4,lr}
ldr r0, _080A03B0 @ =gUnknown_203B0D4
ldrb r4, [r0]
cmp r4, 0
bne _080A03B8
bl LoadPlayerParty
ldr r0, _080A03B4 @ =gSpecialVar_Result
strh r4, [r0]
b _080A03C2
.align 2, 0
_080A03B0: .4byte gUnknown_203B0D4
_080A03B4: .4byte gSpecialVar_Result
_080A03B8:
bl sub_80A03D8
ldr r1, _080A03D0 @ =gSpecialVar_Result
movs r0, 0x1
strh r0, [r1]
_080A03C2:
ldr r0, _080A03D4 @ =CB2_ReturnToFieldContinueScriptPlayMapMusic
bl SetMainCallback2
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080A03D0: .4byte gSpecialVar_Result
_080A03D4: .4byte CB2_ReturnToFieldContinueScriptPlayMapMusic
thumb_func_end sub_80A039C
thumb_func_start sub_80A03D8
sub_80A03D8: @ 80A03D8
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x4
movs r0, 0x96
lsls r0, 1
bl AllocZeroed
adds r7, r0, 0
movs r5, 0
movs r0, 0x64
mov r8, r0
ldr r6, _080A0454 @ =gPlayerParty
adds r4, r7, 0
_080A03F4:
ldr r0, _080A0458 @ =gUnknown_203B0D4
adds r1, r5, r0
ldrb r0, [r1]
cmp r0, 0
beq _080A040E
subs r0, 0x1
mov r1, r8
muls r1, r0
adds r1, r6
adds r0, r4, 0
movs r2, 0x64
bl memcpy
_080A040E:
adds r4, 0x64
adds r5, 0x1
cmp r5, 0x2
ble _080A03F4
movs r0, 0
str r0, [sp]
ldr r4, _080A0454 @ =gPlayerParty
ldr r2, _080A045C @ =0x05000096
mov r0, sp
adds r1, r4, 0
bl CpuSet
adds r5, r7, 0
adds r6, r7, 0
adds r6, 0xC8
_080A042C:
adds r0, r4, 0
adds r1, r5, 0
movs r2, 0x64
bl memcpy
adds r5, 0x64
adds r4, 0x64
cmp r5, r6
ble _080A042C
bl CalculatePlayerPartyCount
adds r0, r7, 0
bl Free
add sp, 0x4
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080A0454: .4byte gPlayerParty
_080A0458: .4byte gUnknown_203B0D4
_080A045C: .4byte 0x05000096
thumb_func_end sub_80A03D8
.align 2, 0 @ Don't pad with nop.
|