Users browsing this thread: 1 Guest(s)
Multicolor Chocobos

#1
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
This patch is inspired by Tenkarider in his Curse of the Gods mod.

Multicolor Chocobos has 4 different chocobo types:
Yellow: Normal chocobo
Red: Mountain chocobo
Blue: Water chocobo
Purple: "Flying" chocobo (sadly he does not fly, but can move everywhere)

To activate different chocobo types we use event bits $0E8 and $0E9.
Both are cleared for the normal chocobo,
$0E8 is set for red chocobo,
$0E9 is set for blue chocobo
Both are set for the purple chocobo

The basic patch implements only palette swapping and improved movement based on event bits $0E8 and $0E9. You need to set these bits yourself (in events) to allow the player access to new chocobos.

But, for fun we have the example IPS file to try this out.

The example IPS file will start a new game outside the WoB chocobo stables. You can head north enter the stables and the chocobo caretaker will allow you to pick any of the 4 chocobos you want.

Indepth:
Code:
# Chocobo Palettes
@ 14F900:

        # Normal Chocobo Palette (yellow)
        AD 35 63 0C 00 00 7F 03         00 00 0E 11 BC 2E 9F 4B
        1B 02 39 67 FF 7F 92 21         1D 26 DF 57 DF 73 E3 6C

        # Mountain Chocobo Palette (red)
        1F 00 1F 00 1F 00 1F 00         1F 00 1F 00 1F 00 1F 00
        1F 00 1F 00 1F 00 1F 00         1F 00 1F 00 1F 00 1F 00

        # Water Chocobo Palette (blue)
        00 7C 00 7C 00 7C 00 7C         00 7C 00 7C 00 7C 00 7C
        00 7C 00 7C 00 7C 00 7C         00 7C 00 7C 00 7C 00 7C

        # "Flying" Chocobo Palette (purple)
        1F 7C 1F 7C 1F 7C 1F 7C         1F 7C 1F 7C 1F 7C 1F 7C
        1F 7C 1F 7C 1F 7C 1F 7C         1F 7C 1F 7C 1F 7C 1F 7C

# MODE7: Chocobo Palette Hack
@ 2E89B6:
        4C 01 AF        # JMP $AF01

@ 2EB101:
        C2 20           # REP #$20      (16-bit A)
        AD 9D 1E        # LDA $1E9D
        29 03 00        # AND #$0003
        0A              # ASL A
        0A              # ASL A
        0A              # ASL A
        0A              # ASL A
        0A              # ASL A
        AA              # TAX

        A0 00 00        # LDY #$0000     (Zero Y) ($00...)
        BF 00 F7 D4     # LDA $D4F700,X  (Chocobo color palettes)
        99 20 E1        # STA $E120,Y    (Save in RAM)
        E8              # INX
        E8              # INX            (Point to next color in RAM)
        C8              # INY
        C8              # INY            (Point to next color in RAM)
        C0 20 00        # CPY #$0020     (Copied 16 colors?)
        D0 F0           # BNE -          (Loop if not)


        AB              # PLB            (Restore data bank)
        E2 20           # SEP #$20       (8-bit A)
        AF 06 B2 EE     # LDA $EEB206    (Pointer to sky graphics, low byte)
        85 D2           # STA $D2        (Set source for decompression, low byte)
        AF 07 B2 EE     # LDA $EEB207    (Pointer to sky graphics, middle byte)
        85 D3           # STA $D3        (Set source for decompression, middle byte)
        AF 08 B2 EE     # LDA $EEB208    (Pointer to sky graphics, high byte)
        85 D4           # STA $D4        (Set source for decompression, high byte)

        4C CB 87        # JMP $87CB

# Improved Movement for different color chocobos
@ 2E1D51:
                4C 01 B0        # JMP $B001
                EA EA EA EA
                EA EA EA


# Free space used at $EEB001:
@ 2EB201:
                C2 20           # REP #$20      (16-bit A)
                AD 9D 1E        # LDA $1E9D     (chocobo type from event bits)
                29 03 00        # AND #$03      (isolate bits)
                85 1A           # STA $1A       (store to use with X later)

                C2 10           # REP #$10       (16-bit indexes)
                20 B5 1C        # JSR $1CB5      (Tile properties)
                89 01 00        # BIT #$0001     (Impassable for chocobos?)
                D0 03           # BEQ $1B61      (Branch if not) (LSR A, BCC...)
                4C 61 1B        # JMP $1B61     (exit)

                E2 10           # SEP #$10       (8-bit indexes)

                29 0C 00        # AND #$000C    (shadow cast by airship)

                A6 1A           # LDX $1A       (chocobo type)

                E0 00           # CPX #$0000    (normal chocobo)
                D0 03           # BNE +03       (not normal chocobo)
                4C 5B 1B        # JMP $1B5B     (prevent movement)

                CA              # DEX           (mountain chocobo)
                D0 08           # BNE +08       (not mountain chocobo)
                C9 04 00        # CMP #$0008    (test for large airship shadow)
                10 03           # BPL +03       (it's ok, mountain choco on a mountain)
                4C 5B 1B        # JMP $1B5B     (prevent movement)

                CA              # DEX           (water chocobo)
                D0 08           # BNE +08       (not water chocobo)
                C9 00 00        # CMP #$0000    (test for small airship shadow)
                F0 03           # BPL +03       (it's ok, water choco in the water)
                4C 5B 1B        # JMP $1B5B     (prevent movement)

                4C 61 1B        # JMP $1B61     (exit)

# Improve Dismount
@ 2E9572:
                4C 01 B1        # JMP $B101
                EA EA EA        # NOP

# Free space used at $EEB101
@ 2EB301:
                A5 20           # LDA $20        (Map mode)
                C9 02           # CMP #$02       (Chocobo mode?)
                F0 03           # BEQ +03        (Branch if so)
                4C 78 93        # JMP $9378      (return to other modes)

                A5 C2           # LDA $C2        (Tile properties, low byte)
                89 01           # BIT #$01       (Impassable for chocobos?)
                F0 03           # BEQ +03        (Branch if not)

                4C 2C 94        # JMP $942C      (exit)
                4C D4 93        # JMP $93D4      (normal dismount)

Code added for the example IPS:
Code:
# Text: Chocobo Bill
@ 0D9CF3:
        15 7F 38 3E 45 45 48 50 01      # > Yellow
        15 7F 31 3E 3D 01               # > Red
        15 7F 21 45 4E 3E 01            # > Blue
        15 7F 2F 4E 4B 49 45 3E         # > Purple
        00

# NPC Event: Chocobo Bill
@ 0C3504:
        4B A7 83                        # Choice dialogue
        97                              # fade to black
        B6
                3D 33 02                # Picked Yellow
                45 33 02                # Picked Red
                4D 33 02                # Picked Blue
                55 33 02                # Picked Green
        FE

@ 0C353D:

        D1 E8           # Picked Yellow
        D1 E9
        B2 83 33 02

        D0 E8           # Picked Red
        D1 E9
        B2 83 33 02

        D1 E8           # Picked Blue
        D0 E9
        B2 83 33 02

        D0 E8           # Picked Purple
        D0 E9
        B2 83 33 02

        FE

# Event: Intro
@ 0C9A5B:
                6B 00 24 36 56 00
                FF

# Event: New game stuff
@ 0A6033:       A9                      # Show title screen

                7F 00 00                # NAME 00 -> 00
                40 00 00                # Set properties
                3D 00                   # Create Character
                3F 00 01                # Assign char to party
                37 00 00                # sprites for char 00
                43 00 00                # palette for char 00

                7F 01 01                # NAME 01 -> 01
                40 01 01                # Set properties
                3D 01                   # Create Character
                3F 01 01                # Assign char to party
                37 01 01                # sprites for char 01
                43 01 01                # palette for char 01

                D4 E0                   # Event bit 20E (on)
                D4 F0                   # Event bit 20F (on)
                3C 00 01 FF FF          # Set party
                46 01                   # Select party 1
                D2 0B                   # Event bit 10B (on)
                D2 E3                   # Event bit 1E3 (on)

                6C 00 00 75 3D 00       # Start location in WoB

                82 88 5E                # Subroutine new game/loading
                FE

The patches are for a headered ROM.
  Find
Quote  
[-] The following 2 users say Thank You to m06 for this post:
  • Gi Nattak (05-24-2018), Tenkarider (07-29-2015)

#2
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Nice work!

I'm moving this into the IPS patches forum.

Edit: Tomorrow I'll move the patch on our server since attachments are not allowed, but for now it's alright.
  Find
Quote  

#3
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Nice, thanks for the move, I tried to post in the IPS patches forum but it didn't work.

The palettes themselves are not good at the moment, just dummy palettes with the same color in every slot. I'm not very good at adjusting the tones so if someone more suited to the task wants to post some nice palettes I can reward with appropriate credits.
  Find
Quote  

#4
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Too bad, i lost the monopoly on colored chocobos Laugh (jk)

Very nice job! Kungfu! yet i'm not sure about what are all pros and cons, i mean... do this patch burns some resource already used in the game(like palettes) or it's free? i saw terra with a palette which looks like the one of chocobo, does that mean anything?

another thing: chocobo sprite should be composed of 16 colors, do each color use 2 bytes? that would explain why you load 32 bytes for each chocobo, in the case i already have my lightblue chocobo palette(unless you want exacly blue) for you, nothing really exceptional... probably someone would be able to do a better work than mine Laugh

The only thing that bothers me is that, due to plot reasons and the fact i don't want the player can have both properties in the same world(perhaps i might place black chocobo in part 2-b) then i won't use the patch for CotG.
Yet it's fine in this way, at least future mods will be able to propose a different chocobo system than mine, rather that doing everybody the same thing.

Said that, i believe i'll still examine your code and see if i can find some piece of code that might reveal useful for some personal use in my hack... could you describe what each block do exactly? i didn't understood everything, reading from comment lines...

PS. since you did it in world map, i hoped you managed to do that even on submaps, but actually looks like Chocobo's color outside world map will still be unique Sad is it possible to apply the same method of changing palette even in submaps?


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#5
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Glad you like it Tenkarider

(07-29-2015, 04:48 AM)Tenkarider Wrote: Very nice job! Kungfu! yet i'm not sure about what are all pros and cons, i mean... do this patch burns some resource already used in the game(like palettes) or it's free? i saw terra with a palette which looks like the one of chocobo, does that mean anything?

The added palettes are put into free space. The patch should not "burn" anything except free space and 3 interceptions into the EE bank. No data is changed only ASM.

Terra has wrong colors cause I assigned her the wrong palette in the new game event. I assigned palette $00 to actor $00 but she uses palette $02

(07-29-2015, 04:48 AM)Tenkarider Wrote: another thing: chocobo sprite should be composed of 16 colors, do each color use 2 bytes?

Yes, each color uses 15 bits (5 for each color, blue, green, red) and the colors are stored in two bytes (16-bits), the highest bit is unused

15-bit BGR format (from Jay's SNES Palette Format doc)
Code:
    0BBBBBGG GGGRRRRR

Your light blue palette would be very nice to have.

(07-29-2015, 04:48 AM)Tenkarider Wrote: ... could you describe what each block do exactly? i didn't understood everything, reading from comment lines...

The hack works in 3 parts:

MODE7: Chocobo Palette Hack
This part intercepts the loading routine for the world map in vehicle mode. It jumps right after all palettes have been loaded and reloads the chocobo palette based on the event bits $0E8 and $0E9 ($1E9D in RAM).

Improved Movement for different color chocobos
This part intercepts the vehicle movement routine and expands it to check also for the chocobo type from the event bits. For the new chocobos we check the airship shadow size from the tile properties because mountains will have large shadow and water will have a small one.

Improve Dismount
Normally the dismount routine allows the chocobo to dismount anywhere. This part makes a proper check to the tile properties so that chocobos can not dismount on areas marked impassable by chocobos.

Sorry if my comments are sloppy. Comments are tedious Hmm

(07-29-2015, 04:48 AM)Tenkarider Wrote: PS. since you did it in world map, i hoped you managed to do that even on submaps, but actually looks like Chocobo's color outside world map will still be unique Sad is it possible to apply the same method of changing palette even in submaps?

This doesn't work with the submaps atm. I want to look into that though, but it's in a different bank so I left it for later. I will update when I get it working.
  Find
Quote  

#6
Posts: 875
Threads: 44
Thanks Received: 22
Thanks Given: 17
Joined: Nov 2011
Reputation: 23
Status
Imprisoned
Great stuff


The only limit is imagination. And 16 colors.. I guess 

Quote  

#7
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
What's this thing about airship shadow? Never heard of it, possibly a detailed explaination, please Wink

Here's the RGB conversion into hex of my lightblue chocobo:
AD 35 63 0C 00 00 80 62 00 00 80 51 20 4F 20 7F
40 4A 39 67 FF 7F 40 40 E0 59 DF 57 DF 73 E3 6C

After i was doing math manually for a while(to convert RGB into decimal), when i realized at a certain point that i did an error, i got sick of that waste of time and i built a C++ program... to do that much faster that me Objection!
a very simple program... you write the RGB colors(values from 0 to 31) and the
program converts them into a decimal value, then you'll have to convert it into hex on your
own(don't forget to swap the pair of hex bytes you obtain, after you made the conversion into hex, the usual little endian shitty rule, you know... ;[ )

if you want, i linked here my program: (for Windows system, dunno if it works even in other systems...)
http://www.mediafire.com/download/dnme4e...ecimal.rar
there are exe and source code files inside.

PS. the hex i posted follows the order of Chocobo's colors in SNES palette editor program, dunno if you have to reverse even the order of colors... i doubt it, anyway.


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#8
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
(07-29-2015, 07:37 PM)Tenkarider Wrote: What's this thing about airship shadow? Never heard of it, possibly a detailed explaination, please Wink

You know, how the airship shadow on the ground while you are flying around has a different size depending on what tile it is over? That shadow becomes slightly larger over mountains, and smaller over oceans/water, and normal size over grass. It sounds like he worked in a check for the event bits that are set depending on which kind of chocobo you are currently using along with the tile properties to check if the vehicle (chocobo) is over grass, mountains, or water, and allow or disallow it to walk over it. Pretty clever stuff!


We are born, live, die and then do the same thing over again.
Quote  

#9
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
Thanks for the palette looks really nice. Now I just need red and purple Smile

Like Gi Nattak said, the shadow for the airship scales depending on the "terrain height" aswell as the airship height. So I use that for the chocobos too, Gi Nattack put it very well.

I found the bits in FF3Info.txt by Yousei
Code:
Map Tile Properties

Sample:  Grass from WoB (0x0044)

0000000001000100
|||||||||||||||+-  0: 0--Chocobo can travel on tile, 1--Chocobo cannot travel on tile
||||||||||||||+--  1: 0--Airship can land, 1--Airship cannot land
|||||||||||||+---  2 \ Size of shadow cast by airship
||||||||||||+----  3 / 00-smallest, 01-small, 10-large, 11-largest
|||||||||||+-----  4: 0--Can walk on/off tile, 1--Cannot walk on/off tile
||||||||||+------  5: 0--Character is opaque, 1--Bottom of character is transparent
|||||||||+-------  6: 0--Deactivate enemy encounters, 1--Activate enemy encounters
||||||||+--------  7:
|||||||+---------  8 \
||||||+----------  9  } Battle Background Image (see below)
|||||+----------- 10 /
||||+------------ 11:
|||+------------- 12:
||+-------------- 13:
|+--------------- 14:
+---------------- 15:
  Find
Quote  

#10
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(07-29-2015, 07:37 PM)Tenkarider Wrote: After i was doing math manually for a while(to convert RGB into decimal), when i realized at a certain point that i did an error, i got sick of that waste of time and i built a C++ program... to do that much faster that me Objection!

How about a program that converts the color into SNES palette format? Tongue

Edit: Use something similar to this:

Code:
//Converts an RGBTRIPLE to an integer equivalent used by the ROM
void getIntPal(RGBTRIPLE color, BYTE *c1, BYTE *c2)
{
    *c1 = color.rgbtRed / 8;
    *c1 += ((color.rgbtGreen / 8) & 0x07) << 5;
    *c2 = ((color.rgbtGreen / 8) & 0x18) >> 3;
    *c2 += (color.rgbtBlue / 8) << 2;
}
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite