Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-10-25 16:20:16

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 186/193

Crystal - Indigo Plateau don't show map alert

Hi, for my Gold - Silver - Crystal 2.0 project, added some map locations between others, and now Cinnabar Island location have the same properties, when I enter into don't show that I'm in Cinnabar Island. Updated other properties also in Gold and Silver, like the radio station in the ship etc. but in Crystal I don't know where is the rom address where is set the location that don't have to show location alert when you enter into.

Can you help me please?


The italian Pokémon Green creator.

Offline

#2 2016-10-25 18:03:11

Rangi
Member
Registered: 2016-05-09
Post 263/685

Re: Crystal - Indigo Plateau don't show map alert

It sounds like you're directly hex-editing a Crystal ROM, talking about addresses? You'd probably have a much easier time working with the pokecrystal disassembly.

Here's how I would add a new map, let's say, a Volcano between Seafoam Islands and Cinnabar Island, and make it count as a new location.

1. Edit constants/map_constants.asm to define the new map, VOLCANO_INSIDE.

mapgroup ROUTE_21,        18, 10 ;  7
mapgroup CINNABAR_ISLAND,  9, 10 ;  8
mapgroup VOLCANO_INSIDE,   8, 10 ;  9

The ROUTE_21 and CINNABAR_ISLAND lines were already there, they're just copied to give context. The "8, 10" means that VOLCANO_INSIDE will be 8 blocks tall and 10 blocks wide. (A block is 4x4 tiles, and a tile is 8x8 pixels.)

2. Edit constants/landmark_constants.asm to define a location/landmark for the new map, CINNABAR_VOLCANO.

const SEAFOAM_ISLANDS   ; 54
const CINNABAR_VOLCANO  ; 55
const CINNABAR_ISLAND   ; 56

It's between SEAFOAM_ISLANDS and CINNABAR_ISLAND, so they'll be in that order when you cycle through locations on the Town Map.

2. Edit maps/map_headers.asm to define the new map's attributes. The lines are in the same order as they were in map_constants.asm.

map_header Route21, TILESET_KANTO, ROUTE, ROUTE_21, MUSIC_ROUTE_3, 0, PALETTE_AUTO, FISHGROUP_OCEAN
map_header CinnabarIsland, TILESET_KANTO, TOWN, CINNABAR_ISLAND, MUSIC_VIRIDIAN_CITY, 0, PALETTE_AUTO, FISHGROUP_OCEAN
map_header VolcanoInside, TILESET_KANTO, CAVE, CINNABAR_VOLCANO, MUSIC_BURNED_TOWER, 0, PALETTE_NITE, FISHGROUP_SHORE

"map_header" is defined in macros/map.asm, where a comment explains its parameters: "label, tileset, permission, location, music, phone service flag, time of day, fishing group". Notice that it's using the new CINNABAR_VOLCANO location. And since it's going to be a cave, it has the CAVE permission (so you can Dig but not Fly) and PALETTE_NITE (for dim lighting).

3. Edit maps/second_map_headers.asm to define more of the map's attributes.

map_header_2 MoveDeletersHouse, MOVE_DELETERS_HOUSE, $0, 0
map_header_2 CinnabarPokeCenter1F, CINNABAR_POKECENTER_1F, $0, 0
map_header_2 VolcanoInside, VOLCANO_INSIDE, $0, 0

"map_header_2" is also defined in macros/map.asm, and its parameters are "label, map, border block, connections". If you're defining an outdoor map—one with TOWN or ROUTE permissions—this is where you'd define its connections to other maps, so you can walk straight from one to the other. Lining up the connections can be tricky, so you might want to start with indoor maps and outdoor ones connected by gatehouses.

4. Create maps/VolcanoInside.asm. Here's an empty template; you can look at other files in the maps directory for examples of how to define NPCs, signs, warps, etc.

const_value set 2

VolcanoInside_MapScriptHeader:
.MapTriggers:
    db 0

.MapCallbacks:
    db 0

VolcanoInside_MapEventHeader:
    ; filler
    db 0, 0

.Warps:
    db 0

.XYTriggers:
    db 0

.Signposts:
    db 0

.PersonEvents:
    db 0

5. Create maps/VolcanoInside.blk. This is a binary file; since the volcano map was defined as 8x10 blocks earlier, it's going to have 80 bytes, each one defining a block from top-left to bottom-right. You're probably comfortable with hex-editing, but just in case, the crowdmap program is a visual map editor for pokecrystal. I also wrote some utility scripts that can render a .blk file as a .png image, which is helpful if you are hex-editing the layout yourself.

6. Edit maps.asm to add maps/VolcanoInside.asm in any section where it will fit.

SECTION "Map Scripts 25", ROMX, BANK[MAP_SCRIPTS_25]

INCLUDE "maps/SilverCaveOutside.asm"
INCLUDE "maps/Route10North.asm"
INCLUDE "maps/VolcanoInside.asm"

If you run out of room, you can create a new section.

7. Edit maps/blockdata_3.asm to add maps/VolcanoInside.blk.

BetaBlank_BlockData:
    INCBIN "maps/BetaBlank.blk"

GoldenrodDeptStoreRoof_BlockData:
    INCBIN "maps/GoldenrodDeptStoreRoof.blk"

VolcanoInside_BlockData:
    INCBIN "maps/VolcanoInside.blk"

If you run out of room, you can create maps/blockdata_4.asm and include it in a new section in maps.asm.

8. Edit engine/landmarks.asm to define the new landmark's Town Map coordinates and name.

landmark  76, 148, SeafoamIslandsName
landmark  68, 148, CinnabarVolcanoName
landmark  60, 148, CinnabarIslandName

[...]

SeafoamIslandsName:  db "SEAFOAM¯ISLANDS@"
PokemonMansionName:  db "#MON¯MANSION@"
CinnabarVolcanoName: db "CINNABAR¯VOLCANO@"

(The "¯" character in those names is a macron, ASCII #175. It's used as an optional linebreak for when the location name gets shown in the Town Map or location name pop-ups.)

9. Your new map needs to be accessible. Use crowdmap or a hex editor to add a cave entrance block somewhere on Cinnabar Island, and then edit maps/CinnabarIsland.asm and maps/VolcanoInside.asm to define warps between the two. Look at other cave maps for examples.

I hope this helps you. It may seem like a lot of files to edit, but the end result is a lot more flexible than direct hex-editing. And I pasted an empty map template, but if you look at some of the existing maps you should see how relatively simple it is to write a new script. Having names for constants and pointers means that the compiler takes care of turning them into values everywhere they're used.

Last edited by Rangi (2016-10-25 18:20:52)


ROM hack: Pokémon Polished Crystal — version 2.2.0 released!

Offline

#3 2016-10-25 20:27:13

Halfshadow
Member
From: Italy - Lucca
Registered: 2012-04-24
Post 188/193

Re: Crystal - Indigo Plateau don't show map alert

Ok, but the problem is that I've moved the locations for add new areas between them. If I choose another location for the Cinnabar Island map (like Pallet town for example) the sign says "PALLET TOWN" when I enter in the map.

I need only to switch the deny to the new moved Indigo plateau. The map works correctly, the problem is only that the map sign don't appear when I enter into.

Yes, I use hex editor.


The italian Pokémon Green creator.

Offline

#4 2017-01-07 12:12:05

Rangi
Member
Registered: 2016-05-09
Post 466/685

Re: Crystal - Indigo Plateau don't show map alert

I eventually ran into this problem myself with the pokecrystal disassembly. engine/events_3.asm:ReturnFromMapSetupScript is responsible for showing the location sign. There's this piece of code:

ReturnFromMapSetupScript:: ; b8000

    [...]

    call .CheckSpecialMap
    jr z, .dont_do_map_sign

    [...]

.CheckSpecialMap: ; b8070
    cp -1
    ret z
    cp SPECIAL_MAP
    ret z
    cp RADIO_TOWER
    ret z
    cp LAV_RADIO_TOWER
    ret z
    cp UNDERGROUND
    ret z
    cp INDIGO_PLATEAU
    ret z
    cp POWER_PLANT
    ret z
    ld a, $1
    and a
    ret
; b8089

The INDIGO_PLATEAU check is what prevents the sign there.

According to pokecrystal.sym, .CheckSpecialMap is at bank:address 2E:4070 (so, absolute address (2E − 1) * 4000 + 4070 = B8070, which you can also see from the "; b8070" comment). In fact, going to offset B8070 of pokecrystal.gbc in a hex editor shows this code:

FE FF    ; cp -1
C8       ; ret z
FE 00    ; cp SPECIAL_MAP
C8       ; ret z
FE 11    ; cp RADIO_TOWER
C8       ; ret z
FE 46    ; cp LAV_RADIO_TOWER
C8       ; ret z
FE 3B    ; cp UNDERGROUND
C8       ; ret z
FE 5A    ; cp INDIGO_PLATEAU
C8       ; ret z
FE 44    ; cp POWER_PLANT
C8       ; ret z
3E 01    ; ld a, $1
A7       ; and a
C9       ; ret

So just nop out the INDIGO_PLATEAU check, replacing FE 5A C8 with 00 00 00. Or more efficiently, remove those three bytes and put the nops unreachably after the ret, replacing FE 5A C8 FE 44 C8 3E 01 A7 C9 with FE 44 C8 3E 01 A7 C9 00 00 00. (Or switch to using assembly; this does not seem like a pleasant way to code.)

Last edited by Rangi (2017-01-07 17:18:47)


ROM hack: Pokémon Polished Crystal — version 2.2.0 released!

Offline

Board footer

Powered by FluxBB