• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Research: Font color depends on overworld sprite

knizz

  • 192
    Posts
    16
    Years
    • Seen Oct 28, 2020
    Different sprites have different colors when producing textboxes?! In which game?
     
  • 5,256
    Posts
    16
    Years
    In FireRed, if you apply a simple text script to, say, a Youngster overworld, the text will be blue, and if you apply a simple text script to a Lass overworld, the text will be red by default.
     

    knizz

  • 192
    Posts
    16
    Years
    • Seen Oct 28, 2020
    The table you're looking for is at 08464300. It has 4-bit entries. (Firered)

    EDIT: How I found this out:
    As you probably know the C7-Script-Commands overwrites the color to use for the next textbox. This commands writes its argument to 020370DA. Now I put a writing breakpoint on 020370DA. 0xFF is written to this position in every frame by 080CBDF0 so I turn the writing breakpoint off and replace it with a reading breakpoint. This one triggers at 080CBE04. The code shows: If 080CBDF0 isn't 0xFF it is used as the color. Otherwise a function (0813CD24) is called to read the color out of the table mentioned above.
     
    Last edited:

    Sierraffinity

    Desperately trying to retire from ROM hacking
  • 1,069
    Posts
    16
    Years
    The table you're looking for is at 08464300. It has 4-bit entries. (Firered)

    EDIT: How I found this out:
    As you probably know the C7-Script-Commands overwrites the color to use for the next textbox. This commands writes its argument to 020370DA. Now I put a writing breakpoint on 020370DA. 0xFF is written to this position in every frame by 080CBDF0 so I turn the writing breakpoint off and replace it with a reading breakpoint. This one triggers at 080CBE04. The code shows: If 080CBDF0 isn't 0xFF it is used as the color. Otherwise a function (0813CD24) is called to read the color out of the table mentioned above.
    Awesome! Exactly what I wanted/needed.
    I thought about doing that, but decided it wasn't as MUCH of a priority as other things.
    Also, I'm guessing that each 4 bits are flipped? (Ex. Sprite 1= Male; Sprite 2 = Female, = 10)
     

    Jambo51

    Glory To Arstotzka
  • 736
    Posts
    15
    Years
    • Seen Jan 28, 2018
    Thanks to knizz's post, I'm gonna try to get rid of this table altogether! What i'm gonna attempt is to place this "sex" byte within the actual sprite data and then rewrite the routine to make it read from the sprite data instead, thus removing the need for a table of values, and making the routine compatible with JPAN's hack or a simple extended table.

    EDIT: Here we go! This routine makes the first "alignment" byte in the Overworld data into the male/female byte, getting rid of the need for this space using table altogether.

    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global OWsexbytechange
    main:
     push {lr}
     ldr r2, table
     mov r1, #0x4
     mul r0, r1
     add r0, r0, r2
     ldr r0, [r0, #0x0]
     ldrb r0, [r0, #0xE]
     cmp r0, #0x2
     bge black
    back: pop {r1}
     bx r1
    black: mov r0, #0x3
     b back
    .align
    table: .word 0x0839FDB0

    So, for the swimmer male sprite:
    Code:
    FFFF0611FF110001100020001501[B]00[/B]0010373A089C373A0868333A08780D3A08FC1C2308

    The byte in bold becomes the male/female byte. 00 - Male, 01 - Female and anything above this is set to neutral (Black).
    The main reason I developed this routine was to add support for extended Overworld tables and JPAN's Overworld hack. With the routine as is, it won't work with JPAN's hack, but it'll immediately support any extended table or normal table. It goes without saying that you'll need to modify the bytes to match the given sprite (EG, for Misty, change the relevant byte to 0x01 instead of 0x00), but it won't crash if you don't, just print blue text instead of red.

    This code is smaller than the code it replaces, so you can safely overwrite the original routine at 0x0813CD24 without any issues.

    I will look to release a patch with all the bytes corrected in the future, and then develop a version which supports JPAN's hack (shouldn't be overly difficult tbh) so that we can have "proper" male and female sprites.

    Hopefully, when a newer version of Overworld Editor is released, it will support this option as it will make it much easier to designate which sprites you wish to be male and female.
     
    Last edited:

    knizz

  • 192
    Posts
    16
    Years
    • Seen Oct 28, 2020
    I'm impressed! In my opinion the table is the better way but now everyone can choose.
     

    Jambo51

    Glory To Arstotzka
  • 736
    Posts
    15
    Years
    • Seen Jan 28, 2018
    I'm impressed! In my opinion the table is the better way but now everyone can choose.

    As I said, it's more built to add compatibility with JPAN's Overworld Hack, as that still uses exactly the same table, but doesn't take into account that it's an entirely different Overworld table. The table is, with this hack, made entirely unrequired, giving us free space to use. However, arguably, the table would be easier to edit from a hex editing point of view.

    Thanks for the opinion. I always appreciate comments and such, it's how I improve as a hacker. :D
     
  • 3,830
    Posts
    14
    Years
    • Age 27
    • OH
    • Seen May 10, 2024
    Disabling on FireRed and LeafGreen

    I hate to revive this after so long, but I figured out a pretty easy way to disable this.
    Basically, I just replace an instruction in the table reader (0813CD24) found by knizz which makes it jump to the fail-safe it has and forces it to choose grey.

    To remove it on FireRed, at 0x13CD24 replace 00 B5 00 04 with 00 B5 0F E0.
    To remove it on LeafGreen, do the same only at 0x13CCFC.

    Also, to change the color that it will always use, mess around with the byte at 0813CD48 (0813CD0E on LeafGreen). The 03 there is the default grey. Changing it to 00 will make it blue and 01 makes it red. All other values make it grey. Of course, this is because it works like the "textcolor" script command. :)
     
    Last edited:
    Back
    Top