øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1672.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index609b-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=8.220e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index609b-2.html.zx¼&h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈà•¤æËOKtext/htmlISO-8859-1gzip@øÕæËÿÿÿÿÿÿÿÿWed, 11 Mar 2020 00:02:28 GMT0ó°° ®0®P®€§²ð®»&h^ÿÿÿÿÿÿÿÿç"æË Monsters graphics relocalization

Author Topic: Monsters graphics relocalization  (Read 2509 times)

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Monsters graphics relocalization
« on: November 01, 2011, 09:22:06 PM »
Hi everyone,

I've been learning rom hacking in general in the past few weeks. When it comes to changing monster sprites, FF3SE is a great tool. Sadly, there is not much empty space for new monster sprites.

So I decided to move the monsters graphics to the empty F1 bank of a expanded rom. I changed the value of what I think is the starting offset of monsters graphics (at C1/210F, C1/2115 and C1/211B) in what I think is the corresponding subroutine that load a monster graphic. (I might be totally offtrack...)

I have two questions:

1) Do I have to change the location of the Monster 8-High Composition Data and 16-High Composition Data as well or the unused 220 byte (starting at D2B424) would be used if I add more sprites via FF3SE?

I downloaded the source code of FF3SE and changed the value of the variable "offset" in the respective loading and saving functions. I also increased the value of the variable "maxTileNumber" so that way I could have more space for monster sprites in the editor. The code however doesn't compile. I have an error saying some header file is missing (png.h I think).
I sent a email to the creator of the editor but I haven't receive an answer(yet).

2) Have anyone ever tried that process? If so, am I on the right track or am I missing some steps? :hmm:

I've been studying programming since last year but never learned C++ (the language FF3SE is coded in) specifically. As for assembly, I'm learning but I don't know enough to understand every line of the subroutines that loads the monster graphic, mold, composition data, x and y position. Is it a harder process than I think to move the monsters graphics and being able to use FF3SE after that?

I hope someone can help, this site has been a good ressource for answering my questions so far.

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: Monsters graphics relocalization
« Reply #1 on: November 01, 2011, 09:45:39 PM »

So I decided to move the monsters graphics to the empty F1 bank of a expanded rom. I changed the value of what I think is the starting offset of monsters graphics (at C1/210F, C1/2115 and C1/211B) in what I think is the corresponding subroutine that load a monster graphic. (I might be totally offtrack...)

 :isuck:

I just checked and since  the monster graphics in game doesn't load properly (I have part of the graphics of a soldier instead of a guard), I don't really feel more ashamed of myself by quoting myself. These are the changes I made in the F1 bank:

Code: [Select]
C1/210E: 69 00        ADC #$00
C1/2110: 85 64        STA $64
C1/2112: A5 65        LDA $65
C1/2114: 69 70        ADC #$00
C1/2116: 85 65        STA $65
C1/2118: A5 66        LDA $66
C1/211A: 69 E9        ADC #$F1

 I have no clue what's wrong because I see part of the graphics of enemy 002 instead of enemy 001 in the first fight of the game...

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: Monsters graphics relocalization
« Reply #2 on: November 02, 2011, 10:25:34 AM »
your code change looks fine.

see http://www.angelfire.com/pq/jumparound/index.html

for ROM mapping (albeit somewhat outdated), and links to information on various pieces of the ROM.  in particular, read:

http://www.angelfire.com/pq/jumparound/FF6docs/FF3usMonstBmTmp.txt

and the 3 text files it mentions.

Quote from: Madsiur
1) Do I have to change the location of the Monster 8-High Composition Data and 16-High Composition Data as well or the unused 220 byte (starting at D2B424) would be used if I add more sprites via FF3SE?

assuming Lord J is right about there being stencil data for 128 smaller monsters (8 bytes each) and 48 larger monsters (32 bytes each), then D2B424 - D2B4FF should be unused and available (for use of larger monsters).

my best guess as to your graphics glitches is that in your monster bitmap template, you forgot to set the bit indicating the monster uses an 8-color bitmap (versus a 16-color one), which causes the game to read 32 bytes per monster tile, when it should only be reading 24.

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: Monsters graphics relocalization
« Reply #3 on: November 02, 2011, 11:19:24 AM »
Thanks for those infos!


my best guess as to your graphics glitches is that in your monster bitmap template, you forgot to set the bit indicating the monster uses an 8-color bitmap (versus a 16-color one), which causes the game to read 32 bytes per monster tile, when it should only be reading 24.


That could be an explanation but I was thinking before going to bed yesterday that I might just be off by 200 bytes because of the header, that's why I see part of monster 002 instead of 001...I'll so some experimentations after work but I'm not far from the solution.

The only thing left would be making FF3SE code compile properly but if some file(s) are missing from the source code, I don't think I'll be able to code header file(s) for the editor in C++.

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: Monsters graphics relocalization
« Reply #4 on: November 02, 2011, 11:42:16 AM »
i find three instances of "0x297200" in the source code for the utility.  i find three matches for a hex search of "00 72 29" in the compiled ff3se.exe.  hopefully, that's no coincidence.

try hex-editing all 3 to become: 00 02 31
instead, and see what happens (but back up the file first).

 :edit: for address typo
« Last Edit: November 02, 2011, 01:18:39 PM by assassin »

Lenophis

  • Forum Overlord
  • *
  • Posts: 1,688
  • Gender: Male
  • I sad
    • View Profile
    • Slick Productions
Re: Monsters graphics relocalization
« Reply #5 on: November 02, 2011, 12:15:07 PM »
If you set is as a HiROM address like that, it should crash out (is that what you're going for, assassin?).

119 bugs fixed and counting.

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: Monsters graphics relocalization
« Reply #6 on: November 02, 2011, 01:17:44 PM »
oops, no.  fixed.

Madsiur

  • Tunnel Armor
  • *
  • Posts: 149
  • Gender: Male
  • FF6AE coder
    • View Profile
    • Madsiur's Lair
Re: Monsters graphics relocalization
« Reply #7 on: November 10, 2011, 12:51:42 AM »
Thanks for the help Assasin (and Lenophis). In the end I've been able to relocalize the monsters graphics and composition data in the F2 and F1 bank respectively. I've been able to incresed by $10000 bytes the free space for monster and esper sprites with an edited FF3se:



It looks nice but sadly there is something wrong when I save the sprites that have been imported after the firsts  $1F00 bytes of free space (approximately). Their sprite simply dissapear even though I have no error message. Here's the new location of the data followed by the changes I made to FF3se using an hex editor. My descriptions might be a bit off as I am not an assembly or C++ specialist:

New locations:

31AA20   31AA21   PTR      Pointer to 8-High Monster Composition Data   
31AA22   31AA23   PTR      Pointer to 16-High Monster Composition Data   
31AA24   31AE23   DATA   Monster 8-High Composition Data
31AE24   31B423   DATA   Monster 16-High Composition Data
320000   3571FF   GFX      Monster Graphics

Changes made to FF3se (all values were taken from the source file monsters.cpp):

0A0F1      C0 73 03      C0 73 04            value of the constant maxTileSize in the constructor Monsters + $10000 bytes (from $373C0 bytes to $473C0 bytes).
0A0FE      DC 0A           08 14            value of the constant maxMoldSize in the constructor Monsters almost doubled (from $ADC bytes to $1408 bytes).
0A46B      00 72 29      00 02 32            Offset of the start of the monster graphics in the function loadMonsGraphics.(from $297200 to $320200)
0A50B      00 B5 12      23 BE 31            Value of the variable address3 in the function loadMonsMold. (from $12B500 to $31BE23)
0A512      20 AA 12      20 AA 31            Offset of the 8-high monster specification pointer in the function loadMonsMold.(from $12AA20 to $31AA20)
0A53D      00 00 D2      00 00 F1            Value added to the parameter of the variable address1 in the function loadMonsMold. (from $D20000 to $F10000)
0A568      00 00 D2      00 00 F1            Value added to the parameter of the variable address2 in the function loadMonsMold. (from $D20000 to $F10000)
0B0CE      20 AA 12      20 AA 31            Offset of the 8-high monster specification pointer in the function saveMolds. (from $12AA20 to $31AA20)
0B0F9      24 AA 12      24 AA 31            Offset of the start of monster specification data in the function saveMolds. (from $12AA24 to $31AA24)
0B1BC      00 02 12      00 02 31            Value substracted to the variable address in the function saveMolds. (from $120200 to $310200)
0B1C7      22 AA 12      22 AA 31            Offset of the 16-high monster specification pointer in the function saveMolds. (from $12AA22 to $31AA22)
0B1F6      00 02 12      00 02 31           Parameter of the last lseek in the function saveMolds. (from $120200 to $ 310200)
0B548      00 72 29      00 02 32            Offset of the start of the monster graphics in the function saveTile.(from $297200 to $320200) ***first instance***
0B59B      00 72 29      00 02 32            Offset of the start of the monster graphics in the function saveTile.(from $297200 to $320200) ***second instance***

If anyone ever done something similar and might know what I missed or did wrong, he would be of a great help for me, as I almost gave up on that project... :sad:
« Last Edit: November 10, 2011, 01:15:15 AM by Madsiur »