-
Notifications
You must be signed in to change notification settings - Fork 0
/
crystal_us_battle.asm
66 lines (53 loc) · 1.69 KB
/
crystal_us_battle.asm
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
INCLUDE "charmap.asm"
INCLUDE "macros/const.asm"
INCLUDE "macros/data.asm"
INCLUDE "macros/gfx.asm"
INCLUDE "macros/scripts/maps.asm"
INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/item_data_constants.asm"
INCLUDE "constants/map_constants.asm"
INCLUDE "constants/text_constants.asm"
INCLUDE "constants/move_constants.asm"
INCLUDE "constants/item_constants.asm"
INCLUDE "defs.inc"
SECTION "crystal_us_battle", ROM0
LOAD "crystal_us_battle ram", WRAMX[wTempMail]
Mail:
db $15, $0A, $C0, $00 ; Set up ACE from RunMobileScript
; Generates the following at $CD52:
; ld l, $C5
; nop
; ret nz
push de
push bc
push af
; Set up the warp
ld a, 1 ; Dest warp ID
ld c, a
link_ldhl .warp_dest
call CopyWarpData__skip+1
link_ldhl .script_stack
ld de, wScriptStackSize
jp CopyMenuData+13 ; CopyBytes bc=$10, pop all regs
.warp_dest
map_id MOBILE_BATTLE_ROOM
; wTempMailAuthor
pad wTempMailAuthor
db "MB@"
.script_stack
db 3
; Abuse jumps to stop the script if game was not saved,
; start mobile battle otherwise (select three mon, etc etc).
;dbw $64, $75E6 ; MobileBattleRoomConsoleScript+12
dbl MobileBattleRoomConsoleScript__one_
; Invert wScriptVar (yes we doing script ROP now, who'd'a thunk)
;dbw $64, $6a08 ; LinkReceptionistScript_Battle.SelectThreeMons+3
; Get into the room (not entirely required but uses proper palettes for textboxes)
dbl FallIntoMapScript
; Save the game, set up the required environment to battle (including wLinkMode)
dbl LinkReceptionistScript_Battle__Mobile_TrySave
; wTempMailType
pad wTempMailType
db BLUESKY_MAIL ; Mail Type
pad wTempMailEnd
ENDL