summaryrefslogtreecommitdiff
path: root/Battle-Autoprompts.md
blob: e6b07d2a1f274c8215408d6731dd7b51eb2a43ce (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
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
In Generation 3 onwards, most battle texts don't require the player to click A. That's not the case in Generation 2, as most battle texts require prompts which the player must press A. Thus, players tend to spam it after making a move. This tutorial aims to remove prompts for most battle texts by making the game scroll through them automatically.

## Contents

1. [Add new charmap constants](#1-add-new-charmap-constants)
2. [Define new macros for autoprompts](#2-define-new-macros-for-autoprompts)
3. [Make functions for the new macros](#3-make-functions-for-the-new-macros)
4. [Edit battle text to not require prompts](#4-edit-battle-text-to-not-require-prompts)


## 1. Add new charmap constants

We first need to edit [charmap.asm](../blob/master/charmap.asm) to make the autoprompts possible. Each control character is assigned to a 2 hex digit. There are a lot of unassigned hex digits, thus we can use some of them.

```diff
...
	charmap "<_CONT>",   $4b ; implements "<CONT>"
+       ; While "<SCROLL>" this is used in sharply rose or sharply fell stat texts, this will be
+       ; adjusted to give the player time to read.
	charmap "<SCROLL>",  $4c
	charmap "<NEXT>",    $4e
	charmap "<LINE>",    $4f
	charmap "@",         $50 ; string terminator
	charmap "<PARA>",    $51
	charmap "<PLAYER>",  $52 ; wPlayerName
	charmap "<RIVAL>",   $53 ; wRivalName
	charmap "#",         $54 ; "POKé"
	charmap "<CONT>",    $55
	charmap "<……>",      $56 ; "……"
	charmap "<DONE>",    $57
	charmap "<PROMPT>",  $58
	charmap "<TARGET>",  $59
	charmap "<USER>",    $5a
	charmap "<PC>",      $5b ; "PC"
	charmap "<TM>",      $5c ; "TM"
	charmap "<TRAINER>", $5d ; "TRAINER"
	charmap "<ROCKET>",  $5e ; "ROCKET"
	charmap "<DEXEND>",  $5f
+	charmap "<ATPRA>",	 $60
+	charmap "<ATDNE>",	 $61
...
```

## 2. Define new macros for autoprompts

Next, we edit [macros/scripts/text.asm](../blob/master/macros/scripts/text.asm) to add new macros that we'll be using for autoprompts.

```diff
text   		EQUS "db TX_START,"    		; Start writing text.
next   		EQUS "db \"<NEXT>\","  		; Move a line down.
line   		EQUS "db \"<LINE>\"," 		; Start writing at the bottom line.
page   		EQUS "db \"@\","      		; Start a new Pokédex page.
para   		EQUS "db \"<PARA>\","  		; Start a new paragraph.
+ autopara  	EQUS "db \"<ATPRA>\"," 		; Automatically start a new paragraph.
cont   		EQUS "db \"<CONT>\","  		; Scroll to the next line.
+ scroll   	EQUS "db \"<SCROLL>\","  	; Scroll to the next line, pausing shortly.
done   		EQUS "db \"<DONE>\""   		; End a text box.
+ autodone   	EQUS "db \"<ATDNE>\"" 		; Automatically ends a text box.
prompt 		EQUS "db \"<PROMPT>\"" 		; Prompt the player to end a text box (initiating some other event).
```

## 3. Make functions for the new macros

We then edit [home/text.asm](../blob/master/home/text.asm) and make functions for the new constants.

```diff

	dict "<MOBILE>",  MobileScriptChar
	dict "<LINE>",    LineChar
	dict "<NEXT>",    NextLineChar
	dict "<CR>",      CarriageReturnChar
	dict "<NULL>",    NullChar
-	dict "<SCROLL>",  _ContTextNoPause
+	dict "<SCROLL>",  _ContTextPauseShort
	dict "<_CONT>",   _ContText
	dict "<PARA>",    Paragraph
+	dict "<ATPRA>",   AutoParagraph
	dict "<MOM>",     PrintMomsName
...
	dict "<LF>",      LineFeedChar
	dict "<CONT>",    ContText
	dict "<……>",      SixDotsChar
	dict "<DONE>",    DoneText
+	dict "<ATDNE>",   AutoDoneText
	dict "<PROMPT>",  PromptText
	dict "<PKMN>",    PlacePKMN
	dict "<POKE>",    PlacePOKE

...

_ContTextNoPause::
	push de
	call TextScroll
	call TextScroll
	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
	pop de
	jp NextChar

+_ContTextPauseShort::
+	push de
+	call TextScroll
+	call TextScroll
+	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
+	ld c, 5
+	call DelayFrames
+	pop de
+	jp NextChar

...

Paragraph::
	push de

	ld a, [wLinkMode]
	cp LINK_COLOSSEUM
	jr z, .linkbattle
	cp LINK_MOBILE
	jr z, .linkbattle
	call LoadBlinkingCursor

.linkbattle
	call Text_WaitBGMap
	call PromptButton
	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
	lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
	call ClearBox
	call UnloadBlinkingCursor
	ld c, 20
	call DelayFrames
	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
	pop de
	jp NextChar

+AutoParagraph::
+	push de
+	call Text_WaitBGMap
+	ld c, 10
+	call DelayFrames
+	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
+	lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
+	call ClearBox
+	ld c, 20
+	call DelayFrames
+	hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
+	pop de
+	jp NextChar

...

DoneText::
	pop hl
	ld de, .stop
	dec de
	ret

.stop:
	text_end
	
+AutoDoneText::
+	call Text_WaitBGMap
+	ld c, 20
+	call DelayFrames
+	jr DoneText

```

## 4. Edit battle text to not require prompts

Edit [data/text/common_1.asm](../blob/master/data/text/common_1.asm) for the withdraw battle text:

```diff
_EnemyWithdrewText::
	text "<ENEMY>"
	line "withdrew"
-	cont "@"
+	scroll "@"
	text_ram wEnemyMonNickname
	text "!"
-	prompt
+       autodone

_EnemyUsedOnText::
	text "<ENEMY>"
	line "used @"
	text_ram wMonOrItemNameBuffer
	text_start
-       cont "on @"
+	scroll "on @"
	text_ram wEnemyMonNick
	text "!"
-       prompt
+	autodone

```

Also, edit [data/text/battle.asm](../blob/master/data/text/battle.asm). Since the text is disorganized, just remember to edit the text related to type effectiveness, residual damage, item use, weather status, and more. Make sure to avoid editing fainting and EXP prompts. Feel free to edit the file by replacing the following macros:

1. `cont` to `scroll`
2. `para` to `autopara`
3. `done` to `autodone`.

That's it! You've made most battle texts have autoprompts! If you want to have an idea how it'd look like in action, you can watch [this video](https://www.youtube.com/watch?v=tfD33KcVu2M) or [this video](https://www.youtube.com/watch?v=Vl_1iRCSYUw).