» Tutorials » Fancy Knowledge #4 - Assigning A Map To A Certain Worldmap

Fancy Knowledge #4 - Assigning A Map To A Certain Worldmap

This is a little add-on to the worldmap tutorial, I apologize for the long time you had to wait for this piece of knowledge. Actually, I once told LU-HO how to change the relations between maps and worldmaps but he somehow didn't include this in Advance Map.

Okay, it's quite straightforward, no complicated flag-selection routines this time. I'm working again with Fire Red US - I heavily recommend you to be able to "port" my offsets to the ones you need - otherwise you shouldn't be reading this tutorial anyway. ;)

A short summary of what we know from the "long" tutorial: Each "region" got a certain worldmap value. Those values range from 0x00 to 0xC5 where 0xC5 means "blank space". There are several flags connected to those values controlling if you are able to fly to this map. However there must be a connection between the worldmap values and the worldmap which is displayed when you try to fly to a fly-pos.

Okay, let's save some time and skip the "RAM-Search-Part" and let's go directly to the disassembly view:

ROM:080C0058 loc_80C0058
ROM:080C0058                 MOV     R7, #0
ROM:080C005A                 MOV     R1, #0
ROM:080C005C                 LDR     R2, =0x2036DFC
ROM:080C005E                 LDRB    R0, [R2,#0x14]
ROM:080C0060                 LDR     R3, =0x20399D4
ROM:080C0062                 MOV     R8, R3
ROM:080C0064                 CMP     R0, #0x8E        ; All locations with a worldmap value less
ROM:080C0064                                          ; or same 0x8E are on worldmap 0.
ROM:080C0066                 BLS     loc_80C00D8
ROM:080C0068                 LDR     R4, =unk_83F1AA4
ROM:080C006A                 MOV     R12, R4
ROM:080C006C                 MOV     R10, R12
ROM:080C006E                 MOV     R9, R2
ROM:080C0070 loc_80C0070
ROM:080C0070                 MOV     R3, #0
ROM:080C0072                 LSL     R0, R1, #4
ROM:080C0074                 SUB     R0, R0, R1
ROM:080C0076                 LSL     R2, R0, #1
ROM:080C0078                 MOV     R4, R10
ROM:080C007A                 ADD     R0, R2, R4
ROM:080C007C                 LDRB    R0, [R0]
ROM:080C007E                 ADD     R5, R1, #1
ROM:080C0080                 CMP     R0, #0xC5
ROM:080C0082                 BEQ     loc_80C00D0
ROM:080C0084                 LDR     R6, =unk_8 ; Get data table offset
ROM:080C0086                 MOV     R0, R9
ROM:080C0088                 LDRB    R1, [R0,#0x14]
ROM:080C008A                 LSL     R4, R5, #0x18
ROM:080C008C loc_80C008C
ROM:080C008C                 ADD     R0, R3, R2
ROM:080C008E                 ADD     R0, R0, R6
ROM:080C0090                 LDRB    R0, [R0]
ROM:080C0092                 CMP     R1, R0           ; Check if the current element of the list
ROM:080C0092                                          ; matches our current location
ROM:080C0094                 BNE     loc_80C00C0
ROM:080C0096                 LSR     R7, R4, #0x18
ROM:080C0098                 B       loc_80C00D0
ROM:080C0098 ; ---------------------------------------------------------------------------
ROM:080C009A                 DCW 0
ROM:080C009C dword_80C009C   DCD 0x47B8
ROM:080C00A0 off_80C00A0     DCD loc_80C4F08+1
ROM:080C00A4 dword_80C00A4   DCD 0x20399D4
ROM:080C00A8 dword_80C00A8   DCD 0x4797
ROM:080C00AC off_80C00AC     DCD unk_83F1B00 
ROM:080C00B0 dword_80C00B0   DCD 0x4796
ROM:080C00B4 dword_80C00B4   DCD 0x845
ROM:080C00B8 dword_80C00B8   DCD 0x2036DFC
ROM:080C00BC off_80C00BC     DCD unk_83F1AA4
ROM:080C00C0 ; ---------------------------------------------------------------------------
ROM:080C00C0 loc_80C00C0
ROM:080C00C0                 ADD     R0, R3, #1
ROM:080C00C2                 LSL     R0, R0, #0x18
ROM:080C00C4                 LSR     R3, R0, #0x18
ROM:080C00C6                 ADD     R0, R3, R2
ROM:080C00C8                 ADD     R0, R12
ROM:080C00CA                 LDRB    R0, [R0]
ROM:080C00CC                 CMP     R0, #0xC5
ROM:080C00CE                 BNE     loc_80C008C      ; If the entry in the data table is
ROM:080C00CE                                          ; not 0xC5, check the next element 
ROM:080C00CE                                          ; of the table.
ROM:080C00D0 loc_80C00D0
ROM:080C00D0                 LSL     R0, R5, #0x18
ROM:080C00D2                 LSR     R1, R0, #0x18
ROM:080C00D4                 CMP     R7, #0
ROM:080C00D6                 BEQ     loc_80C0070      ; If no matching result was found jump 
ROM:080C00D6                                          ; to the next data table.
ROM:080C00D8 loc_80C00D8
ROM:080C00D8                 MOV     R1, R8
ROM:080C00DA                 LDR     R0, [R1]
ROM:080C00DC                 LDR     R2, =0x479B
ROM:080C00DE                 ADD     R0, R0, R2
ROM:080C00E0                 STRB    R7, [R0]         ; define which worldmap is loaded.
ROM:080C00E2                 LDR     R0, [R1]
ROM:080C00E4                 LDR     R3, =0x479C
ROM:080C00E6                 ADD     R0, R0, R3
ROM:080C00E8                 STRB    R7, [R0]
ROM:080C00EA                 POP     {R3-R5}
ROM:080C00EC                 MOV     R8, R3
ROM:080C00EE                 MOV     R9, R4
ROM:080C00F0                 MOV     R10, R5
ROM:080C00F2                 POP     {R4-R7}
ROM:080C00F4                 POP     {R0}
ROM:080C00F6                 BX      R0
ROM:080C00F6 ; End of function get_displayed_wmap
ROM:080C00F6 ; ---------------------------------------------------------------------------
ROM:080C00F8 dword_80C00F8   DCD 0x479B              ; DATA XREF: get_displayed_wmap+10Cr
ROM:080C00FC dword_80C00FC   DCD 0x479C              ; DATA XREF: get_displayed_wmap+114r

Nothing exciting as you can see. A short summary: All elements with a worldmapvalue below the value of the byte stored at $C0064 (in our case 0x8E) are automatically assigned to worldmap 0. The other three worldmaps have seperated arrays which hold all values of cities and routes situated on it. Terminated by the value of the blank space - 0xC5 - those lists/arrays are situated at $3F1AA4.

ROM:083F1AA0  98 1A 3F 08 8F 90 91 96  97 98 99 9A AF B0 B9 C3  ?ܻ+
ROM:083F1AB0  C5 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  +...............
ROM:083F1AC0  00 00 92 93 9B 9C 9D 9E  9F A0 A1 A2 AE B1 B2 B5  ..P󫦦
ROM:083F1AD0  C5 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  +...............
ROM:083F1AE0  94 95 A3 A4 A5 A6 A7 A8  A9 AA AB AC AD B3 B4 B6  Ѫ
ROM:083F1AF0  B7 B8 BA BB BC BD BE BF  C0 C1 C2 C5 00 00 00 00  ++++++++--+....

Drawing information from the existing data in the ROM we get: (forget the first 4 bytes since the pointer links to $3F1AA4)

Worldmap 0: 0x00 - 0x8E
Worldmap 1: 0x8F, 0x90, 0x91, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xAF, 0xB0, 0xB9, 0xC3 [terminator 0xC5]
Worldmap 2: 0x92, 0x93, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xAE, 0xB1, 0xB2, 0xB5 [terminator 0xC5]
Worldmap 3: 0x94, 0x95, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xB3, 0xB4, 0xB6
0xB7, 0xB8, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2 [terminator 0xC5]

Okay, there is nothing left to say. Have fun.

"Pokmon" ist ein eingetragenes Warenzeichen der Firma Nintendo
"Action Replay" ist ein eingetragenes Warenzeichen von Datel Interact.
© by Mastermind_X
© 2006 - 2008