Author Topic: [ff8] Edit the encounters on the world map  (Read 12782 times)

Girl next door

  • *
  • Posts: 144
    • View Profile
[ff8] Edit the encounters on the world map
« on: 2016-09-17 15:30:05 »
Hi!

I want to edit the encounters on the world map. With Cactilio, I can change the scenes but not their location. The idea is to put some rare encounters on special places. I can do that with Deling on fields but not on the world map. Any idea how I can do this ?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #1 on: 2016-09-17 16:14:15 »
I discovered it's in one of wmsetus section. We found the worldmap regions but no encounters. It's somewhere near section 2 to 9. Currently- no one have found where exactly. Search somewhere in sections 1 to 9 in wmsetus file. Here's the notes I collected:
http://wiki.qhimm.com/view/Talk:FF8/WorldMap_wmsetxx

Girl next door

  • *
  • Posts: 144
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #2 on: 2016-09-17 20:30:06 »
Well, that's quite a heavy thing, I will wait for someone more skilled than me. ^^'

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #3 on: 2016-10-14 16:24:16 »
wmsetus.section2:

Does it look similar to you? :)
I have not found the encounter data, but it's a map of world map regions for encounters. I'll be trying to reverse it.

EDIT: I found function that returns world map block ID based on Squall's position. 0x553760 for me
then:
mov     al, [edx+edi] (where EDX is world segment and EDI is LEA of section 2 start)

All six first wmset sections are tied to one function. I already found the one that gets the region ID when character is moving and have no enc-none equipped. This is clearly all encounters.
« Last Edit: 2016-10-14 17:43:26 by Maki »

Girl next door

  • *
  • Posts: 144
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #4 on: 2016-10-14 20:35:37 »
Yes, it's the same thing for the wmsetfr:



That's a weird code no ? You should find somewhere the encounter's ID no ? But here, it's just the map if you have the ability No encounters no ?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #5 on: 2016-10-15 16:47:33 »
Good news! I found it!
wmsetus.section4 structure:

uint16 - encounter ID

It's as simple as that

0x541CF1 is mov     dx, [ecx+eax*2]
ECX - section4 pointer; eax is unknown so far...
Balamb garden uses:
0x6
0x8
0xC
0xE

It uses the same encounter IDs as normal scene.out file

also treat section 5 as leftover/null

I haven't localized the ECX yet (the pointer that tells which position from section4 to read encounter from)
« Last Edit: 2016-10-15 16:55:31 by Maki »

Girl next door

  • *
  • Posts: 144
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #6 on: 2016-10-15 20:03:10 »
That's good news ! ;D

But well, it's hard to understand for me. At which offset the sector 4 begins please ?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #7 on: 2016-10-15 20:43:52 »
That's good news ! ;D

But well, it's hard to understand for me. At which offset the sector 4 begins please ?

If you use my Rinoas Toolset you can unpack wmset file. I'm working now on repacker and editor for section 4 and 2, so fear not. :3

Girl next door

  • *
  • Posts: 144
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #8 on: 2016-10-15 21:22:35 »
Great ! Looking forward to its released ! ;D

Girl next door

  • *
  • Posts: 144
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #9 on: 2016-10-17 02:24:24 »
About the world map, do you know where is the draw points data please ?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #10 on: 2016-10-19 08:13:14 »
About the world map, do you know where is the draw points data please ?

Hm, the only function associated with draw points is kind of giant function of event processing probably (I called it draw point related, but I see now there are references to text and world map quests, so that's not this). Game calls "GetDrawMagic" from EAX that is dword_204400C.
dword_204400C however is set as return by sub_54F770
sub_54F770 in fact loads wmsetS35 pointer, so... Looks like section 35 is managing world map draw magic. That's all for now, I need to finish the editor for wmset 2 and 4 first.

Girl next door

  • *
  • Posts: 144
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #11 on: 2016-10-20 04:57:41 »
Of course, one thing after the other. :) Will you put this editor in your Rinoa's toolset ?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #12 on: 2016-10-23 11:36:01 »
Of course, one thing after the other. :) Will you put this editor in your Rinoa's toolset ?
Okay, it's done:
https://github.com/MaKiPL/FF8-Rinoa-s-Toolset/releases/tag/1.1.2

First open, unpack, open section you want to edit and finally click on compile. File saving prompt should appear if no errors. Remember to have backup of your files!
Compile/unpack/editor works on all language versions (wmsetus, wmsetit, wmsetfr etc...)

Now the draw points...
« Last Edit: 2016-10-23 11:52:28 by Maki »

volvania

  • *
  • Posts: 48
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #13 on: 2016-10-24 00:16:03 »
WMSET : not enough WMSET section! can't build file...
thats the message appear when i compile is that a normal error or i did something wrong maki?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #14 on: 2016-10-24 06:29:29 »
WMSET : not enough WMSET section! can't build file...
thats the message appear when i compile is that a normal error or i did something wrong maki?
Rebuild function automatically finds all possible language versions. Normally, you should have one success and four errors like this.

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #15 on: 2016-11-09 11:07:38 »
About the world map, do you know where is the draw points data please ?

Section35:
OffsetSizeDescription
0x000x2CUnused - skipped in ASM
0x2C + (drawID * 4)4DrawPointVariable

DrawPointVariable:
OffsetSizeDescription
0x00shortProbably X
0x02shortProbably Y

The X and Y calculation example (FF8 2000 english):
ECX: 020409FC
ESI:  020400AC
EDX: 0204095C

X == EDX
Y == ((*ECX - *ESI) - 4 ) >> 4  [just gets pointer variable from ECX and substracts it from ESI, then substracts 4 and shifts right 4, pretty simple]

I'm still not sure how to calculate it to world map position. Magic IDs are probably coded inside EXE as field draw points are http://forums.qhimm.com/index.php?topic=16980.0

EDIT:
Yes, it gets data from the same DrawMagicArray as fields, just adds 0x80 to drawID. Therefore every drawmagic bigger than 0x80 is world-map only I think.
The magicID to draw is simple counted as draw entry. So, the first draw magic entry is magic ID = 0, second is magicID=1 and etc... [like autoincrement database]

EDIT2:
Okay, EDX = 0 if top left corner on map and 2FFF if bottom right corner.
but X makes no sense...

Zoom in if you don't see variables
« Last Edit: 2016-11-09 12:00:42 by Maki »

Halfer

  • *
  • Posts: 142
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #16 on: 2016-11-09 19:04:49 »

EDIT2:
Okay, EDX = 0 if top left corner on map and 2FFF if bottom right corner.
but X makes no sense...

Yo!

The "0-2FFF" format is actually 2 bytes

In Big-Endian format:
 First byte is X location in width counted from blocks (0x20 * 4 or 32 * 4), where 0x20/32 is blocks from "left edge" to "right edge" in world map.
 Second byte being Y location in height counted from blocks (0x18 * 2 or 24 * 2), where 0x18/24 is blocks from "top edge" to "bottom edge" in world map.

In short:
Code: [Select]
First byte = Block in world map row
Second byte = Block in world map column * 2 (Only for every other column block)

Hope that was clear in anyway :)

resinate

  • *
  • Posts: 96
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #17 on: 2016-11-19 01:51:18 »
ok soo someone went around and completely deleted all encounter IDS of ff8 from all the wikis does anyone have this list on backup?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #19 on: 2016-11-23 15:01:30 »
In short:
Code: [Select]
First byte = Block in world map row
Second byte = Block in world map column * 2 (Only for every other column block)

Thanks!
I don't know if it happens everywhere, but the X variable should be ANDed to 7 bits (0x7F). Do you know for what this one bit is responsible for?

Halfer

  • *
  • Posts: 142
    • View Profile
Re: [ff8] Edit the encounters on the world map
« Reply #20 on: 2016-11-23 16:54:20 »
Thanks!
I don't know if it happens everywhere, but the X variable should be ANDed to 7 bits (0x7F). Do you know for what this one bit is responsible for?

My bad... The value is calculated from block positions.

the X is treated as two sequential rows so the math goes:

Code: [Select]

X = rowBlockAmount, which is 4 times segment amount so 4 * 32 = 128 or 0x80. The last bit tells which row of the two we are on, first or second. The range of top row is from 0x00 - 0x7F and second row's 0x80 - 0xFF.

Y is incremented whenever X goes over 0xFF.


Hope this image helps more than my blather :D (Open in new tab for seeing text)