summaryrefslogtreecommitdiff
path: root/scripts/mansion3.asm
blob: 06757e533bd8b9842d205f8f597e2861850cd603 (plain)
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
Mansion3Script: ; 521ee (14:61ee)
	call Mansion3Script_52204
	call EnableAutoTextBoxDrawing
	ld hl, Mansion3TrainerHeader0
	ld de, Mansion3ScriptPointers
	ld a, [W_MANSION3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MANSION3CURSCRIPT], a
	ret

Mansion3Script_52204: ; 52204 (14:6204)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d796]
	bit 0, a
	jr nz, .asm_52224
	ld a, $e
	ld bc, $207
	call Mansion2Script_5202f
	ld a, $5f
	ld bc, $507
	call Mansion2Script_5202f
	ret
.asm_52224
	ld a, $5f
	ld bc, $207
	call Mansion2Script_5202f
	ld a, $e
	ld bc, $507
	call Mansion2Script_5202f
	ret

Mansion3ScriptPointers: ; 52235 (14:6235)
	dw Mansion3Script0
	dw Func_324c
	dw EndTrainerBattle

Mansion3Script0: ; 5223b (14:623b)
	ld hl, CoordsData_52254
	call Mansion3Script_5225b
	ld a, [$d71e]
	and a
	jp z, CheckFightingMapTrainers
	cp $3
	ld a, $a5
	jr nz, .asm_52250
	ld a, $d6
.asm_52250
	ld [$d71d], a
	ret

CoordsData_52254: ; 52254 (14:6254)
	db $0E,$10
	db $0E,$11
	db $0E,$13
	db $FF

Mansion3Script_5225b: ; 5225b (14:625b)
	xor a
	ld [$d71e], a
	ld a, [$d72d]
	bit 4, a
	ret nz
	call ArePlayerCoordsInArray
	ret nc
	ld a, [wWhichTrade] ; $cd3d
	ld [$d71e], a
	ld hl, $d72d
	set 4, [hl]
	ld hl, $d732
	set 4, [hl]
	ret

Mansion3Script_Switches: ; 5227a (14:627a)
	ld a, [$c109]
	cp $4
	ret nz
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
	jp DisplayTextID

Mansion3TextPointers: ; 5228a (14:628a)
	dw Mansion3Text1
	dw Mansion3Text2
	dw Predef5CText
	dw Predef5CText
	dw Mansion3Text5
	dw Mansion3Text6

Mansion3TrainerHeaders: ; 52296 (14:6296)
Mansion3TrainerHeader0: ; 52296 (14:6296)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d849 ; flag's byte
	dw Mansion3BattleText1 ; 0x62c3 TextBeforeBattle
	dw Mansion3AfterBattleText1 ; 0x62cd TextAfterBattle
	dw Mansion3EndBattleText1 ; 0x62c8 TextEndBattle
	dw Mansion3EndBattleText1 ; 0x62c8 TextEndBattle

Mansion3TrainerHeader2: ; 522a2 (14:62a2)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d849 ; flag's byte
	dw Mansion3BattleText2 ; 0x62d2 TextBeforeBattle
	dw Mansion3AfterBattleText2 ; 0x62dc TextAfterBattle
	dw Mansion3EndBattleText2 ; 0x62d7 TextEndBattle
	dw Mansion3EndBattleText2 ; 0x62d7 TextEndBattle

	db $ff

Mansion3Text1: ; 522af (14:62af)
	db $08 ; asm
	ld hl, Mansion3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Mansion3Text2: ; 522b9 (14:62b9)
	db $08 ; asm
	ld hl, Mansion3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Mansion3BattleText1: ; 522c3 (14:62c3)
	TX_FAR _Mansion3BattleText1
	db "@"

Mansion3EndBattleText1: ; 522c8 (14:62c8)
	TX_FAR _Mansion3EndBattleText1
	db "@"

Mansion3AfterBattleText1: ; 522cd (14:62cd)
	TX_FAR _Mansion3AfterBattleText1
	db "@"

Mansion3BattleText2: ; 522d2 (14:62d2)
	TX_FAR _Mansion3BattleText2
	db "@"

Mansion3EndBattleText2: ; 522d7 (14:62d7)
	TX_FAR _Mansion3EndBattleText2
	db "@"

Mansion3AfterBattleText2: ; 522dc (14:62dc)
	TX_FAR _Mansion3AfterBattleText2
	db "@"

Mansion3Text5: ; 522e1 (14:62e1)
	TX_FAR _Mansion3Text5
	db "@"