News:

11 March 2016 - Forum Rules

Main Menu

Zelda2MapEdit

Started by matal3a0, February 12, 2016, 04:47:05 PM

Previous topic - Next topic

matal3a0

Thanks for the feedback itemdrop! I haven't had that much time playing around with it myself, been busy coding =)
Can you give some more details? After how long time or how much editing do you have do to before you experience the slowdown? Running on windows, linux?
All feedback is appreciated!

Jeville

It doesn't slow down by time, but by how many changes are made. Non-stop tile placement clicking for a few minutes (under 5) will slow the process by a second. I was clicking on the map enough times yesterday for it to slow down to 3 seconds per click lol. Like the other poster, I don't mind restarting the editor to fix it. I will spend a lot of time with it and thanks for this. :) I'm on Windows.

GTM604

im on windows 8.1 and yeah as poster above says Non-stop tile placement clicking for a few minutes will slow the process by a second. i think i got to 4 seconds yesterday. i used it for over 4 hrs.

matal3a0

#23
Thanks, I'll look into it.

Edit:
wow, it gets really slow on my win7 machine. But in my linux machine (which is a virtual machine running under the same win7), it's not that slow at all..

Edit2:
Ok, just pushed an update to github. I have removed some code, now everything seems faster. But now there is a slight delay before locations and breakpoints are drawn on the map again.
Please give it a try and see if you can live with this..

Jeville

Thanks, it's a lot better now. Does it matter whether I use the last tile choice or not? I don't really know its function.

matal3a0

I'm not really sure what you mean by last tile choice?

GTM604

I think he means the grey box with the red lines, I beileve.

matal3a0

#27
Ah, that's the "breakpoint tool". It's used to divide strings of the same tile into multiple strings.

For example 16 mountains in a row: BBBBBBBBBBBBBBBB would be encoded as FB (one byte) in the rom.
If a breakpoint is inserted at position 5, it would become two strings BBBB + BBBBBBBBBBBB, which will be encoded as 3B BB (two bytes).

This is needed for Palace 6 and New Kasuto to function properly. They need a single tile of desert and forest respectively.

The original map also contains several of these breakpoints, the encoding isn't perfect.
My algorithm finds these when loading the maps and places them automatically. This enables you to load an original map, save it, and the bytes are precisely the same in the rom =)

Perhaps I should move that button further from the other buttons.

Edit: Just pushed an update to github. I added some labelframes to organize the buttons a little bit.

Grimlock

Njosro at Board-2 is working on a similar project.  I bet there's a lot of info the two of you could share with each other:

Link to his thread:
http://acmlm.kafuka.org/board/thread.php?id=8227&page=1

matal3a0

Yup, already in contact with him, thanks!

njosro

#30
Yeah we've been messaging each other for a little while  :laugh:
The current task is figuring out the hidden palace and new kasuto.
For files with header:
0x01df78: the y value to place hidden palace (warp spot) when it appears
0x01df79: the y value to place new kasuto (warp spot) when it appears

These are only for the area warps; they don't affect the visual tiles on the map.

I'll put everything I've got for reading in area information for posterity.

For the hidden palace and new kasuto, I had to find everything on my own.
Information about the area warps: http://datacrystal.romhacking.net/wiki/Zelda_II:_The_Adventure_of_Link:ROM_map#Overworld_Areas

You know how you have the locations of each area's X and Y values? There's two more bytes to go along with them as you will see in the link above. And it's not 1 byte = 1 piece of info. They went and squished multiple pieces of information into each byte.

So, to loop through the areas, my code looks like this: (this is GML)


//load the action areas
/* REMINDER NOTES from datacrystal and me!
byte0: .xxx xxxx = Y position
       x... .... = External Flag (used in byte3)    (This means that the area takes you to a palace or town)
byte1: ..xx xxxx - X position
       .x.. .... - right exit flag                              (This is the bit for the Right Exit checkbox in my editor)
       x... .... - upper exit flag                            (This is the bit for the Upper Exit checkbox in my editor)
byte2: ..xx xxxx - Scene number
       xx.. .... - Horizontal position to enter within scene
       00 = enter from the left
       01 = enter at x=256 or from the right for 2 screens scenes
       10 = enter at x=512 or from the right for 3 screens scenes
       11 = enter from the right for 4 screens scenes
byte3: ...x xxxx - World number
       ...0 00xx - (requires External) Warp to same numbered exit in overworld #xx
       ...x xx.. - (requires External) Warp to overworld, town, town2, palace, palace2, great palace
       ..x. .... - Forced enter from the right edge of screen
       .x.. .... - Pass through
       x... .... - Fall in hole
*/
for (region=0;region<4;region+=1) //region is 0=west hyrule, 1=death mtn, etc
{
    if argument1=0 //argument 1 is whether to load from file or just reload from data structure
        break
    ds_map_destroy(area_raws[region])
    area_raws[region]=ds_map_create()
    ds_map_destroy(area_locations[region])
    area_locations[region]=ds_map_create()
   
    switch region
    {
    case 0: pos=$462F; stop=$4665 break; //($ is GM notation for hex value.)
    case 1: pos=$610C; stop=$6149 break;
    case 2: pos=$8627; stop=$8665 break;
    case 3: pos=$A10C; stop=$A149 break;
    default:pos=$462F; stop=$4665 break;
    }
    Ybegin=pos //byte 0
    Xoffset=$3F //byte 1
    Moffset=$7E //byte 2
    Woffset=$BD //byte 3
    i=0
    data=''
   
    while (pos<=stop) //shove all the raw data into the data structure area_raws
    {
        file_bin_seek(file,pos) //byte0 data
        data=dectobin(file_bin_read_byte(file),8) //(dectobin: arg0: decimal value, arg1: number of bits to make it as a string)
        file_bin_seek(file,pos+Xoffset) //byte1 data
        data+=dectobin(file_bin_read_byte(file),8)
        file_bin_seek(file,pos+Moffset) //byte2 data
        data+=dectobin(file_bin_read_byte(file),8)
        file_bin_seek(file,pos+Woffset) //byte3 data
        data+=dectobin(file_bin_read_byte(file),8)
       
        ds_map_add(area_raws[region],i,data) //add to data structure
        i+=1 //where in map to store data
        pos+=1 //where in file to retrieve bytes
    }
    ds_map_destroy(backup_area_raws[region])
    backup_area_raws[region]=ds_map_create()
    ds_map_copy(backup_area_raws[region],area_raws[region]);
   
    i=0
    pos=Ybegin
    while ds_map_exists(area_raws[region],i) //store the y-x coordinates as 13 bit binary strings. y first, then x
    {
        data=string_copy(ds_map_find_value(area_raws[region],i),2,7) //extract y pos in binary
        data+=string_copy(ds_map_find_value(area_raws[region],i),11,6) //extract x pos in binary
        ds_map_add(area_locations[region],i,data) //'yyyyyyyxxxxxx'
        i+=1
    }
}


Then it reads from the area_raws hash map to know where to place the white squares.

So basically there's the y byte, x byte, m byte, and w byte. The x byte is $3F from the y byte. The m byte is $7E from the y byte, and the w byte is $BD from the y byte. All the time.