Difference between revisions of "Change Default Battle Theme (Map Flag)"
(Created page with "==General Information== ===Chrono Trigger=== ''Thanks to PowerPanda'' What makes this possible: Chrono Trigger does something rather odd in its code. Rather than direct-ref...") |
(No difference)
|
Revision as of 00:09, 22 November 2022
General Information
Chrono Trigger
Thanks to PowerPanda
What makes this possible: Chrono Trigger does something rather odd in its code. Rather than direct-referencing the ROM for what the random battle theme is, it instead loads the theme's Index # into a RAM Byte (7E/01FA), and refreshes this value on every map load.
I have taken advantage of that and put in a hook that checks the Map Index # against a lookup table, allowing you to define a different random battle theme on a map-by-map basis. While many of the maps in the game do not have any random battles, they are included anyway to make this ASM compatible with any future romhack.
At C0/0C58 (00x0C58), the following code is in the base rom: A9 45 LDA #$45 ;Load song $45 - Battle 1 85 FA STA 7E/01FA ;Write song to the "current battle theme" RAM byte
You will want to replace those 4 bytes with the following: 22 ?? ?? ?? JSL !freespace ;Jump to the new subroutine
Then, in the freespace area, add this code: !freespace DA PHX Store the old X value, to be safe AE 00 01 LDX $7E/0100 Load the current map number to X BF ?? ?? ?? LDA,X !battletable Look up map's battle theme in the battle table 85 FA STA $7E/01FA Save "Current battle theme" FA PLX Retrieve the old X value 6B RTL Return
!battletable [This table consists of $200 bytes, one corresponding to each map)</pre>
From: Modification