-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMMX3_AllText.asm
472 lines (385 loc) · 10.2 KB
/
MMX3_AllText.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
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
;==================================================================================
; Mega Man X3 (Base Mod Project)
; By xJustin3009x (Shishisenkou) (Justin3009)
;==================================================================================
; This file is used to import the code changes for dialogue expansion
; and removing excess dialogue data.
;==================================================================================
; NOTE: The ROM MUST be expanded to 4MB first WITHOUT a header!
;==================================================================================
;***************************
;Blank data
;***************************
;$B9:C1BC - $B9:FFFF
;***************************
;***************************
; ROM Addresses
;***************************
;***************************
header : lorom
incsrc MMX3_NewCode_Locations.asm
incsrc MMX3_VariousAddresses.asm
;***************************
;***************************
;In-Game dialogue setup
;***************************
; Changes $7E:0068 (Pointer to text) to be at $7E:008D so the text bank and pointers can be at $7E:008D-$7E:008F
; This allows for individual banks without having to hard set a universal bank in the code.
org $80E647 ;JSL's to dialogue setup so each PC can have their own banks and pointers for dialogue
JSL DialogueSetup
NOP #2
org $80E921 ;Removes code that hard sets bank then changes original RAM value so it loads the new location for pointers. After, it increases the DialoguePointer byte.
{
LDA [$8D] ;Load base dialogue pointer in RAM
REP #$20
INC $8D ;Load bank of dialogue pointer in RAM
SEP #$20
RTS
LDA #$00
STA $00
}
org $80E781 ;Changes RAM value so it loads the new location for pointers/bank
{
ADC $8D ;ADC dialogue pointer
STA $8D ;Store back to dialogue pointer
}
;***************************
;Alteration of Key Command so when pressing 'Start' during text, it entirely skips the string.
;***************************
{
org $80E728 ;This is for when pressing start during any part of the dialogue writing
JSR $E806
NOP #6
org $80E830
JSR Dialogue_NewPage_Start
org $80E806
Dialogue_IncreaseSpeed_Start:
LDA $0A0F
BIT #$10
BEQ Dialogue_IncreaseSpeed_Start_NotPressed
JMP $E7B4
Dialogue_IncreaseSpeed_Start_NotPressed:
RTS
Dialogue_NewPage_Start:
LDA $0A0F
BIT #$10
BEQ Dialogue_NewPage_Start_NotPressed
JMP $E7B4
Dialogue_NewPage_Start_NotPressed:
INC $1F51
RTS
}
;***************************
;***************************
;Sub-Weapon text and icon setup in menu for all PCs
;***************************
org $80CC61 ;Loads a JSR to load Exit Icon
{
CLC
JSR $D451
NOP #2 ;Removed since it's merged into the main routine now
}
org $80D1F0 ;Load Exit Icon then X-Buster Icon & Text
{
;Draw Exit Icon
LDX #$0B ;Load single byte Exit data
JSR DrawDarkSubWeaponTextIcon
LDX #$0C ;Load single byte Exit data
JSR DrawDarkSubWeaponTextIcon
;Draw X-Buster Icon
LDA !CurrentPC_0A8E
BNE LoadBusterIcon
LDA !ZSaberObtained_1FB2
BIT #$80
BEQ LoadBusterIcon
LDX #$0D ;Load single byte X-Buster/Z-Saber icon data
BRA LoadGeneralIcon
LoadBusterIcon:
LDX #$0A ;Load single byte X-Buster icon data
LoadGeneralIcon:
LDA !CurrentPCSubWeapon_0A0B
BNE LoadDarkXBusterIcon
JSR DrawLightSubWeaponTextIcon
BRA BeginSubWeaponDataDrawing
LoadDarkXBusterIcon:
JSR DrawDarkSubWeaponTextIcon
BeginSubWeaponDataDrawing: ;Loads sub-weapon text/icons
LDX #$00
BeginSubWeaponLoading:
INX
CPX #$0B ;Max sub-weapon value
BEQ EndSubWeaponData
LDA !CurrentPCSubWeapon_0A0B
STA $0006 ;Store current sub-weapon value
JSL LoadPCSplitSubWeapon ;Load routine to get proper sub-weapon life bar/text/icon with PC split
BEQ DecreaseXThenLoop
CPX $0006 ;Compare sub-weapon value to current sub-weapon value in 'X', if the same, load 'LIGHT' text.
BNE LoadDarkSubWeaponData
DEX
JSR DrawLightSubWeaponTextIcon
INX
BRA DecreaseXThenLoop
LoadDarkSubWeaponData:
DEX
JSR DrawDarkSubWeaponTextIcon
INX
DecreaseXThenLoop:
BRA BeginSubWeaponLoading
EndSubWeaponData:
RTS
DrawLightSubWeaponTextIcon:
LDA #$30
JSR DrawSubWeaponText
LDA #$28
JSR DrawSubWeaponIcon
RTS
DrawDarkSubWeaponTextIcon:
LDA #$3C
JSR DrawSubWeaponText
LDA #$34
JSR DrawSubWeaponIcon
RTS
DrawSubWeaponText: ;Sets and draws data for sub-weapon text/sub-weapon text X/Y coordinates
STA $0002
PHX
JSL PCSubWeapTextXYCoord
PLX
subweapontextload:
LDA [$8D]
BEQ endsubweapontext
STA $2118
LDA $0002
STA $2119
INC $8D
BRA subweapontextload
endsubweapontext:
RTS
DrawSubWeaponIcon: ;Sets and draws data for sub-weapon icon X/Y coordinates and graphics
STA $0003
STZ $0002
PHX
JSL PCSubWeapIconGraphicSetup
PLX
STA $2118
INC
STA $2118
STA $00
LDA $10
CLC
ADC #$0020
STA $2116
LDA $00
CLC
ADC #$000F
STA $2118
INC
STA $2118
SEP #$20
RTS
}
org $80D373 ;Sets data for DARK sub-weapon text/sub-weapon text X/Y coordinates
{
PHX
STA $0001
NOP
LDY $00A5
STY $0002
STZ $0003
LDA #$80
STA $0600,y
REP #$20
PHD
LDA #$0000
TCD
JSL PCSubWeapTextXYCoord
NOP #9
SEP #$20
darksubtext:
LDA [$8D]
BEQ enddarksubtext
STA $0604,y
LDA $0001
STA $0605,y
INC $8D
INY #2
INC $0003
BRA darksubtext
enddarksubtext:
TYA
CLC
ADC #$04
STA $00A5
LDY $0002
LDA $0003
ASL A
STA $0603,y
PLD
PLX
LDA $0001
RTS
org $80D3C9 ;Sets data for DARK sub-weapon icon X/Y coordinates/graphics
STA $0003
STZ $0002
LDY $00A5
LDA #$80
STA $0600,y
STA $0608,y
LDA #$04
STA $0603,y
STA $060B,y
PHX
JSL PCSubWeapIconGraphicSetup
PLX
NOP #15
}
;***************************
;***************************
;Sub-Weapon life bars in menu for all PCs
;***************************
org $80D113
{
LDA #$80
STA $2115
LDA #$28
STA $004
LDY #$1C ;Load max health of life bar
LDX #$0A ;Load X-Buster single byte value for life bar X/Y coordinates
LDA !CurrentPCSubWeapon_0A0B
BNE LoadDarkLifeBarIfSubWeaponOn
LDA #$30 ;Palette of light life bar
BRA IgnoreDarkLifeBar
LoadDarkLifeBarIfSubWeaponOn:
LDA #$3C ;Palette of dark life bar
IgnoreDarkLifeBar:
JSR $D191 ;Draw sub-weapon life bar
LDX #$00
BeginLifeBarLoop:
INX
CPX #$10 ;Max amount of life bars to draw
BEQ EndLifeBarRoutine
LDA !CurrentPCSubWeapon_0A0B
STA $0006
JSL LoadPCSplitSubWeapon
BEQ DecreaseXOfLifeBarThenLoop
AND #$1F
TAY
CPX $0006
BNE LoadDarkLifeBarIfSubWeaponIsNotSame
LDA #$30
BRA IgnoreDarkLifeBar2
LoadDarkLifeBarIfSubWeaponIsNotSame:
LDA #$3C
IgnoreDarkLifeBar2:
DEX
PHX
JSR $D191 ;Draw sub-weapon life bar
PLX
INX
DecreaseXOfLifeBarThenLoop:
BRA BeginLifeBarLoop
EndLifeBarRoutine:
RTS
}
org $80D191 ;Sets data for LIGHT sub-weapon life bar X/Y coordinates
{
STA $0004
STY $00
PHX
JSL PCSubWeapAmmoXYCoord
PLX
NOP #6
}
org $80D2EB ;Sets data for DARK sub-weapon life bar X/Y coordinates
{
PHX
JSL PCSubWeapAmmoXYCoord
PLX
NOP #6
}
;***************************
;***************************
; X/Y coordinates of sub-tanks/sub-tanks text in menu
;***************************
org $869FA2 ;Sub-tank X/Y coordinates
dw $59B1
dw $59B5
dw $5A11
dw $5A15
org $86A07D ;Sub-tank text X/Y coordinates
dw $5A51
org $80D435 ;Sub-tank text
LDA $9FB0,x
org $80D42A ;How many letters to load for S.Tank text
LDA #$0C ;Goes by total letters * 2
org $869FB0
db $82,$8B,$83,$70,$7D,$7A,$00 ;S-Tank
;***************************
;***************************
; Removes old Katakana text commands values of 84/85
; Replaces them with:
; 84 - Transition Dr. Light introduction text to proper capsule text
; 85 - Play a SFX
;***************************
org $80E74A ;Command 84
dw $E7D6
org $80E74C ;Command 85
dw $E7F6
org $80E7D6 ;Command 84: Clears Layer 3 tile map then loads new string
LDA #$04
STA $00A3
STZ $00A4
LDA !CurrentLevel_1FAE
ASL A
TAX
LDA $CEED,x ;Dr. Light text
STA $1F46
JMP $E63E
RTS
org $80E7F6 ;Command 85: Plays a SFX
LDA [$8D]
INC $8D
JSL !PlaySFX
JMP $E66F ;End routine
;***************************
;***************************
;Moving anywhere in the menu to display light or dark icons, text etc..
;***************************
{
org $80C769 ;Partial routine rewrite for moving 'down' in menu to get next sub-weapon
JSL PC_SelectSubWeaponDown_Menu
; NOP ;Rewritten partially so it increases X only once and the max sub-weapon is '0B' so it properly load single byte sub-weapons
; INX
; CPX #$0A
org $80C77C ;Partial routine rewrite for moving 'down' in menu to get next sub-weapon
JSR SplitPCSubWeaponInBank ;Gets sub-weapon life
BNE $1C
org $80C817 ;Partial routine rewrite for moving 'down' in menu to get next sub-weapon
JSR SplitPCSubWeaponInBank ;Gets sub-weapon life
org $80C78B ;Max sub-weapon to check when pressing 'Up'
JSL PC_SelectSubWeaponUp_Menu
; LDX #$0A
; CPX $0A
org $80C7F3 ;Partial routine rewrite for moving 'up' in menu to get next sub-weapon
JSR SplitPCSubWeaponInBank ;Gets sub-weapon life
org $80C787 ;Partial routine rewrite for moving 'down' in menu to get next sub-weapon
NOP #4 ;Removed a 'DEX' so it doesn't decrease double when it only needs single now
org $80C7EA ;Removes a TAY and LSR for getting proper sub-weapon to load when moving 'down' in menu.
NOP #2
org $80C80E ;Removes a TAY and LSR for getting proper sub-weapon to load when moving 'down' in menu.
NOP #2
org $80C798 ;Partial routine rewrite for moving 'up' in menu to get next sub-weapon
JSR SplitPCSubWeaponInBank ;Gets sub-weapon life
BEQ $EA
org $80C7F9 ;Checks for having the Z-Saber obtained and alters X's X-BUSTER icon (Turning Icon Dark)
JSL XBusterCheckZSaber
org $80C81D ;Checks for having the Z-Saber obtained and alters X's X-BUSTER icon (Turning Icon Light)
JSL XBusterCheckZSaber
org $80C987 ;Load LIGHT exit icon
LDX #$0B ;Changed to '0B' since it's a single byte now
org $80C978 ;Load DARK exit icon
LDX #$0B ;Changed to '0B' since it's a single byte now
org $80FF5A ;Loads PC split sub-weapon
SplitPCSubWeaponInBank:
JSL LoadPCSplitSubWeapon
RTS
}