Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2020-08-16 00:18:57

PkMn
New member
Registered: 2020-08-15
Post 1/4

Restoring Japanese Town Map

Hello!

I'm trying to restore the original town map and add a second line to it like the original green. I already changed the tileset using BGB debugger and modifying town_map.rle in order to achieve

4.png3.png

I've checked bank_01c.asm from original green that I've decompiled using mgbdis and is the same code by far, the only difference is the hlcoord. In order to see if can be accomplished in pokered dissasembly I've modified towm_map.asm from this:

.townMapLoop
    hlcoord 0, 0
    lb bc, 1, 20
    call ClearScreenArea
    ld hl, TownMapOrder
    ld a, [wWhichTownMapLocation]
    ld c, a
    ld b, 0
    add hl, bc
    ld a, [hl]
.enterLoop
    ld de, wTownMapCoords
    call LoadTownMapEntry
    ld a, [de]
    push hl
    call TownMapCoordsToOAMCoords
    ld a, $4
    ld [wOAMBaseTile], a
    ld hl, wOAMBuffer + $10
    call WriteTownMapSpriteOAM ; town map cursor sprite
    pop hl
    ld de, wcd6d
.copyMapName
    ld a, [hli]
    ld [de], a
    inc de
    cp $50
    jr nz, .copyMapName
    hlcoord 1, 0
    ld de, wcd6d
    call PlaceString
    ld hl, wOAMBuffer + $10
    ld de, wTileMapBackup + 16
    ld bc, $10
    call CopyData

To this:

.townMapLoop
    coord hl, 0, 0
    lb bc, 1, 10
    call ClearScreenArea
    ld hl, TownMapOrder
    ld a, [wWhichTownMapLocation]
    ld c, a
    ld b, 0
    add hl, bc
    ld a, [hl]    
.townMapLoop1
    coord hl, 0, 0
    lb bc, 2, 10
    call ClearScreenArea
    ld hl, TownMapOrder
    ld a, [wWhichTownMapLocation]
    ld c, a
    ld b, 0
    add hl, bc
    ld a, [hl]    
.enterLoop
    ld de, wTownMapCoords
    call LoadTownMapEntry
    ld a, [de]
    push hl
    call TownMapCoordsToOAMCoords
    ld a, $4
    ld [wOAMBaseTile], a
    ld hl, wOAMBuffer + $10
    call WriteTownMapSpriteOAM ; town map cursor sprite
    pop hl
    ld de, wcd6d
.copyMapName
    ld a, [hli]
    ld [de], a
    inc de
    cp $50
    jr nz, .copyMapName
    coord hl, 1, 0
    ld de, wcd6d
    call PlaceString
    ld hl, wOAMBuffer + $10
    ld de, wTileMapBackup + 16
    ld bc, $10
    call CopyData
.copyMapName1
    ld a, [hli]
    ld [de], a
    inc de
    cp $50
    jr nz, .copyMapName1
    coord hl, 1, 1
    ld de, wcd6d
    call PlaceString
    ld hl, wOAMBuffer + $10
    ld de, wTileMapBackup + 16
    ld bc, $10
    call CopyData

The result is that is showing 2 lines in the right places but I don't know how to break Pallet Town in order to show Pallet in the first line and Town in the second or how I must to change the code to do it in the propper way.

2.png0.png

I've already checked how is done in Gold and Silver but the code is very different and I don't really understand it.

Can someone help me please?

Thx in advance

Last edited by PkMn (2020-08-16 00:19:42)

Offline

#2 2020-08-16 14:43:14

VL2M
Member
Registered: 2020-05-11
Post 16/22

Re: Restoring Japanese Town Map

Well,design wise,it will not look good with long names,unless you will use really short names.Also,looks like a copy of the map name showing code is there.Try finding it and removing it.

Last edited by VL2M (2020-08-16 14:47:14)


Pandas sure don't like vegans...

Offline

#3 2020-08-16 18:28:14

Mateo
Member
Registered: 2009-11-25
Post 3,656/3,658

Re: Restoring Japanese Town Map

Ok, so I started with a clean copy of pokered, and this should make it work the way you wanted. I basically copied over the control character that Pokecrystal used for the line break in Town Map names. Diffy seems to be displaying that character as jibberish though, so just copy/paste the soft linebreak character from pokecrystal when applying these changes. Let me know if it works for you. You'll want to undo whatever you already did that wasn't working, of course. Also, I commented out the part for showing "To" when flying, since there was not room in the name box for it to fit. You could un-comment it and change the coordinates it gets printed at if you want to put it back, though.

https://diffy.org/diff/hkrt77j25983bocp3ajkh85mi

m3ZojrR.png
EDIT: Don't worry, I didn't break the cursor or anything, I just hit the screenshot button while it was mid-blink, lol.

Last edited by Mateo (2020-08-16 18:35:49)


I am not very active on this forum. I only pop in from time to time.

Offline

#4 2020-08-17 08:22:03

PkMn
New member
Registered: 2020-08-15
Post 3/4

Re: Restoring Japanese Town Map

Mateo wrote:

Ok, so I started with a clean copy of pokered, and this should make it work the way you wanted. I basically copied over the control character that Pokecrystal used for the line break in Town Map names. Diffy seems to be displaying that character as jibberish though, so just copy/paste the soft linebreak character from pokecrystal when applying these changes. Let me know if it works for you. You'll want to undo whatever you already did that wasn't working, of course. Also, I commented out the part for showing "To" when flying, since there was not room in the name box for it to fit. You could un-comment it and change the coordinates it gets printed at if you want to put it back, though.

https://diffy.org/diff/hkrt77j25983bocp3ajkh85mi

https://i.imgur.com/m3ZojrR.png
EDIT: Don't worry, I didn't break the cursor or anything, I just hit the screenshot button while it was mid-blink, lol.

Is working like a charm but still needing a few fixes.

When flying the arrow up and arrow down (▲ ▼) still showing on the right side of the screen. In order to fix that we must to change the coords from this:

call DelayFrames
    hlcoord 18, 0
    ld [hl], "▲"
    hlcoord 19, 0
    ld [hl], "▼"
    pop hl
.pressedUp
    decoord 18, 0
    inc hl
    ld a, [hl]
    cp $ff
    jr z, .wrapToStartOfList
    cp $fe
    jr z, .pressedUp ; skip past unvisited towns
    jp .townMapFlyLoop
.wrapToStartOfList
    ld hl, wFlyLocationsList
    jp .townMapFlyLoop
.pressedDown
    decoord 19, 0
    dec hl
    ld a, [hl]
    cp $ff
    jr z, .wrapToEndOfList
    cp $fe
    jr z, .pressedDown ; skip past unvisited towns
    jp .townMapFlyLoop

to this:

call DelayFrames
    hlcoord 0, 0
    ld [hl], "▲"
    hlcoord 0, 1
    ld [hl], "▼"
    pop hl
.pressedUp
    decoord 0, 0
    inc hl
    ld a, [hl]
    cp $ff
    jr z, .wrapToStartOfList
    cp $fe
    jr z, .pressedUp ; skip past unvisited towns
    jp .townMapFlyLoop
.wrapToStartOfList
    ld hl, wFlyLocationsList
    jp .townMapFlyLoop
.pressedDown
    decoord 0, 1
    dec hl
    ld a, [hl]
    cp $ff
    jr z, .wrapToEndOfList
    cp $fe
    jr z, .pressedDown ; skip past unvisited towns
    jp .townMapFlyLoop

But we have another problem now, since we added a tile before the name, the box is broken when choosing a town to fly. In order to fix that we must change this:

.townMapLoop
    hlcoord 0, 0
    lb bc, 2, 10
    call ClearScreenArea
    ld hl, TownMapOrder
.townMapFlyLoop
    ld a, " "
    ld [de], a
    push hl
    push hl
    hlcoord 1, 0
    lb bc, 2, 10

to this:

.townMapLoop
    hlcoord 0, 0
    lb bc, 2, 9
    call ClearScreenArea
    ld hl, TownMapOrder
.townMapFlyLoop
    ld a, " "
    ld [de], a
    push hl
    push hl
    hlcoord 1, 0
    lb bc, 2, 9

After this, you will need to fix the '''s NEST'' from the area option in the pokedex since is going to overlap the town map.

I don't have this problem because is different in my language and covers the 10 tiles but in english you will have an extra tile.

You will need to modify the town_map.rle and the coords or just change '''s NEST'' to ''NEST''. You must tweak the code adding a hlcoord before ld de, MonsNestText too

That should do the trick and restore the japanese town map 100% :)

I will edit the OP and add all the information you shared in order to archive it for the eternity.

Thank you so much Mateo

Last edited by PkMn (2020-08-17 08:45:38)

Offline

#5 2020-08-17 21:06:32

Mateo
Member
Registered: 2009-11-25
Post 3,657/3,658

Re: Restoring Japanese Town Map

Glad you got it working. I realized after the fact that I didn't cover everything in that diff I sent, and was going to send an update if you needed it.


I am not very active on this forum. I only pop in from time to time.

Offline

#6 2020-08-18 11:54:13

PkMn
New member
Registered: 2020-08-15
Post 4/4

Re: Restoring Japanese Town Map

Mateo wrote:

Glad you got it working. I realized after the fact that I didn't cover everything in that diff I sent, and was going to send an update if you needed it.

Well, is not needed, is working like I wanted but feel free to share it if you want :)

Offline

#7 2020-08-18 18:38:54

Mateo
Member
Registered: 2009-11-25
Post 3,658/3,658

Re: Restoring Japanese Town Map

PkMn wrote:
Mateo wrote:

Glad you got it working. I realized after the fact that I didn't cover everything in that diff I sent, and was going to send an update if you needed it.

Well, is not needed, is working like I wanted but feel free to share it if you want :)

Haha, it would be redundant to post it, since you already posted the things I left out originally. I did them a little differently for Red++ Classic Edition, since I was mimicking Gen 2, but yeah you already covered them.


Here's how it looks in my hack (yes, this is still using pokered as the base):
TzDFOJn.png oJpaGHV.png

Last edited by Mateo (2020-08-18 23:05:03)


I am not very active on this forum. I only pop in from time to time.

Offline

Board footer

Powered by FluxBB