• Welcome to Final Fantasy Hacktics. Please login or sign up.
 

Status Effect Text

Started by BigManStan, April 19, 2016, 08:06:18 pm

BigManStan

Hi all,

I was watching some Jot5 playthrough videos and saw a few neat things, such as the 'Defending' text when a character goes into Defend status, as well as new 'Doom' text instead of Death Sentence.

I was interested in implementing my own new status in place of Wall with status text to display.  I was wondering if any of you could point me in the correct direction for making this display work.  It looks like the text is stored in FRAME.BIN...but is there any area in the code responsible for loading particular slices out of FRAME.BIN?  Did you Jot5 devs need to free up space in FRAME.BIN or is there unused areas in there that one could store new text?

3lric

http://ffhacktics.com/wiki/EVENT/FRAME.BIN

We just changed Death Sentence to Doom and something else to Defending.
  • Modding version: PSX

Choto

I don't think anybody's found the code for loading different parts of Frame.bin (maybe secondadvent?). However, if you look at 0xb7308 (referred to as misc. unit data), at offset 0x346 I think... there are a several sections for sprite display. These sections handle things like items a unit holds up, status bubbles, I think status text, the main sprite, weapon sprites. So you could maybe set a breakpoint in that section and backtrack to find where it refers to the VRAM or spritesheet load locations.

Lots of work and Frame.bin is already pretty packed unfortunately.

BigManStan

Ok gotcha, I get how the Death Sentence -> Doom change would just be a swap in FRAME.BIN.  But when you 'changed something else to Defending', then how did you get the game to display the new 'Defending' text from FRAME.BIN when a unit goes into Defend?  AFAIK there is no text displayed when a unit Defends, so there's more at play here.

BigManStan

April 20, 2016, 08:06:41 pm #4 Last Edit: April 21, 2016, 03:12:28 pm by BigManStan
I am getting closer to figuring it out. 

This looks promising:

8014cf68 - Status Image Data (4 bytes each, 0xc4 total)
      0x00 - X Load Location
      0x01 - Y Load Location
      0x02 - Image Width
      0x03 - Image Height

      0x00 - "Dead"
      0x04 - "Undead"
      0x08 - "Petrify"
      0x0c - "Invite"
      0x10 - "Darkness"
      0x14 - "Confusion"
      0x18 - "Silence"
      0x1c - "Blood Suck"
      0x20 - "Oil"
      0x24 - "Float"
      0x28 - "Reraise"
      0x2c - "Transparent"
      0x30 - "Berserk"
      0x34 - "Poison"
      0x38 - "Regen"
      0x3c - "Protect"
      0x40 - "Shell"
      0x44 - "Haste"
      0x48 - "Slow"
      0x4c - "Stop"
      0x50 - "Faith"
      0x54 - "Innocent"
      0x58 - "Charm"
      0x5c - "Sleep"
      0x60 - "Don't Move"
      0x64 - "Don't Act"
      0x68 - "Reflect"
      0x6c - "Death Sentence"
      0x70 - "Stolen"
      0x74 - "Broken"
      0x78 - (these 6 are unused)
      0x7c -
      0x80 -
      0x84 -
      0x88 -
      0x8c -
      0x90 - "Quick"
      0x94 - "HP"
      0x98 - "MP"
      0x9c - "CT"
      0xa0 - "Speed"
      0xa4 - "Brave"
      0xa8 - "Faith"
      0xac - Sword Icon (PA)
      0xb0 - Rod Icon (MA)
      0xb4 - "Lv."
      0xb8 - "GIL"
      0xbc - "Exp."
      0xc0 - "Frog"


In battle, these seem to correspond to locations in FRAME.BIN.  The offsets in game memory correspond to those on the FRAME.BIN if I just rip the image off of the wiki:

x offset in memory = bitmap x-offset x2
y-offset in memory is more tricky.  I think for status images (ie not HP, MP,...) the top corner pixel of 'Poison' in FRAME.BIN corresponds to (0,0), so the y offset uses that as zero.

Edit:  Ignore the stuff about y-offset.  I'll post back when I actually have this all figured out.

BigManStan

April 26, 2016, 02:28:01 am #5 Last Edit: April 27, 2016, 07:58:15 pm by BigManStan
Ok, (if anyone cares), I've figured out how to manage status text images.


For displaying status images in the pre-attack display (targeting), there is a table that is to my knowledge undocumented, that relates all inflicted statuses to a position in the already documented Status Image Data table:

Status Image Table (ALREADY DOCUMENTED)

8014cf68 - Status Image Data (4 bytes each, 0xc4 total)

0x00 - X Load Location
0x01 - Y Load Location
0x02 - Image Width
0x03 - Image Height




















































PositionOffsetImage Data
00x00"Dead"
10x04"Undead"
20x08"Petrify"
30x0c"Invite"
40x10"Darkness"
50x14"Confusion"
60x18"Silence"
70x1c"Blood Suck"
80x20"Oil"
90x24"Float"
A0x28"Reraise"
B0x2c"Transparent"
C0x30"Berserk"
D0x34"Poison"
E0x38"Regen"
F0x3c"Protect"
100x40"Shell"
110x44"Haste"
120x48"Slow"
130x4c"Stop"
140x50"Faith"
150x54"Innocent"
160x58"Charm"
170x5c"Sleep"   
180x60"Don't Move"
190x64"Don't Act"
1A0x68"Reflect"
1B0x6c"Death Sentence"
1C0x70"Stolen"
1D0x74"Broken"
1E0x78*Unused*
1F0x7c*Unused*
200x80*Unused*
210x84*Unused*
220x88*Unused*
230x8c*Unused*
240x90"Quick"
250x94"HP"
260x98"MP"
270x9c"CT"
280xa0"Speed"
290xa4"Brave"
2A0xa8"Faith"
2B0xacSword Icon (PA)
2C0xb0Rod Icon (MA)
2D0xb4"Lv."
2E0xb8"GIL"
2F0xbc"Exp."
300xc0"Frog"



Status link table, pre-attack display (UNDOCUMENTED)

RAM:  0x167920
BATTLE.BIN:  0x100920

Image data position 0xFF = No display (charging, jump, etc...)

Entry length: 1 byte each
Total length: 0x30 bytes

The undocumented table relates all inflictable statuses to the image data.  The statuses are organized by their order in the status bytes that appear in Battle Status data (and often elsewhere)











































PositionStatusPosition in Image Data Table
0Blank0xFF
1Crystal0xFF
2Dead0x00
3Undead0x01
4Charging0xFF
5Jump0xFF
6Defending0xFF
7Performing0xFF
8Petrify0x02
9Invite0x03
ADarkness0x04
BConfusion0x05
CSilence0x06
DBlood Suck0x07
ECursed0xFF
FTreasure0xFF
10Oil0x08
11Float0x09
12Reraise0x0A
13Transparent0x0B
14Berserk0x0C
15Chicken0xFF
16Frog0x30
17Critical0xFF
18Poison0x0D
19Regen0x0E
1AProtect0x0F
1BShell0x10
1CHaste0x11
1DSlow0x12
1EStop0x13
1FWall0xFF
20Faith0x14
21Innocent0x15
22Charm0x16
23Sleep0x17
24Don't Move0x18
25Don't Act0x19
26Reflect0x1A
27Death Sentence0x1B




The undocumented table is very similar to the next table.  It relates all inflictable status to image data, but for post-action display on units affected by the status.

This table is documented, but wasn't 100% explained.

Status link table, post-attack display (PARTIALLY DOCUMENTED)

RAM:  0x93D18
BATTLE.BIN:  0x2CD18

Image data position 0x00 = No display (charging, jump, etc...)

Entry length: 1 byte each
Total length: 0x30 bytes

This table relates all inflictable statuses to the image data.  The statuses are organized by their order in the status bytes that appear in Battle Status data (and often elsewhere)











































PositionStatusPosition in Image Data Table
0Blank0x00
1Crystal0x00
2Dead0x00
3Undead0x01
4Charging0x00
5Jump0x00
6Defending0x00
7Performing0x00
8Petrify0x02
9Invite0x03
ADarkness0x04
BConfusion0x05
CSilence0x06
DBlood Suck0x07
ECursed0x00
FTreasure0x00
10Oil0x08
11Float0x09
12Reraise0x0A
13Transparent0x0B
14Berserk0x0C
15Chicken0x00
16Frog0x00
17Critical0x00
18Poison0x0D
19Regen0x0E
1AProtect0x0F
1BShell0x10
1CHaste0x11
1DSlow0x12
1EStop0x13
1FWall0x00
20Faith0x14
21Innocent0x15
22Charm0x16
23Sleep0x17
24Don't Move0x18
25Don't Act0x19
26Reflect0x1A
27Death Sentence0x1B




So by using these tables one can dictate what images a given status will display pre and post-attack. 

Some of the justifications for using 2 different tables can be seen by examining the data, such as the 'Dead' status being displayed pre-attack, but not shown post-attack, as the unit falling to the ground is indication enough that it's dead!



EXAMPLE:

The game doesn't display the 'Frog' text when the status hits. (I never noticed until working on this)  To get it to display, change the byte in the post attack table from 0x00 to the Frog image ID, 0x30.

Frog Text On-Hit Display Hack

<Patch name="Frog Text On-Hit Display">
    <Description>
      Display "Frog" text image when a unit receives or loses Frog status.
   </Description>
   
    <Location file="BATTLE_BIN" offset="2CD2E">
      30
    </Location>
   
  </Patch>


Similarly, one can co-opt the Wall or Blank display status to display text by activating its bytes in both display link tables.  To get it to display something new, set the Wall bytes to one of the Unused image IDs (0x1E-0x23), then edit that image ID's data to point to an edited section of FRAME.BIN of your choosing.  (Coming Soon)

Xifanie

Nice job!
And no, I care; it's refreshing to see someone else than me discover stuff again. :p
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

BigManStan

Thanks, Xifanie! :)  I figured out how to edit FRAME.BIN, so:

Putting it all together...

In order to generate some value, I tried to demo this against some stuff that is already in the community.  I saw that Emmy and Pride have a 'Mist' hack that uses the Wall status, and that it is in use in the Monster Tactics mod.  So as proof of concept I want to make the 'Mist' status also display 'Mist' text images.


1)  Editing FRAME.BIN:

- http://ffhacktics.com/smf/index.php?topic=9584.msg186581#msg186581  ->  This, this, this is the thread with accurate instructions on how to edit FRAME.BIN.  A lot of fruitless searching finally led me to this page.

As per the previous posts, I am going to have one of the unused image data sections point at my new 'Mist' image in my modified FRAME.BIN.  Instructions on how to get the proper values for the image data should be explained via these images:


Original FRAME.BIN:


Modified FRAME.BIN w/ annotations:




2)  Set status pointers to load our modified section of FRAME.BIN.

  a)  So, given the modified FRAME.BIN, we need to set an image data pointer to the bytes DB 48 11 08.  We will use the first unused pointer in the table, at index 1E.
  b)  We want the Wall status to load the 'Mist' image, so we need to modify the Wall byte in the 2 link tables from the previous post, setting its value to 1E.  This will enable Mist        display in both ability targeting and effect.

The following patch accomplishes this; it is simple and alters a grand total of 6(!) bytes.

<Patch name="Wall -> 'Mist' image status display">
    <Description>
      Display "Mist" text images when targeting / inflicting Wall status.  Requires  modifications to FRAME.BIN.
   </Description>
   
    <Location file="BATTLE_BIN" offset="2CD37">
      1E
    </Location>
   
   <Location file="BATTLE_BIN" offset="10093F">
      1E
    </Location>
   
   <Location file="BATTLE_BIN" offset="E5FE0">
      DB481108
   </Location>
   
  </Patch>


And here is the result!  :)





Attached is the modified copy of FRAME.BIN I used + patch file.

3lric

Well done! I'm glad you got it figured out. I'll put this in the tutorial index after work tonight, so we can make sure it's easier for other people who wish to do the same.
  • Modding version: PSX

Choto

Nice work BigStan, and thanks!

Emmy

Thank you for this. :)  Your image and hack works in my mod. :)

Unfortunately wasn't able to successfully edit the image on my own for the other statuses. :(  Tile Molester wasn't importing/exporting from bmp properly, and so it ended up offsetting by a few pixels always.  Is there a trick to using Tile Molester?
  • Modding version: PSX

BigManStan

Great; glad it worked!

For editing, I used Paint as well; the import and export BMP functions worked great for me.  I did my editing in Paint, I selected existing letters in the exported .bmp and copied/pasted them into the free space, trying to make the overlap between individual letters look the same as elsewhere in the file (adjacent letters usually share a border, 1px wide, and different letter combinations tend to share different amounts of border).

A few things that may help:

1) I followed Celdia's tutorial to the letter except for the palette offset and size, which I found a better set of inputs from another thread:

    Palette Offset: 37056
    Palette Size:  256

    This gives the full range of palettes in FRAME.BIN; you can navigate between palettes using the triangle arrows at the bottom of the screen.

2)  I am wondering if you were using the correct palette for export?  If I interpreted the threads right, this is the only palette good for editing:



     Hint: this is the only palette that has the brick background intact in the lower part of the image.  The rest of the palettes will have this section garbled up.

I would switch to this palette in tilemolester, export it, edit it and reimport it.  Switching between palettes would show my new text behaving same as the other text.

If it helps, I've attached the before and after exported .bmps that I used to modify FRAME.BIN in the 'Mist' hack. 


**Note: none of the images displayed in these posts are good for editing; they are blown up 2x for readability.  Only the stuff in the attachments are what I actually used to develop this hack.