-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMMX3_OriginalLocations.asm
4552 lines (3806 loc) · 137 KB
/
MMX3_OriginalLocations.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
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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;==================================================================================
; Mega Man X3 (Base Mod Project)
; By xJustin3009x (Shishisenkou) (Justin3009)
;==================================================================================
; This file is used to import the code changes that separate all characters from one
; another so they can have individual stats instead of group stats.
;==================================================================================
; 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
;***************************
;***************************
; Sets game to FastROM (Have to find a way to make it load RAM as $80+)
;***************************
org $808000 ;Loads original code location that's loaded right when the game is started. (Loads a new location to foce the game as FastROM!)
;A ton of modification has to be done still. ALL RAM needs to load from $80+! There's a ton of PHA PLB commands in the ROM everywhere.
;Might be easier to do a mass replace in the ROM file with this.
{
JML $80FF75
REP #$20
SEP #$10
PHK
PLB
LDY #$80
STY $4301
SEP #$30
NOP
}
org $80FF75 ;Loads original code location that sets the game to start. (Updated so it sets the game to FastROM!)
{
SEI
CLC
XCE
REP #$30
LDX #$01FF
TXS
LDA #$0000
TCD
SEP #$20
LDA #$01 ;Load #$01
STA $420D ;Stores to $420D to initiate FastROM
LDA #$80
STA $2100
LDA #$00
STA $4200
STZ $420C
STZ $420B
LDA #$00
STA $7EFFFF
JML $808004
}
;org $80FFD5 ;Original offset location for "Header". (THIS WILL CAUSE IT TO ERROR AND NOT WORK WITH CX4 CHIP!)
{
;db $30 ;Sets header to display "FastROM"
}
;***************************
;***************************
; Fix pitching of Brass instrument
;***************************
org $8BCD3D
db $30 ;Changes the value from $20 to $30 to fix the out of tune Brass instrument.
;***************************
;***************************
; Changes wording for GAME START, PASSWORD, OPTION MODE
;***************************
{
org $868FE8 ;GAME START
db "New Game "
org $868FF7 ;PASS WORD
db "Load Game"
org $869004 ;OPTION MODE
db "Options "
org $869014 ;GAME START
db "New Game "
org $869023 ;PASS WORD
db "Load Game"
org $869030 ;OPTION MODE
db "Options "
org $869040 ;GAME START
db "New Game "
org $86904F ;PASS WORD
db "Load Game"
org $86905C ;OPTION MODE
db "Options "
}
;*********************************************************************************
;This section deals with handling each PC's health along with any "Heart Tank" code
;*********************************************************************************
{
org $80A1CB ;Original code location that sets PC's max health upon entering a level.
{
LDA #$FF
STA $09FF
}
org $8099B5 ;Original code here set PC's health upon selecting 'New Game'. Removed as this is already handled by the 'Heart Tank' routine.
{
NOP #5
}
org $8480C3 ;Altered the original code just slightly so it doesn't empty the PC check. It loads !CurrentPCCheck_1FFF and stores to !CurrentPC_0A8E.
{
LDA !CurrentPCCheck_1FFF
STA !CurrentPCShort_B6
JSL HeartTank ;Load brand new routine that determines each PC's max health based on how many heart tanks obtained.
}
org $8480D6 ;Sets each PC's Max Health to 'FF' upon entering a level so a non-active PC's life won't be blank when swapping out.
;This prevents the other PC's from causing a death upon switch since their max life will be determined as you swap with them.
;This code also sets the JumpDashFlag to 01 to allow the PC's air dash/jumping total be able to be set.
{
JSL SetLifeAndSwapHealth
NOP
}
org $809B7C ;Sets PC's max health upon entering a level.
{
JSL HeartTank ;Load the main Heart Tank routine to determine PC's max health.
}
org $8480C8 ;Set's PC max health after a cut-scene.
{
JSL HeartTank ;Load the main Heart Tank routine to determine PC's max health.
}
org $81E9D1 ;Loads code location that originally increased PC's max health when obtaining a Heart Tank.
;This is now based on difficulty. [Normal - Both PC's] [Hard - Only one PC]
{
JSL HeartTankGet ;Load routine to set PC's new max health upon obtaining a Heart Tank.
INC !CurrentHealth_09FF
}
org $81E968 ;Load code location that originally increased Heart Tank counter.
{
JSL HeartTankStore ;Load routine to increase the Heart Tank counter for each PC.
}
org $839058 ;Loads original code location that draws PC's health bar to screen.
{
JSL HealthDraw ;Load routine to draw PC's health on screen
LDA #$FF
STA $10
LDA #$09
STA $11
LDA !CurrentHealth_09FF
BMI PCHealth_Underflow
JMP $9194
PCHealth_Underflow:
AND #$7F
JSL HealthCompare ;Load routine to compare the PC's health to their current health on screen
BCC PCHealth_Over80
JSL HealthCMPStore ;Load routine to store PC's Max health to their current health if they have full health.
NOP #2
PCHealth_Over80:
}
org $81D830 ;Load code location to check for general PC healing (Large health)
{
NOP
JSL PCHealthGetCMP ;Load routine to determine if PC's health gets filled or not.
}
org $81D8D9 ;Load code location to check for general PC healing (Small health)
{
INC
JSL PCHealthGetCMP ;Load routine to compare PC's max health to what is in a temporary variable to determine if they can heal or not.
BCC PCHealth_StoreHP
LDA #$04 ;How much health to heal
STA $03
LDA $0004
PCHealth_StoreHP:
NOP #3
STA $09FF
}
org $84A9FC ;Loads original code location that compres PC's current health to their max health and determines whether PC's health can regenerate or whether a sub-tank can continue healing.
{
LDA $C1 ;Check if PC on ground or doing action
BNE DecPCHealthTimer
LDA #$00 ;Loads value of #$00 so there's nothing
STA !PCHealCounter_7EF4EA ;Store so PC Heal counter variable is #$00
INC $C1
REP #$20
LDA #$0135 ;Timer before health can be restored original
STA $BF
DecPCHealthTimer:
REP #$20
DEC $BF ;Timer before health can be restored original
BNE SkipDisplayHealing
LDA #$00B5 ;Timer before health can be restored
STA $BF
SEP #$20
LDA $27 ;Loads current PC health
JSL PCHealthGetCMP ;Load routine to compare PC's max health to what is in a temporary variable to determine if they can heal or not.
BPL ContinueToSubTanks
JSL PCIncreaseHealthCounter ;Load routine to increase PC's current health.
LDA !PCHealCounter_7EF4EA ;Load Heal Counter byte
ADC $27 ;Add PC's current health
STA $27 ;Store back to PC's current health
BRA DisplayHealingAndSound
ContinueToSubTanks:
JSL PCSubTankHealHealthChip ;Load routine to use the PC's Health Chip to heal current health.
BNE DisplayHealing
BRA SkipDisplayHealing
DisplayHealingAndSound:
LDA #$16
JSL !PlaySFX
DisplayHealing:
JSR $B6A7
SkipDisplayHealing:
SEP #$20
RTS
}
org $8385D2 ;Original code location that checks for any Heart Tanks obtained on stages in the "Stage Select" menu
{
PHA : PHX
LDA !Difficulty_7EF4E0
BIT #$01
BNE CheckStageSelectHeartTankSolo
LDA !XHeartTank_7EF41C
ORA !ZeroHeartTank_7EF44C
ORA !PC3HeartTank_7EF47C
ORA !PC4HeartTank_7EF4AC
STA $0000
StageSelectHeartTankCommon:
LDA $9C0C,x
TAX
LDA $0000
DEX
BIT !BasicBITTable,x
BNE StageSelectHeartTankEndRoutine
StageSelectHeartTankIncreaseEnd:
PLX : PLA
INC
RTS
StageSelectHeartTankEndRoutine:
PLX : PLA
RTS
CheckStageSelectHeartTankSolo:
STX $0002
LDA !CurrentPCCheck_1FFF
ASL #3
STA $0000
ASL
CLC
ADC $0000
TAX
LDA !XHeartTank_7EF41C,x
STA $0000
LDX $0002
BRA StageSelectHeartTankCommon
}
}
;***************************
;***************************
; Various enemy AI changes that remove the hardcoded collision damage that gets set in the AI.
;***************************
{
org $B99CD5 ;Original code location for Blast Hornet's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $83CB21 ;Original code location for Blizzard Buffalo's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $93F2F2 ;Original code location for Gravity Beetle's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $93E53F ;Original code location for Toxic Seahorse's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $93EAFF ;Original code location for Volt Catfish's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $83D0F5 ;Original code location for Crush Crawfish's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $BFE6A7 ;Original code location for Tunnel Rhino's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $93DD4E ;Original code location for Neon Tiger's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $93C65B ;Original code location for Press Disposer Mini-Boss's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $858E9C ;Original code location for Godkarmachine O Inary's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $B2F313 ;Original code location for Godkarmachine O Inary Parts?'s storage for collision damage.
NOP #4
; org $B2F331 ;Original code location for Godkarmachine O Inary's Hand #1 storage for collision damage.
; NOP #4
; org $B2F371 ;Original code location for Godkarmachine O Inary's Hand #2 storage for collision damage.
; NOP #4
org $8599C6 ;Original code location for Kaiser Sigma's Parts storage for collision damage.
NOP #4
org $878E78 ;Original code location for Kaiser Sigma's Parts storage for collision damage.
NOP #4
org $BCBF59 ;Original code location for Shurikein Mini-Boss's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $BCB391 ;Original code location for REX-2000 Mini-Boss's storage for collision damage.
NOP #4 ;Removed as a table handles this already
org $85A30C ;Original code location for Vile (Ride Armor) Mini-Boss's storage for collision damage.
NOP #4 ;Removed as a table handles this already
}
;***************************
;***************************
; Loads Zero's death scene at Dr. Cain's lab. (Removed as it's no longer needed)
;***************************
{
org $849340
NOP #12
org $8492AB
NOP #4
org $8492EA
NOP #4
org $849282
JSR $A63C
LDA #$7A
JSR $B8F4
NOP #14
}
;***************************
;***************************
; Plays SFX in menu when you decide to switch characters. (Loads same code but now sets $7E1F12 to 04 so the life bar is not on screen when menu closes)
;***************************
{
org $80C9FC ;Original code location that plays SFX when switching characters.
JSL PCSwapNoBar ;Loads routine that does the same thing but then disables the life bar as well so it does not appear on screen.
NOP #2
}
;***************************
;***************************
; Loads various code that prevented other PCs to use certain functions
;***************************
{
org $81D699 ;Prevents other PCs from collecting Heart Tanks and Energy Tanks.
NOP #5
org $93C151 ;Prevents other PCs from opening Dr. Light capsules.
NOP #5
org $93C23D ;Prevents other PCs from collectiong Dr. Light capsules.
NOP #5
org $81DA7C ;Prevents other PCs from collecting 1-ups.
NOP #5
org $80D632 ;Prevents other PCs from using sub-weapons.
NOP #12
org $84AFC6 ;Prevents other PCs from scrolling through sub-weapons on screen.
NOP #4
org $81D837 ;Prevents other PCs from filling up Energy Tanks/sub-weapons
NOP #10
org $80C8A3 ;Prevents other PCs from using Energy Tanks in the menu.
NOP #5
org $83D777 ;Prevents other PCs from using Ride Armor platforms.
NOP #5
org $839639 ;Prevents other PCs from using Ride Armors.
NOP #5
org $81EC2D ;Prevents other PCs from using Vile's factory teleporter.
NOP #5
org $84CD82 ;Prevents Zero from using Body Armor upgrade
NOP #5
}
;***************************
;***************************
; Sets new sprite assembly for small & large health capsules and changes VRAM refresh to load decompressed graphics from ROM instead.
; Small health capsule now uses a new Sprite Assembly as it's graphics have been shifted to make room for Zero's 1-up icon.
; General VRAM gets decompressed to VRAM at start of game, levels and when you leave the menu.
;***************************
;CA = FB
;CB = FC
;CC = FD
;CD = FE
;Changing Sprite Assembly of small health capsule
{
org $8DF1F4 ;Frame #1
{
db $02 ;How many chunks to draw
db $00,$F8,$FC,$FB ;Chunk #1
db $40,$00,$FC,$FB ;Chunk #2
}
org $8DF1FD ;Frame #2
{
db $02
db $40,$00,$FC,$FC ;Chunk #1
db $00,$F8,$FC,$FC ;Chunk #2
}
org $8DF206 ;Frame #3
{
db $02
db $40,$00,$FC,$FD ;Chunk #1
db $00,$F8,$FC,$FD ;Chunk #2
}
org $8DF20F ;Frame #4
{
db $02
db $40,$00,$FC,$FE ;Chunk #1
db $00,$F8,$FC,$FE ;Chunk #2
}
org $8DF1C1 ;Frame #1 of large health capsule
{
db $04
db $C0,$00,$00,$C3 ;Chunk #1
db $80,$F8,$00,$C3 ;Chunk #2
db $40,$00,$F8,$C3 ;Chunk #3
db $00,$F8,$F8,$C3 ;Chunk #4
}
;Compressed data being removed
{
org $86F3C3 ;Original pointer to general VRAM (Compressed) (Removed as now unused)
db $FF,$FF
org $86F4A5 ;Bytes to load general VRAM (Compressed) (Removed as now unused)
db $FF,$FF,$FF,$FF,$FF,$FF
org $86F764 ;Data to decompress general VRAM (Compressed) (Removed as now unused)
db $FF,$FF,$FF,$FF,$FF
}
org $80A2BA ;Loads general VRAM (Compressed) when starting game/loading levels.
JSL GeneralVRAMStorage
NOP
org $80CCD5 ;Loads general VRAM (Compressed) when leaving menu. (Changed to load decompressed graphics routine)
JSL GeneralVRAMLeaveMenu
NOP
}
;***************************
;***************************
; Some PC settings when entering a level
;***************************
{
org $8481CD ;Loads PC sprite setup upon game start or level start
JMP NewStartArmorLocation ;Now properly loads new location
org $84B5BB ;Stores 00 to Sprite Assembly on introduction (Maybe others?)
JSR $A63E ;Loads PC code that sets their Sprite Assembly and Armor settings
NewStartArmorLocation:
{
REP #$10
LDA !XArmorsByte1_7EF418
LSR
STA $0000
LDX #$0AE8
LDY #$0000
LoopSetPCArmor:
LSR $0000
BCC SkipSetPCArmor
INC $0000,x
STZ $000A,x
TYA
STA $000B,x
LDA #$5D
STA $0010,x
SkipSetPCArmor:
REP #$21
TXA
ADC #$0020
TAX
SEP #$20
INY
CPY #$0003
BNE LoopSetPCArmor
SEP #$30
RTS
}
}
;***************************
;***************************
; Removes excess code not needed for X or Zero
;***************************
{
org $93C5E9 ;Removes storage of #$80 to !CurrentHealth
NOP #5
}
;***************************
;***************************
; Set sprite priority of Ride Armors
;***************************
{
org $839432 ;Checks if you're using the F Ride Armor, if so, set the sprite priority to be ABOVE sprites, othewise, behind.
JSL SetJumpValues
JSL RideArmor_SpritePriorities
org $85C5F7 ;Sprite priority of junker maverick that holds Ride Armor in Blast Hornet's level
LDA #$00
org $8395EB ;Sprite priority of Ride Armor in Blast Hornet's level when you first retrieve it.
LDA #$02
}
;***************************
;***************************
; Set ladder coordinates
;***************************
{
org $849F3F ;Fixes PC's being way above ladder after they get off
ADC #$001C
}
;***************************
;***************************
; Ride Armor Pad alterations
;***************************
{
org $83D75C ;Now checks if you have ANY Ride Armor Chip instead of the first
LDA !RideChipsOrigin_7E1FD7
BEQ $25
NOP
org $83D8E3
NOP #5 ;Checks where you can move down on Ride Armor list. (Removed so you can move anytime)
org $83D8D0
NOP #5 ;Checks where you can move up on Ride Armor list. (Removed so you can move anytime)
org $83D8F6 ;Original code location that determines whether you can choose a ride armor or not on the pad.
{
JSL RideArmorSelect ;Loads routine that determines whether you can choose a ride armor or not on the pad.
NOP #4
BEQ SkipRideArmorEnd
BRA ContinueRideArmor
LDA #$0C
STA $03
ContinueRideArmor:
INC $02
INC $02
STZ $3A
LDA #$34
STA $35
LDA #$FF
STA $38
LDA #$00
STA $39
SkipRideArmorEnd:
JMP $D890
JMP $DAA4
}
}
;***************************
; Stores PC icon into VRAM when PC data is loaded whatsoever on screen.
;***************************
{
org $80A2C3
JSL PCIconBase
}
;***************************
; Removes original palette data pointers location and moves it to bank $C8
; Alters palette code so it has a larger bank usage instead of $86 as it's base.
; $C8:9823 is the base for all palette pointers.
;***************************
{
org $81806B
{
LDA #$8C ;Bank of where palettes are loaded
STA $16
STZ $01
REP #$20
TYX
LDA NewPaletteTable,x ;Loads from bank $C8
STA $10
NOP
SEP #$30
}
}
;*********************************************************************************
;Loads normal game routine but then after loads a new routine to blank out PC RAM area.
;*********************************************************************************
{
org $8080B0 ;Load routine to end clearing RAM routine at start of game
JSR $FA3F
org $80FA3F ;Jump to here to allow routine to finish
JSR $8590
JSL ClearPCRAM ;Load routine to clear PC RAM
RTS
}
;*********************************************************************************
; Sets PCs life when swapping characters in a level.
; Now does the same thing but also changes their icons and the PC as well.
;*********************************************************************************
org $848D6D ;Loads entire routine for swapping PCs in-game
{
LDX $03
JMP (PCSwap_EventPointers,x)
PCSwap_EventPointers:
dw PCSwap_Event00
dw PCSwap_Event02
dw PCSwap_Event04
dw PCSwap_Event06
PCSwap_Event00:
{
INC $03 : INC $03 ;Increases sub-event for PC's action
JSL PC1UpIcon_CheckAndDisable
INC !DisableMenuOpening_1F4F
INC !DisableLRSubWeaponScroll_1F45
LDA #$04 ;Sets PC life bar to invisible
STA !PCHealthBar_1F22
JSL $84D4BF ;Clears out all missiles from PC?
JSL $848E81 ;Disables all PC charges, current sub-weapon and sets teleport out SFX
JSR $B6D6 ;Loads PC's general palette in JSR location to JSL
LDA #$20
TRB $1F40 ;Removes bit for underwater physics on land for PC
INC !DisablePCCharging_0A54
INC $6E ;Disables something using RAM at 7E:0A46
INC !DisableEnemyProjectiles_1F26
INC !DisableEnemyAI_1F27
INC !DisableObjectAnimation_1F28
INC !DisableEnemyLoading_1F29
INC !DisableEnemyGraphics_1F2A
INC !DisableScreenScroll_1F2B
STZ $0A43 ;Blanks out damage timer so PC doesn't have graphical issues swapping when damaged
JSR $A63C ;Loads general sprite routine setup for PCs
LDA #$7F
JMP $B8F4
}
PCSwap_Event02:
{
JSR $B8FB
LDA $0F
BPL PCSwap_Event02_End
INC $03 : INC $03 ;Increase PC Action sub-event
STZ $0E
LDA #$1E ;Sets timer for how long it takes for PC to reappear once teleported out
STA $4E
JSL PCIconHealth ;Sets PC's life and icon when swapping inside a level then sets the new PC value.
PCSwap_Event02_End:
JSL PC1UpIcon_CheckAndDisable
RTS
}
PCSwap_Event04:
{
PHB
PHD
PHP
REP #$20
LDA #$0000
TCD
SEP #$20
JSL PC1UpMenuVRAMSetup
PLP
PLD
PLB
JSL PCGeneralSprite
JSL !AnimationOneFrame
DEC $4E ;Decreases timer until PC re-appears as new PC
BEQ PCSwap_Event04_ContinueEvent
RTS
PCSwap_Event04_ContinueEvent:
INC $03 : INC $03 ;Increase PC Action sub-event
INC !PCVisibility_09E6 ;Sets PC as invisible
JSL PC1UpIcon_CheckAndEnable
STZ !CurrentPCSubWeaponShort_33 ;Removes any sub-weapon PC has on
JSR $A63C ;Loads general sprite routine setup for PCs
JSR $B6D6 ;Loads PC's general palette in JSR location to JSL
JSR $B645 ;Sets PC's hitbox
LDA #$7E
JSR $B8F4
REP #$20
JSL PCSwap_TeleportHeight
SEP #$20
STZ $64 ;Stores 00 to 7E:0A3C
STZ !PCHealthBar_1F22
LDA #$10
JSL !PlaySFX
JSL PCBusterPalette ;Loads routine that sets the PC's sub-weapon/buster/Z-Saber palette depending on circumstance.
SEP #$30
RTS
}
PCSwap_Event06:
{
JSR $B8FB ;Loads VRAMRoutineAlt with a JSR to lead to a JSL
LDA $0F
BMI PCSwap_Event06_ContinueEvent
RTS
PCSwap_Event06_ContinueEvent:
DEC !DisablePCCharging_0A54
STZ $6E ;Disables something using RAM at 7E:0A46
STZ !DisableMenuOpening_1F4F
STZ !DisableLRSubWeaponScroll_1F45
STZ !DisableEnemyProjectiles_1F26
STZ !DisableEnemyAI_1F27
STZ !DisableObjectAnimation_1F28
STZ !DisableEnemyLoading_1F29
STZ !DisableEnemyGraphics_1F2A
STZ !DisableScreenScroll_1F2B
STZ $30 ;Stores 00 to 7E:0A08
LDA $5E ;Loads 7E:0A36 to determine if PC is in air or not (00 = Air, 04 = Ground)
BIT #$04
BEQ PCSwap_Event06_PCInAirEndEvent
JSL SetJumpValues
JMP $A6EA
PCSwap_Event06_PCInAirEndEvent:
JMP $A75B
}
}
;*********************************************************************************
; Sets command to NOT remove the #$80+ value on PC action command when PCs get paused
; THIS IS EXTREMELY EXPERIMENTAL
;*********************************************************************************
{
org $84D151 ;This removes a specific check to see if anything was above PC command #$54, if so, it'd FORCE animation reset instead of letting it resume.
NOP #4
}
;*********************************************************************************
; Routine to compare PC's max health to current health to determine if they use to their "low health" animation or not.
; Now checks each PC's max health separately incase of varying health.
;*********************************************************************************
{
org $84B104 ;Load code location that originally checked the PC's health to determine if they use their "low health" animation or not.
JSL PCLowHealthAni ;Load routine to check PC's health to determine if they do their low health animation or not.
;*********************************************************************************
NOP
}
;*********************************************************************************
; Loads PC's icon when jumping out of a Ride Armor and when opening/closing menu
;*********************************************************************************
{
org $83A253 ;Loads code location to set PC icon when jumping out of Ride Armor.
JSL PCIconRoutine ;Loads routine to set which icon PC will use when jumping out of a Ride Armor.
NOP #2
org $80D65B ;Loads original code location that set new sub-weapon when leaving menu if the sub-weapon you're changing too isn't what you had equipped.
JSL PC_Menu_ChangedSubWeapon
NOP
org $80D664
JSL PCIconRoutine ;Loads routine to set which icon PC will use when opening and closing menu.
;The whole routine checks first if you're on the introduction level and you're anyone other than X, if so, it'll reset you to be X. Otherwise, load proper PC Icon.
;THIS WILL HAVE TO BE UPDATED AS IT WILL BE POSSIBLE TO PLAY AS ZERO ON THE INTRODUCTION LEVEL. MAY NEED TO INCLUDE A NEW BYTE CHECK TO SKIP THE WHOLE PROCESS.
;*********************************************************************************
; Routine to store new sprite Ride Chip sprites into VRAM
; Routine to determine if you're able to swap to X or Zero depending on the level and Z-Saber circumstances.
; Now moved and has a separate table for each character to determine when they can switch.
; Now has a separate routine to determine the portraits of the characters you can swap too as well.
; Now can swap WITH Z-Saber if on New Game+ as long as the Z-Saber value is $E0+
; Now moves all menu commands to new location to allow adding new code to disable chips at will.
;*********************************************************************************
org $80CBB2 ;Routine to send Ride Chip sprites into VRAM. Then sets routine to determine if you can swap PCs or not. Also loads their portraits.
{
LDY #$AC ;Value to use to get where the data setup is for Ride Chip sprites
JSR !LoadDecompressedGraphics ;Decompressed graphics routine
LDY #$BA ;Value to use to get where the data setup is for Menu Armor sprites
JSR !LoadDecompressedGraphics ;Decompressed graphics routine
LDA !CurrentPCAction_09DA
CMP #$2C ;Check if PC action is inside Ride ArmoR
BEQ PCSwapping_PCCannotSwap
CMP #$76 ;Check if PC is teleporting already with character swap
BEQ PCSwapping_PCCannotSwap
JSL PCMenuSwap
BNE PCSwapping_PCCannotSwap
BIT $1F5D
BMI PCSwapping_PCCannotSwap
PCSwapping_PCCanSwap:
JSL PCMenuPortrait
BEQ PCSwapping_UseDecompression
JSR !LoadCompressedGraphics ;Compressed graphics routine
BRA PCSwapping_IgnoreStaticAndDisabling
PCSwapping_UseDecompression:
JSR !LoadDecompressedGraphics ;Decompressed graphics routine
BRA PCSwapping_IgnoreStaticAndDisabling
PCSwapping_PCCannotSwap:
LDA #$08 ;Sets #$08 so PCs CANNOT swap on menu
STA $1F11
LDY #$96 ;Loads compressed static graphics
JSR !LoadCompressedGraphics ;Compressed graphics routine
PCSwapping_IgnoreStaticAndDisabling:
}
org $80D035 ;Original code that checks for BIT being set for Mosquitus warning then sets Layer 1 priority.
;Changed so now it sets Layer 1 priority to what it should be and then sets the Layer 1 coordinates to #$8DFF so it appears on screen properly.
{
JSL MosquitusWarningSetLayerProperties
}
org $80C712 ;Original code location that loads pointers to each menu command.
{
JMP ($FA85,x)
}
org $80FA85 ;New code location that has all pointers to each menu command.
{
dw $C75E ;Sub-weapons
dw $C830 ;Sub-tanks
dw $C93F ;Exit
dw $C996 ;"R" button scrolling BG1
dw $C9EF ;Exchange PC screen
dw $CA3F ;Draw exchange text
dw $CA61 ;Finished exchange text
dw $C9C6 ;???
dw $CA2E ;Wait timer for Mosquitus warning
dw $CA3F ;Draw Mosquitus warning text
dw $CA61 ;Finished Misquitus warning text
;NEW
}
org $80CEB0 ;Load single byte data for moving in Main Menu setting which command does what.
{
db $0A ;Sub-weapons to sub-tanks
db $00 ;X-Buster
db $01 ;Sub-weapon #1
db $02 ;Sub-weapon #2
db $03 ;Sub-weapon #3
db $04 ;Sub-weapon #4
db $05 ;Sub-weapon #5
db $06 ;Sub-weapon #6
db $07 ;Sub-weapon #7
db $08 ;Sub-weapon #8
db $08 ;Hyper Chip?
db $FF ;0B
db $FF ;0C
db $FF ;0D
db $FF ;0E
db $FF ;0F
db $FF ;10
db $FF ;11
db $FF ;12
db $FF ;13
db $FF ;14
db $FF ;15
db $FF ;16
db $FF ;17
db $FF ;18
}
}
;*********************************************************************************
; Sets new X/Y coordinate for health bar in menu then loads new RAM locations for PC's max health.
; Also sets X/Y coordinates of lives counter and PC
;*********************************************************************************
org $80CC74 ;Loads original code location to load a JSR to get PC Health Bar in menu routine
{
JSL PCSHealthBar_InMenu ;Routine that loads X and Zero's Health Bars in the menu
NOP #4
}
org $80D521 ;Loads original code location for entire routine to load PC's health bar in the menu
{
PCHealthBar_LoopLoadHealth:
LDA $0004
BEQ PCHealthBar_Load11
CMP #$04
BCS PCHealthBar_SetSEC
STZ $0004
CLC
ADC #$11
BRA PCHealthBar_StoreMiddleGraphic
PCHealthBar_Load11:
LDA #$11
BRA PCHealthBar_StoreMiddleGraphic
PCHealthBar_SetSEC:
SEC
SBC #$04
STA $0004
LDA #$15 ;Filler graphic for PC health
PCHealthBar_StoreMiddleGraphic:
STA $0600,x
LDA $0007
STA $0601,x
INX #2
DEC $0002
BNE PCHealthBar_LoopLoadHealth
LDA $0000
BNE PCHealthBar_LoadDifferentEnd
LDA #$16 ;End graphic for PC Health (End Cap)
STA $0600,x
LDA $0007
STA $0601,x
BRA PCHealthBar_EndLoadINX
PCHealthBar_LoadDifferentEnd:
LDA #$17
CLC
ADC $0004
STA $0600,x
LDA $0007
STA $0601,x
PCHealthBar_EndLoadINX: