News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Final Fantasy Negative One character selection graphics  (Read 4770 times)

pinkpuff

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Final Fantasy Negative One character selection graphics
« on: September 22, 2013, 05:10:54 am »
My hack of FF1, Final Fantasy Negative One, is something I'm mostly satisfied with on a gameplay level but it is in need of a little polish.

Of particular concern is the character selection / party creation screen. FF -1 allows selection of 12 base jobs but no job change. When creating your party, the first six jobs appear normally, however the other six, while their job names appear correctly, their sprites appear either as a glitched up mess, or a messed up palette swap of a different job.

Normally I wouldn't be so concerned about it except that this is basically the first thing the player is exposed to, and if they haven't read any documentation, the messed up glitchy graphics they are presented with right off the bat is not a very good first impression. Even if they're fine throughout the rest of the game, I'm sure there are or will be people who will just simply be put off right away without giving it a chance, and I can't really blame them. If I stumbled across a hack somewhere and it looked like that first going off, I'd probably be quick to move along to something else myself.

I have no idea how to fix this or even go about looking for how to fix it and was hoping to be able to draw on some of the expertise that exists in this community. If having the graphics display correctly is not possible or not reasonable, then having no graphics at all (simply having it list the job names) would also be acceptable.

Thanks.
Let's dance!

Lenophis

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 959
  • The return of the sombrero!
    • View Profile
    • Slick Productions
Re: Final Fantasy Negative One character selection graphics
« Reply #1 on: September 22, 2013, 10:58:44 am »
Looking at Disch's assembly, this may be what you're looking for:
Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;  Load Battle Sprite CHR and Palettes  [$EAB9 :: 0x3EAC9]
;;
;;    Comes in 2 flavors.  The first loads all 6 class graphics and the cursor graphic
;;     This is used for the 'New Game' screen where you select your party
;;
;;    Next is the in-game flavor that loads 4 classes based on the characters in
;;     The party.  It also loads the cursor, as well as other in-battle sprites, such
;;     as those little magic and weapon animations, and the "fight cloud" that appears
;;     when you attack an enemy.
;;
;;    Both load all palettes used by battle sprites to $03Dx
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

LoadBatSprCHRPalettes_NewGame:
    LDA #BANK_BTLCHR
    JSR SwapPRG_L  ; Swap to bank 9
    LDA $2002      ; Reset PPU Addr Toggle
    LDA #$10
    STA $2006      ;  set dest PPU Addr to $1000
    LDA #$00
    STA $2006

    LDA #>lut_BatSprCHR    ;  set source pointer
    STA tmp+1
    LDA #<lut_BatSprCHR
    STA tmp

    LDX #2*6       ;  12 rows (2 rows per class * 6 classes)
    JSR CHRLoad    ; Load up the CHR
   
    LDA #>(lut_BatObjCHR + $400)  ; change source pointer to bottom half of cursor and related CHR
    STA tmp+1
    LDX #$04                      ; load 4 rows (bottom half)
    JMP :+                        ; skip ahead to the part of the next routine that loads cursor CHR

LoadBatSprCHRPalettes:
    LDA #BANK_BTLCHR
    JSR SwapPRG_L  ; swap to bank 9
    LDA $2002      ; reset ppu addr toggle
    LDA #$10
    STA $2006      ; set dest ppu addr to $1000
    LDA #$00
    STA $2006
    STA tmp           ; clear low byte of source pointer
    LDA ch_class      ; get character 1's class
    JSR @LoadClass    ;  load it
    LDA ch_class+$40  ; character 2's
    JSR @LoadClass
    LDA ch_class+$80  ; character 3's
    JSR @LoadClass
    LDA ch_class+$C0  ; character 4's
    JSR @LoadClass
    LDA #>lut_BatObjCHR  ; once all character's class graphics are loaded
    STA tmp+1            ;   change source pointer to $A800  (start of cursor and related battle CHR)
    LDX #$08             ; signal to load 8 rows

       ; above two routines both merge here
I believe what you want is the LDX #2*6, which is A2 0C at 0x3EAE3 in the rom. If you change the 0C to 18, you may get at least some of the results you want. I can't really test this myself at the moment, and I don't know if the palettes will load correctly with this change or not. Hopefully it helps.


https://ff6randomizer.codeplex.com/ - Randomize your FF6 experience!

Jeville

  • Sr. Member
  • ****
  • Posts: 357
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #2 on: September 22, 2013, 11:54:54 am »
I tested it (the OC to 18) and it doesn't do it. It only glitches the cursor sprite in the class selection screen.

Here's an easy method I know, but it's no good if you plan on using all 12 jobs. Download Tile Molester.



Scroll down until you see character, weapon, and magic sprites. In green is where you can insert the Knight sprites to display on the character selection screen, and so on. However, it will use up a magic sprite slot. So if you're planning on using all 12 jobs, this is going to be useless for overwriting too many magic animations.

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #3 on: September 22, 2013, 05:58:11 pm »
What about inserting a custom routine that switches the graphics that are displayed? The games does swap out the graphics at class change, there has to be a routine that handles that. Combined with the routines Lenophis mentioned there should be enough to work with to make it work correctly provided you find enough space for the new code.

pinkpuff

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #4 on: September 23, 2013, 06:37:37 am »
I'm at school at the moment so I can't test it right away, but thanks for the help; knowing where the routine is located is at least a start.

I guess what I would want ideally is to have it so that instead of loading the graphics for "all" six jobs and changing what graphics are being pointed to when you cycle through the jobs, it would instead only load the graphics for four jobs: the jobs currently being displayed corresponding to the currently selected job for each character, and each character would always point to the same "slot", but the graphics in that slot would be loaded instead of changing the pointer.

Not sure if I explained that very clearly but hopefully you get what I mean; if I have time later I'll try to explain a bit better.

Anyway if worst comes to worst I suppose I can just get it to load blanks instead of the character graphics... that should do the trick for not displaying them at all.

EDIT: Incidentally, I found the routine that handles the party creation screen in that disassembly that Lenophis linked to. It's in bank_0E.asm, but sadly the routine for loading sprites appears to be in bank_0F.asm, so I assume that means I can't just get it to load new graphics on a keypress... however I did manage to get it to stop displaying the character graphics altogether.

EDIT 2: The class change routine is in this bank though... Since such a thing never happens in this hack I wonder if that can be turned into something useful and called from the party generation routine?
« Last Edit: September 23, 2013, 04:05:37 pm by pinkpuff »
Let's dance!

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #5 on: September 23, 2013, 09:17:10 pm »
That may be a good idea. I wish my asm knowledge was robust enough to say for sure that it would work, but good luck. If this works it will definitely be a great addition to your hack.

Lenophis

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 959
  • The return of the sombrero!
    • View Profile
    • Slick Productions
Re: Final Fantasy Negative One character selection graphics
« Reply #6 on: September 24, 2013, 12:06:42 am »
I'm glad what I looked at was at least on the right track, somewhat. Hopefully you get this issue resolved quickly. :)
« Last Edit: September 24, 2013, 12:16:57 am by Lenophis »


https://ff6randomizer.codeplex.com/ - Randomize your FF6 experience!

Grond

  • Jr. Member
  • **
  • Posts: 21
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #7 on: September 25, 2013, 08:29:43 pm »
I made a hack to do this very thing several years ago, but it was pretty unoptimized and took up lots of ROM space. But oddly enough, I'm 100% certain that someone else (I forget who) made this same hack independently soon after and released it as a patch. But where this person's patch is now I don't know--I thought it was on this very site, yet it doesn't seem to be here any more... but I could be wrong about it being on rh.net. At any rate, I couldn't find it by Googling, either, so I dug up my own version and spent a little while optimizing it. I'll post it as raw hex--hopefully it works without problems.


enable all 12 classes at new game:
0x39d4c: 06 -> 0c

read 1 row of tiles instead of 2 when drawing class gfx:
0x39f87: 0a -> ea

insert jump to new subroutine...
0x3eae3-7: a2 0c 20 65 e9 -> 85 12 20 d0 ff

...to load 1 row of gfx tiles 12 times (alternating rows):
0x3ffe0-ef: ff...ff -> a2 01 20 65 e9 e6 11 e6 12 a5 12 c9 0c 90 f1 60


Jeville

  • Sr. Member
  • ****
  • Posts: 357
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #8 on: September 25, 2013, 11:19:43 pm »
It does work. :D

Vanya

  • Hero Member
  • *****
  • Posts: 1489
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #9 on: September 26, 2013, 12:13:28 am »
Sweet can't wait to try it myself.

EDIT: On a side note, what would it take to double the number of available spells? Is there enough free space for such a thing? Would the Magic Shop screens need to be modified too?
« Last Edit: September 26, 2013, 12:29:16 am by Vanya »

Lenophis

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 959
  • The return of the sombrero!
    • View Profile
    • Slick Productions
Re: Final Fantasy Negative One character selection graphics
« Reply #10 on: September 26, 2013, 02:09:42 am »
Now to explain what's actually going on...
Code: [Select]
enable all 12 classes at new game:
0x39d4c: 06 -> 0c
This is a CMP #$06 which is now CMP #$0C, obviously checking for a new threshold of 12 classes when cycling.

Code: [Select]
read 1 row of tiles instead of 2 when drawing class gfx:
0x39f87: 0a -> ea]
This is NOP'ing an ASL A, changing a multiplier from 32 to 16.

Code: [Select]
insert jump to new subroutine...
0x3eae3-7: a2 0c 20 65 e9 -> 85 12 20 d0 ff
This one should look familiar. It's LDX #$0C JSR $E965, the one in my first post. I find the STA curious though... This is what the code is being changed to:
Code: [Select]
STA $12
JSR $FFD0
What's curious is that the previous instruction before this STA is an STA tmp, tmp being a token in Disch's assembly, I'm going to guess the address is $12, meaning this is just storing A to $12 twice in a row. Two NOP's would serve the same use here. I haven't checked this, though, so I could very well be wrong.

Code: [Select]
...to load 1 row of gfx tiles 12 times (alternating rows):
0x3ffe0-ef: ff...ff -> a2 01 20 65 e9 e6 11 e6 12 a5 12 c9 0c 90 f1 60
That becomes:
Code: [Select]
LDX #$01
JSR $E965
INC $11
INC $12
LDA $12
CMP #$0C
BCC $FFD0
RTS
As the comment Grond says, it's drawing one row of tiles at a time.


https://ff6randomizer.codeplex.com/ - Randomize your FF6 experience!

pinkpuff

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Final Fantasy Negative One character selection graphics
« Reply #11 on: September 26, 2013, 05:20:01 am »
It turns out I fixed it in the meantime and my solution was basically the same idea.

I wasn't sure if fooling around with the LoadClass routine would mess up something else, like the actual battle sprites or something, so I looked for some code in that bank that I could cut, and found it in the form of the palette cycling (there was a surprising amount of code dedicated to that and all it did was slow the gameplay down). Essentially, killed two birds with one stone!

Anyway I made my own subroutine that was more or less a copy of LoadClass except it only loaded a single row of battle graphics, then called it for each job, resulting in the first row of all 12 jobs being loaded next to each other. I also modified the job rotating routine to only move by one row instead of two when changing jobs in the party creation menu, and that did the trick. It looks perfect now.

Huge thanks to everyone for their help! Ever since I began experimenting with the 12-job setup I was always disappointed that the character select graphics wouldn't work out of the gate, and I was always sad that I never had the skills to really deal with it myself, and was always apologizing for how it looked and how it was only that screen that looked bad. Now it looks great, and seamless! No more apologizing necessary. I'm still gonna give the game another once-over to clean up any other possible cosmetic / minor details and then release the new patch hopefully soon.
Let's dance!