Author Topic: Alright, REALLY preliminary, something I've been working on for a couple days.  (Read 5040 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Are you reading the graphic tiles from the rom dynamically or using static built in images?
Let's dance!

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Woah, you're making progress on this at mach speed it seems! Keep it up! If I have some free time tonight I'll give it a go.

Are you reading the graphic tiles from the rom dynamically or using static built in images?

That's a good question. Would be AWESOME if it were dynamic, as it would give me an incentive to go more in depth with edits to world map graphics than I have so far.  :happy:
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
I'm reading the tileset from the ROM.  Here's the code: https://github.com/Entroper/FF4MapEdit/blob/0.3.1/FF4MapEdit/MainWindow.xaml.cs#L176

I have no idea how I would design a UI for tileset editing, but if you've already modified the tiles, the editor will read them just fine.

Bahamut ZERO

  • Cagnazzo
  • *
  • Posts: 347
  • Gender: Male
  • If ye're takin a beatin, hop in de back row!
    • View Profile
Quote
I'm reading the tileset from the ROM.

Hell Yeah!


Quote
I have no idea how I would design a UI for tileset editing, but if you've already modified the tiles, the editor will read them just fine.

As far as the graphics-side goes YYCHR is easy enough for tileset editing, plus has that nifty savestate option for viewing palettes so that part can be done without you having to make a UI for the editor to accommodate it.  :cycle:
I update my graphics thread on almost a daily basis, so keep an eye out for new stuff!

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
I'm reading the tileset from the ROM.  Here's the code: https://github.com/Entroper/FF4MapEdit/blob/0.3.1/FF4MapEdit/MainWindow.xaml.cs#L176

Thanks! This was the only real thing holding me back from implementing world map editing in FF4kster. Hopefully I can make sense of the code ^_^
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
This is kind of
 :offtopic:
But I gotta say, I love it when this forum creates an avenue for mutual inspiration!
This is when this @#$% gets really fun!

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
I'm reading the tileset from the ROM.  Here's the code: https://github.com/Entroper/FF4MapEdit/blob/0.3.1/FF4MapEdit/MainWindow.xaml.cs#L176

Thanks! This was the only real thing holding me back from implementing world map editing in FF4kster. Hopefully I can make sense of the code ^_^

Feel free to ask if something doesn't make sense.  :)

I've learned a ton from reading the source code to various ROM tools, so part of the reason for doing this project was to let other people read my code and do the same.  The license file will back you up.  :)

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Wow, I got a crapton of refactoring done tonight, and I'm really pleased with how it turned out.  After all that, I was able to add a real-time compressed map size label in just a few minutes.

https://github.com/Entroper/FF4MapEdit/releases/tag/0.3.2

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
I'm reading the tileset from the ROM.  Here's the code: https://github.com/Entroper/FF4MapEdit/blob/0.3.1/FF4MapEdit/MainWindow.xaml.cs#L176

Thanks! This was the only real thing holding me back from implementing world map editing in FF4kster. Hopefully I can make sense of the code ^_^

Feel free to ask if something doesn't make sense.  :)

I've learned a ton from reading the source code to various ROM tools, so part of the reason for doing this project was to let other people read my code and do the same.  The license file will back you up.  :)

Thanks!

Mainly what I was confused about is detailed here:
http://slickproductions.org/forum/index.php?topic=1866.msg25002#msg25002

Perhaps you can confirm if I was on the right track?
Let's dance!

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile

Thanks!

Mainly what I was confused about is detailed here:
http://slickproductions.org/forum/index.php?topic=1866.msg25002#msg25002

Perhaps you can confirm if I was on the right track?

Yeah, it looks like it.  The data at A0800 (headered) is what I call "subtile palette offsets" since they're offsets into the world map palette for each subtile.  Seems an inefficient way to store this, actually, because there are only 4 possible values, but each one consumes an entire byte.  Oh well.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
If I had to guess, I'd say that has to do with indexing efficiency - the X value is already set by the tile selection. So while you could store as many as four palette assignments in one byte, it would take a lot more assembly to extract the relevant information when you needed it.

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Sure, it's more convenient in the ASM.  It's just funny sometimes to see where they chose to make things as compact as possible and where they didn't.  Like the snow-capped mountains thing, versus this.

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Code: [Select]
private void CopySubTileToTile(byte[] subTiles, int subTilesOffset, ushort[] tile, int tileOffset, ushort[] palette, int paletteOffset)
{
for (int y = 0; y < 8; y++)
{
for (int x = 0; x < 4; x++)
{
byte twoPixels = subTiles[subTilesOffset + 4 * y + x];

byte pixel = (byte)(twoPixels & 0x0F);
tile[tileOffset + 16 * y + 2 * x] = palette[paletteOffset + pixel];

pixel = (byte)((twoPixels & 0xF0) >> 4);
tile[tileOffset + 16 * y + 2 * x + 1] = palette[paletteOffset + pixel];
}
}
}

Hmmm does not FF4 use bitlanes to internally store tiles? That code looks like for GBA :D

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Yeah, just straight 4bpp linear pixels.

Entroper

  • FF4 Hacker
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
So, I have the following details about tile properties from FF4Ed:

Code: [Select]
#define LDF_WALK                0x0001
#define LDF_UNKNOWN1            0x0006
#define LDF_SAVEPOINT            0x0008
#define LDF_UNKNOWN2            0x00F0

#define LDF_WALKDAMAGE            0x0100
#define LDF_UNKNOWN3            0x0200
#define LDF_HIDECHARACTER        0x0400
#define LDF_TOPHALFCHARACTER    0x0800
#define LDF_EXIT                0x1000
#define LDF_UNKNOWN4            0x6000
#define LDF_ENTRANCE            0x8000

Code: [Select]
#define WDF_CHARAWALK            0x0001
#define WDF_CHOCOWALK            0x0002
#define WDF_BLACKCHOCOFLY        0x0004
#define WDF_BLACKCHOCOLAND        0x0008
#define WDF_HOVERCRAFTMOVE        0x0010
#define WDF_AIRSHIPFLY            0x0020
#define WDF_CHARAWALK2            0x0040
#define WDF_BIGWHALEFLY            0x0080

#define WDF_BATTLEBACKGROUND    0x0700
#define WDF_SHOWCHARATOPHALF    0x0800
#define WDF_AIRSHIPLAND            0x1000
#define WDF_UNKNOWN2            0x2000
#define WDF_ENEMYENCOUNTERS        0x4000
#define WDF_ENTRANCE            0x8000

That's for area maps and world maps, respectively.

Do we know if the flags labeled UNKNOWN are used at all?

 :edit: Wait, and what the hell is CHARAWALK2?!