View Single Post
  #20886    
Old March 31st, 2012 (04:18 AM).
sonic1's Avatar
sonic1
ASM is my life now...
 
Join Date: May 2008
Location: Portugal
Age: 20
Gender: Male
Nature: Timid
Quote originally posted by darkprince909:
So what youre saying is the final script, in essence, would be something like
Spoiler:
'---------------
#org 0x800000
checkflag 0x(flag for the event that destroyed the city)
if 0x1 goto 0x(destroyed city map)
goto 0x(normal city map)

'---------------
#org 0x(destroyed city map)
setmapfooter 0x(whatever the footer for this map is)
end

'---------------
#org 0x(normal city map)
setmapfooter 0x(whatever the footer for this map is)
end


right?

A few questions about this:

How do I figure out what the footer for the map is (A8, A4 for Shoal Cave for example)? I cant find it in Advancemap, even in the professional header view. I may just not be looking in the right place though.

And when, in the story, I go back in time to before the city is destroyed, I'd just clear the flag so that it loads the normal city map?

The special 0xD5 is a ASM function that checks what time it is and returns a positive or a negative for that specific flag based on what time it is, right? And that's why I wouldn't use either of those?

And this whole thing would work with Fly, so that when you Fly to the map, it would run this script before you see anything, and would thus load the destroyed city before you land, right? In that case, would I need to place a Fly block (where you land) in the destroyed map as well? Or would it take you to the same coordinates as the warp it at on the normal map?
EDIT: I took a look at it in the ROM. It looks like the setmapfooter changes just the tile placements and permissions and loads all the events from the original map? Because all the warps and items and such are on the low tide versions and there's no events whatsoever on the high tide versions. Meaning that everything the NPCs would do in the destroyed city would have to be scripted in the normal city? And this would mean all the Warps, Fly tiles, etc would be loaded from the original map as well?
Well, the script is correct!
Now, figuring the mapfooter...

I don't know your version, so i'm going to use emerald as base, because i'm an emerald hacker.

Lets take by example ROUTE 101 (0.16)


Now, we know that our map footer is 0x3EBC64.

In emerald, there's a table at 0x481DD4
Spoiler:
24 05 3E 08 04 18 3E 08 64 1E 3E 08 44 31 3E 08
A4 37 3E 08 C4 50 3E 08 E4 69 3E 08 24 86 3E 08
44 9F 3E 08 84 A2 3E 08 C4 A5 3E 08 04 A9 3E 08
44 AC 3E 08 84 AF 3E 08 C4 B2 3E 08 24 B9 3E 08
64 BC 3E 08 54 C4 3E 08 34 D2 3E 08 54 EB 3E 08
74 04 3F 08 14 11 3F 08 94 1A 3F 08 14 24 3F 08
E4 37 3F 08 44 57 3F 08 24 83 3F 08 04 96 3F 08
.......


So! Each pointer points to a mapfooter. Lets now search our mapfooter in the table. Reversing our mapfooter offset we get the pointer, and searching the pointer in rom, we get... 0x481E14. That's where the pointer is stored. Now subtract the offset with the table pointer. You get 0x40. Now, divide by 0x4 (4bytes per entry). You get 0x10. BUT we're not done yet... When using setmapfooter, the game subtracts 1 to the mapfooter we input... So, if you want to set route 101 mapfooter, you put 0xF, because 0x10-0x1 = 0xF.
There you go, you just found you mapfooter! :D


Yes, mapfooter changes only the tiles and gfx stuff, you need to program every npc in the original map. Mapfooter changes this plus permissions:
__________________
This signature has been disabled.
over 350px high
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.