Users browsing this thread: 1 Guest(s)
Random battle theme

#1
Posts: 3,966
Threads: 279
Thanks Received: 233
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
I've found where the song played during battle is set...

Code:
$C2/BD95: AD 4B 2F    LDA $2F4B        (Monster Aux. Byte 4)
$C2/BD98: 30 36       BMI $BDCD        (Branch if "No music" bit is set)
$C2/BD9A: EE ED E9    INC $E9ED  
$C2/BD9D: A9 10       LDA #$10    
$C2/BD9F: 8D 00 13    STA $1300  
$C2/BDA2: A9 FF       LDA #$FF         (Volume)
$C2/BDA4: 8D 02 13    STA $1302        (Save volume)
$C2/BDA7: AD 9D 62    LDA $629D  
$C2/BDAA: C9 FF       CMP #$FF        
$C2/BDAC: D0 11       BNE $BDBF    
$C2/BDAE: AD 4B 2F    LDA $2F4B        (Monster Aux. Byte 4)
$C2/BDB1: 29 38       AND #$38         (Isolate song)
$C2/BDB3: 4A          LSR A      
$C2/BDB4: 4A          LSR A      
$C2/BDB5: 4A          LSR A            (Get an index from 0 to 7)
$C2/BDB6: AA          TAX        
$C2/BDB7: BF 3B BF C2 LDA $C2BF3B,X    (Load song ID)
$C2/BDBB: C9 FF       CMP #$FF      
$C2/BDBD: F0 0E       BEQ $BDCD        (branch if we keep the current music playing)
$C2/BDBF: 8D 01 13    STA $1301        (save song ID)
$C2/BDC2: AD E4 11    LDA $11E4  
$C2/BDC5: 29 08       AND #$08                
$C2/BDC7: D0 04       BNE $04    
$C2/BDC9: 22 04 00 C5 JSL $C50004      (Play song)


Song index table

C2/BF3B: 24 (Battle Theme)
C2/BF3C: 14 (Boss Theme)      
C2/BF3D: 33 (Atma Weapon)
C2/BF3E: 2E (Returner)        
C2/BF3F: 1A (Factory)          
C2/BF40: 3B (Final)          
C2/BF41: FF (current 1)
C2/BF42: FF (current 2)


... and decided to put some randomness in the music selection:

Code:
$C2/BDBB: 20 69 64    JSR $6469
$C2/BDBE: EA          NOP

$C2/6469: C9 FF       CMP #$FF      
$C2/646B: F0 14       BEQ $6481        (branch if we keep the current music playing)
$C2/646D: C9 24       CMP #$24
$C2/646F: F0 02       BEQ $6473        
$C2/6471: 80 0D       BRA $6480        (Exit if not battle theme)
$C2/6473: 20 5A 4B    JSR $4B5A        (Random Number 0 to 255)
$C2/6476: C9 80       CMP #$80         (1 in 2 chance)
$C2/6478: B0 04       BCS $647E
$C2/647A: A9 13       LDA #$13         (Techno de Chocobo song ID)
$C2/647C: 80 02       BRA $6480        (Exit)
$C2/647E: A9 15       LDA #$15         (Johnny C. Bad song ID)
$C2/6480: 60          RTS
$C2/6481: 8B          PHB
$C2/6482: 4C CD BD    JMP $BDCD

With a similiar approach, you could have a selection of 3 or 4 battle theme and random boss themes as well. Quick demonstration: http://www.youtube.com/watch?v=lHPjHzJ_rFc
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • SSJ Rick (01-14-2014)

#2
Posts: 826
Threads: 11
Thanks Received: 22
Thanks Given: 13
Joined: Nov 2011
Reputation: 16
Status
Double
Neat idea! I wonder if this has been implemented in any games before (ones by developers, I mean).


Confused Moogles FTW
Quote  

#3
Posts: 3,966
Threads: 279
Thanks Received: 233
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(01-13-2014, 09:48 PM)Lockirby2 Wrote: Neat idea! I wonder if this has been implemented in any games before (ones by developers, I mean).

No game that I've heard of, but it's going in my hack!

On a side note, it seems "current music 1" and "current music 2" while having a different hex value in the formation data, have the same byte loaded (0xFF), which skips the song loading sequence. This mean by simply changing one of the two FF in the data table for a valid song index, you add a song choice for all formation that you can set in FF3usME.
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Gi Nattak (01-13-2014)

#4
Posts: 2,768
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
now this is really interesting

I haven't even thought about that

I think its an awesome idea


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#5
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
If and when I get back to CoV, this would be a great way to preserve the original feel and add something new at the same time, just be diversifying battle music. That's really cool.
  Find
Quote  

#6
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
(01-13-2014, 10:11 PM)Madsiur Wrote: On a side note, it seems "current music 1" and "current music 2" while having a different hex value in the formation data, have the same byte loaded (0xFF), which skips the song loading sequence. This mean by simply changing one of the two FF in the data table for a valid song index, you add a song choice for all formation that you can set in FF3usME.

I've noticed today that the current music 1 and 2 if changed to another song, for battles or whatever, does not continue on with the previous map song where it left off like the other battle songs in the table, it resets the map song after back to the start. This is no real big deal, but it is kinda annoying. I'm wondering maybe if there's something that can be done to make it act like the other songs in the table and continue on where the map song left off... Huh

I'd guess that if both the play current songs are connected by code that this wouldn't be easy to do, since one of them would need to remain the same I'd think.

Looks like this is where the magic happens:

C5/061F: 08 PHP
C5/0620: E220 SEP #$20
C5/0622: A500 LDA $00
C5/0624: C914 CMP #$14
C5/0626: B010 BCS $0638
C5/0628: A20000 LDX #$0000
C5/062B: BFF906C5 LDA $C506F9,X (Song indexes which need the current song to be paused then resumed)
C5/062F: 300D BMI $063E (branch if song is not on list?)
C5/0631: C501 CMP $01
C5/0633: F003 BEQ $0638 (branch if song on list matched?)
C5/0635: E8 INX
C5/0636: 80F3 BRA $062B (loop for all songs?)
C5/0638: A904 LDA #$04
C5/063A: 0500 ORA $00
C5/063C: 8500 STA $00
C5/063E: 28 PLP
C5/063F: 60 RTS

Data: Song indexes which need the current song to be paused then resumed - Evil Peer


C5/06F9: 24 (Battle, from C5/062B)
C5/06FA: 38 (Nighty Night)
C5/06FB: 14 (Decisive battle)
C5/06FC: 33 (Fierce battle)
C5/06FD: FF (Silence?)

I've tried moving and expanding the list, but that doesn't seem to be working like I thought it would... I must be missing something.


We are born, live, die and then do the same thing over again.
Quote  

#7
Posts: 311
Threads: 20
Thanks Received: 0
Thanks Given: 0
Joined: Dec 2017
Reputation: 2
Status
None
I stumbled across this thread the other day, and thought about potentially diving in to the world of importing music... It would be really awesome to have a few random battle themes in my hack. However, I am concerned about how much space there is in an unexpanded ROM for fitting new tracks. My guess is that you can't fit very much... Is it even possible to fit a few additional songs to an unexpanded ROM, or have others experienced the need to replace other songs? I am guessing there isn't enough bytes, but I could be wrong. I did read the music FAQ, and I understand where the locations are for free bytes, but I don't know how many songs (if any) that might translate in to.
  Find
Quote  

#8
Posts: 2,548
Threads: 98
Thanks Received: 147
Thanks Given: 156
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Usually custom made songs are going to be larger than the originals, unless of course, they are not. Song data can normally never be more than $1000 bytes though normally, or else they will glitch out upon sound effects. The only way to know if you can fit in songs into the free space areas listed here: https://www.ff6hacking.com/wiki/doku.php...2Aspace%2A

is to go in and do it and see how much it takes up, or have 2 hex editors open so you can tell before hand, instead of guessing how much it is lol.. It /would/ have been a good idea actually I now realize to say in the song hack downloads how many bytes each song takes. Song data can take up a bunch of space rather quickly once they start dropping in, and a non-expanded ROM with the vanilla free space can't hold that many, so if you were planning on adding a bunch of songs to your hack I'd recommend going to 4MB, there's no reason not to really only good things can come from it. Smile


We are born, live, die and then do the same thing over again.
Quote  

#9
Posts: 311
Threads: 20
Thanks Received: 0
Thanks Given: 0
Joined: Dec 2017
Reputation: 2
Status
None
(10-13-2018, 01:58 PM)Gi Nattak Wrote: Usually custom made songs are going to be larger than the originals, unless of course, they are not. Song data can normally never be more than $1000 bytes though normally, or else they will glitch out upon sound effects. The only way to know if you can fit in songs into the free space areas listed here: https://www.ff6hacking.com/wiki/doku.php...2Aspace%2A

is to go in and do it and see how much it takes up, or have 2 hex editors open so you can tell before hand, instead of guessing how much it is lol.. It /would/ have been a good idea actually I now realize to say in the song hack downloads how many bytes each song takes. Song data can take up a bunch of space rather quickly once they start dropping in, and a non-expanded ROM with the vanilla free space can't hold that many, so if you were planning on adding a bunch of songs to your hack I'd recommend going to 4MB, there's no reason not to really only good things can come from it. Smile

Well, the reason I have not expanded the ROM is out of fear it will no longer work on real hardware.

Also, I just now read your final post in this thread (before I bumped it) about the world music not continuing where it left off after a battle.  This is actually a pretty bad side effect, so I think I might forget the random battle theme plan.  Gi, would it be an easy task to have the battle music change in the WOR like what you did with Leo and the Colosseum music?  I was thinking of just having two battle themes instead of a bunch of random ones...
  Find
Quote  

#10
Posts: 3,966
Threads: 279
Thanks Received: 233
Thanks Given: 56
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(10-13-2018, 02:15 PM)Lightning Wrote: Well, the reason I have not expanded the ROM is out of fear it will no longer work on real hardware.

Well there are a bunch of 32Mb ROMs on the SNES as well as even 48Mb ROMs.

(10-13-2018, 02:15 PM)Lightning Wrote: Also, I just now read your final post in this thread (before I bumped it) about the world music not continuing where it left off after a battle.  This is actually a pretty bad side effect, so I think I might forget the random battle theme plan.

This is not what my hack is doing. The World map music not continuing where it stopped has to do with using one of the two "current music" bytes while the original post branch based on the battle music byte. Adding a branch based on the WoR event bit would be possible.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite