Users browsing this thread: 1 Guest(s)
Imp's Mapping (in development)

Posts: 264
Threads: 22
Thanks Received: 108
Thanks Given: 110
Joined: Dec 2018
Reputation: 18
Serity was helping me work out a graphical mechanics problem... that is, the desire to have Imp status show on the map for the character.

Surprised Kappa!

Here's what I've got so far:
*Works on World Map
*Correctly reverts when Imp status is removed.
*Area Maps will display the wrong palette

I'm personally fine with the last one, but I know others might not be.  As such, I thought I'd share the code here so others could work on it if they so desire.
The world map part is really straight-forward, in the EE bank we simply add a check for Imp status and then change the graphics of the 'map display character' in the RAM accordingly.
The field map part is more complicated.  I've taken parts of the code that sets character graphics on a load, and injected them at a part of the C0 bank that runs more frequently.  I've only done some cursory testing on this, so I'm unsure what its underlying complications might be.
Working Version 0_07!  (No Field Palettes)

Imp's Mapping
C0/BD36:                    D65A
    20 5A D6                JSR $D65A        [Was B9 01 16, LDA $1601,Y]
C0/00E5:                    D767
    20 67 D7                JSR $D767        [Was 20 A3 18, JSR $18A3]

    B9 14 16                LDA $1614,Y        [Current status of actor]
    89 20                    BIT #$20        [Is Imp bit set?]
    D0 04                    BNE    skipAhead    [Branch if so]
    B9 01 16                LDA $1601,Y        [Load saved character appearance]
    60                        RTS                [Resume normal code]
    A9 0F                    LDA #$0F        [Load the Imp graphic]
    60                        RTS                [Resume normal code]

    20 A3 18                JSR $18A3        [Execute original code]
    48                        PHA
    5A                        PHY
    DA                        PHX                [Protect variables]
    A6 00                    LDX $00            [What's below recreates some of the draw functions used in a normal load]
    9B                        TXY                
    20 5A D6                JSR $D65A        [New subroutine that makes an Imp status check]      ***Points to Freespace C0/D65A***
    9D 79 08                STA $0879,X        [Save the result as the character graphic]
        7B                        TDC
        A9 01                    LDA #$01
        C2 21                    REP #$21        [This stuff is math to check if we've checked everybody... I think]
        8A                      TXA
        69 29 00                  ADC #$0029
        AA                      TAX
        98                      TYA
        18                      CLC
        69 25 00                  ADC #$0025
        A8                          TAY
        7B                      TDC
        E2 20                    SEP #$20          [8 bit accum./memory]
        C0 50 02                  CPY #$0250
        D0 E2                    BNE StartLoop       [Loop back to subroutine $D65A based on the result of the previous line]
    FA                        PLX                [Restore original variables]
    7A                        PLY
    68                        PLA
    60                        RTS                [Return to normal code]

    4C 01 AF                JMP $AF01        [Was BD 01 16, LDA $1601,X]

    BD 14 16                LDA $1614,X        [Load status byte 1 of this actor]
    89 20                    BIT #$20        [Check if Imp bit is set]
    F0 0E                    BEQ skipAhead    [Branch if not]
    A9 0F                    LDA #$0F        [Load Imp actor graphic]
    8D FB 11                STA $11FB        [Store in graphics to display for lead character]
    A9 05                    LDA #$00        [Load Imp actor palette]
    8D FC 11                STA $11FC        [Store in palette to display for lead character]
    A6 5A                    LDX $5A
    80 0F                    BRA Exit
    BD 01 16                LDA $1601,X        [Load actor's character graphic]
    8D FB 11                STA $11FB        [Store in graphics to display for lead character]
    A6 5A                    LDX $5A
    BD 70 1F                LDA $1F70,X        [Load current actor's character palette]
    4A                        LSR
    8D FC 11                STA $11FC        [STore in palette to display for lead character]
    4C 4E 03                JMP $034E        [Go back to normal code execution]
EDIT: Forgot attachment.  Note that the spaces used were free in my hack (which uses a slightly older version of the C.V. Reynolds bugfix compilation).  That said, I hope these spaces are unused but I can't guarantee it.  I apologize that the code is not more portable: I've annotated the one line that points to a specific address and would need changing if you need to move the used freespace.

Attached Files
.zip  Imp's Map 0_7 (UH).zip (284 bytes, 1 downloads)
[-] The following 4 users say Thank You to C-Dude for this post:
  • Gi Nattak (01-10-2021), madsiur (01-11-2021), SSJ Rick (01-16-2021), Warrax (01-10-2021)

Posts: 2,322
Threads: 92
Thanks Received: 332
Thanks Given: 302
Joined: Aug 2009
Reputation: 44
Good stuff! I do hope the area map palette issue can get figured out, I am one of those people who could not live with that lol. It's great to see it in all its glory on the overworld for now at least.

One tiny tiny thing, I see in your posted code for the EE/AF01 part has the Imp palette as $05, and I'm fairly sure it means to be $00 which is the correct Imp palette. The actual patch seems fine though.

We are born, live, die and then do the same thing over again.
[-] The following 1 user says Thank You to Gi Nattak for this post:
  • C-Dude (01-10-2021)

Posts: 264
Threads: 22
Thanks Received: 108
Thanks Given: 110
Joined: Dec 2018
Reputation: 18
Oop, you're right, that's the moogle palette!  My bad.

EDIT: I'm stumped on the palettes. The Field Sprites don't set actor palettes in the way you'd think, it's three bits of data in the upper and lower portions of their sprites.

$0880 and $0881 in the Field RAM.

Character palettes are saved in $1F70-$1F7F, so I think the 'restore' function would need to call from there indexed based on the character, but every time I try the camera flies away and then the screen scrambles.

Posts: 384
Threads: 38
Thanks Received: 156
Thanks Given: 97
Joined: Feb 2017
Reputation: 23
So if you're using FF3usME to set the palettes, there's actually an oversight in the way it does so in sprites above Umaro. If my memory serves me corectly, it affects the overworld as well. In the "Save Screen/Shop Palette Indexes" section, it shows 4 palette fields. However, because none of these sprites ever appear in the shop, there should actually only be 2 fields per sprite. That means that the palettes map like this:
1. Soldier's Top/Bottom Frame 1: Soldier Sprite (default 1)
2. Soldier's Top/Bottom Frame 2: Imp Sprite (default 0)
3. Imp's Top/Bottom Frame 1: Leo Sprite (default 0)
4. Imp's Top/Bottom Frame 2: Banon Sprite (default 3)
5. Leo's Top/Bottom Frame 1: Esper Terra Sprite (default 2)
6. Leo's Top/Bottom Frame 2: Merchant Sprite (default 1)
7. Banon's Top/Bottom Frame 1: Ghost Sprite (default 0)
8. Banon's Top/Bottom Frame 2: Kefka Sprite (default 2)

Under NO circumstances should you use the checkbox for "use the same indexes as the battle one" on any sprite above Umaro.

Divergent Paths: The 3 Scenarios (Completed) - a redo of the 3 scenarios in the original game that gives equal time to each group. Meant to be a basis for future mods.
FFVI: Divergent Paths (In Progress) - a hack built off of the 3 scenarios that changes other events in the same, such as making Leo permanently recruitable, bringing Banon's story closure, and adding 1 more secret character.

Forum Jump:

Users browsing this thread: 1 Guest(s)

Theme by Madsiur2017Custom Graphics by JamesWhite