Author Topic: Battle Background Loading Code  (Read 2326 times)

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Battle Background Loading Code
« on: July 07, 2008, 02:19:47 AM »
Does anyone know the location of the code that loads the battle backgrounds? I'm trying to change a few of the maps for my hack, and have realized that the battle background is determined by map number, not tileset. Anyone know anything?

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Battle Background Loading Code
« Reply #1 on: July 07, 2008, 02:30:37 AM »
I'm trying to change a few of the maps for my hack, and have realized that the battle background is determined by map number, not tileset.
That seems odd, because in dungeons the background changes based on the tile you're on. (Cave to water, for example). Are you referring to strictly world maps or are you including everything?

119 bugs fixed and counting.

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: Battle Background Loading Code
« Reply #2 on: July 07, 2008, 03:05:14 AM »
Quote
That seems odd, because in dungeons the background changes based on the tile you're on.

That's what I thought, but I changed one of the location map tile sets, and it would only load the green overworld grass background. It was one of the unused maps, which might be the problem, but I thought I'd take a look at the code and see what was happening. I'll try a few more test cases eventually and see if I can work it out -- I only did just the one test because I was curious, but for now I'm trying to finish up the overworld map changes. I'll post here when I find out what the problem was.

Phoenix

  • FF4 Hacker
  • *
  • Posts: 456
    • View Profile
    • Phoenix Hacks
Re: Battle Background Loading Code
« Reply #3 on: July 07, 2009, 06:49:37 AM »
As I posted in the thread on Metallic Properties, it turns out Yousei's data was one byte off for location properties. So, the location properties actually start at A8E84, and battle backgrounds are determined within the data, like so:

Code: [Select]
00: Battle/Spell Properties
bits 0-3: Battle Background
0: Grass 8: Magnes/Sealed Cave
1: Forest 9: Desert
2: Mountain A: Beach
3: Castle B: Land of Monsters/Sylphs
4: Cave C: Tower of Zot
5: Moon D: Lunar Subterrane
6: Ship E: Crystal Room
7: Water F: Underground
bit 4: Warp can be cast
bit 5: Exit can be cast
bit 6: Use alternate palette if available (backgrounds 0, 4, 7, 8, B, C)
bit 7: Battles have magnetic effect if event flag E1 is set

Another mystery solved.

:edit:
Did some testing and revised the bits list.

:edit:
Found the missing bits.
« Last Edit: July 14, 2009, 03:55:12 AM by Phoenix »

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Battle Background Loading Code
« Reply #4 on: July 07, 2009, 07:25:13 AM »
Cool.