You are not logged in.
Pages: 1
I found this post in the Useful Offsets thread a while back:
Awesome post. Extremely valuable.
When messing with replacing the Text Borders, I was curious where I might find the data that says which order to draw which tiles in around the text to make it a box. I am trying to add new border graphics, but they are in a different format and use more tiles than the way Gold is set up.
For example:
Here are the original 1 bpp borders
and here is one I would like to replace it withAs you can see the new one uses a different format, where it doesn't recycle tiles for the middle across and down sections.
I looked at the bgmap in no$gmb and read that it was using tiles 79 (top left border tile) 7A (middle tile), thinking it might use a tilemap, I searched for 797A and found a few things and made changes but nothing happened. I thought maybe then it might be elsewhere since the borders are dynamically drawn depending on the size coordinates it's fed.
I'm aware on how to change the text borders to load 2bpp and how to repoint it to the proper gfx but, does anyone have any ideas on maybe where or how I might find the routine to modify it to draw the extra tiles needed?
I know blackopient was able modify the routine and successfully make it so that the game didn't recycle tiles, but I never really understood how he/she did it. Also, I want to apply this change to Crystal, and blackopient was hacking Gold. Can anyone help me understand what I need to do so I can do the same thing for my Crystal hack?
Last edited by Munchulax (2013-06-25 03:07:50)
“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde
Offline
I think I have the offset written down somewhere. I know I messed with this once before, and had it loading the border tiles in 4 colors and not repeating tiles (also using tile values from the same graphic loaded by the font). It was listed in (I think) a document I got from MeanMrMustard. I'll look around and see what I can find, and pass it on when I know more. That's about the offset in Gold anyway, you would still need to find the equivalent function in Crystal.
I am not very active on this forum. I only pop in from time to time.
Offline
0xFf2- upper side
0x1009-right side
0x1002- left side
0x1013-downleft
0x1016- down part
0x101b-downright
わたし の なまえ わ レン レン でづ
Offline
From pokecrystal:
TextBoxBorder: ; ff1
; Draw a text box width c height b at hl
; Top
push hl
ld a, "┌"
ld [hli], a
inc a ; "─"
call NPlaceChar
inc a ; "┐"
ld [hl], a
; Middle
pop hl
ld de, 20 ; screen width
add hl, de
.PlaceRow
push hl
ld a, "│"
ld [hli], a
ld a, " "
call NPlaceChar
ld [hl], "│"
pop hl
ld de, 20 ; screen width
add hl, de
dec b
jr nz, .PlaceRow
; Bottom
ld a, "└"
ld [hli], a
ld a, "─"
call NPlaceChar
ld [hl], "┘"
ret
; 101e
NPlaceChar: ; 101e
; place char a c times
ld d,c
.loop
ld [hli],a
dec d
jr nz, .loop
ret
; 1024
Offline
Okay, I understand how I would replace change the tile that the script points to now, but now I need to find the location of the script that loads the borders into VRAM in the first place. I want the borders placement in VRAM to start where the leftover ぇ is right now, at tile 77 instead of at tile 79, that way the game can still have multiple borders available for the player to choose. I also know that I would have to repoint the location of the borders, but that's simple enough to do later on.
Last edited by Munchulax (2013-06-02 01:06:07)
“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde
Offline
If you will do that, you will need to repoint everything.
わたし の なまえ わ レン レン でづ
Offline
Don't I only have to repoint the routine that loads the tiles into VRAM and the borders themselves? Unless I'm missing something here.
“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde
Offline
the tiles you mentioned are used by the hud in battle. tile 72 is unused, and if you are ok with tracking down any text using [po] [ke] you can make those text characters instead to free up tile 70 (71 is also used in battle).
Last edited by comet (2013-06-01 22:46:13)
Offline
So this is what I have right now:
(The borders are placeholders)
Back in September last year I asked a question about changing 1bpp borders to 2bpp borders. Sawakita replied with a disassembly of the border code in Gold:
Well, let's look at the code then:
RO3E:4040 fa 9b d1 ld a,(d19b) ; get index of border (0-7) RO3E:4043 e6 07 and a,07 ; probably makes sure that A be less than 8 RO3E:4045 01 30 00 ld bc,0030 ; each 1bpp tile is 0x08 bytes large -> 0x30 = (0x8 * 6) bytes RO3E:4048 21 f2 48 ld hl,48f2 ; pointer to first border graphics (they're consecutives) RO3E:404b cd a3 31 call 31a3 ; calculate correct pointer (HL + (BC * A)) RO3E:404e 54 ld d,h ; put graphics pointer RO3E:404f 5d ld e,l ; into de RO3E:4050 21 90 97 ld hl,9790 ; (¹) VRAM destination RO3E:4053 01 06 3e ld bc,3e06 ; (²) put bank in B and number of tiles in C RO3E:4056 cd 72 0e call 0e8d ; (³) load 1bpp graphics (on-the-fly conversion to 2bpp) into VRAM ; we're not interested in the following but I'll just put it here anyway RO3E:4059 21 f0 97 ld hl,97f0 ; same as (¹) RO3E:405c 11 f6 52 ld de,52f6 ; 1bpp graphics source RO3E:405f 01 01 3e ld bc,3e01 ; same as (²) RO3E:4062 cd 8d 0e call 0e8d ; same as (³) RO3E:4065 c9 ret
As you see the routine that loads 1bpp graphics (and converts it to 2bpp on-the-fly) is 0xe8d; the equivalent routine for 2bpp graphics is 0xe72.
The beginning of the code he posted started at 3E:4040 in Gold. I have found the equivalent code in Crystal at 3E:74CC:
ld a,(CFCE) ; get current border type from CFCE in RAM (0-7)
and a,07 ; probably makes sure that A be less than 8
ld bc,0030 ; each 1bpp tile is 0x08 bytes large -> 0x30 = (0x8 * 6) bytes
ld hl,4800 ; pointer to first border graphics (they're consecutives)
call 30FE ; calculate correct pointer (HL + (BC * A))
ld d,h ; put graphics pointer
ld e,l ; into de
ld hl,9790 ; (¹) VRAM destination
ld bc,3E06 ; (²) put bank in B and number of tiles in C
call 0DDC ; (³) load 1bpp graphics (on-the-fly conversion to 2bpp) into VRAM
ld hl,97F0 ; same as (¹)
ld de,5204 ; 1bpp graphics source
ld bc,3E01 ; same as (²)
call 0DDC ; same as (³)
ret
Looking at the code, I think I know what I need to modify in order to load parts of borders into certain addresses in VRAM, but I'm not sure if the actual code for the borders starts here or not because I can't find a pointer in the same ROM bank (3E) that points to FB4CC. Could someone point me in the right direction so that I can repoint the routine so I can modify the routine that loads the tiles into VRAM?
“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde
Offline
3E:750A
3E:74CA
So the pointers are right before and after that code.. What were you looking for?
cYa,
Tauwasser
Offline
Now that I have time to work on this again:
the tiles you mentioned are used by the hud in battle. tile 72 is unused, and if you are ok with tracking down any text using [po] [ke] you can make those text characters instead to free up tile 70 (71 is also used in battle).
I felt like that would be the easy way to do it (even though players of the hack and the game itself don't care and it doesn't make a difference), so I changed some of the code that loads the borders from ROM into VRAM, and now the tile arrangement looks like this (borders are placeholders):
Overworld: In Battle:
Borders load correctly and correctly change as well. The only problem I have now is that I can't figure out where the code that tells the game where to place Battle HUD tiles onscreen is in the ROM. Therefore, because the code is currently unmodified the Battle HUD looks like this because:was shifted left from 0:9710 to 0:9700
was shifted left from 0:9740 to 0:9710
was shifted left from 0:9740 - 0:9770 to 0:9720 - 0:9750
Could someone point me in the right direction with this problem so I can fix the Battle HUD?
“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde
Offline
From pokecrystal:
RefreshBattleHuds: ; 39c9
call UpdateBattleHuds
ld c, 3
call DelayFrames
jp WaitBGMap
; 39d4
UpdateBattleHuds: ; 39d4
ld a, $f
ld hl, $5f48
rst FarCall ; UpdatePlayerHud
ld a, $f
ld hl, $6036
rst FarCall ; UpdateEnemyHud
ret
; 39e1
I think "UpdatePlayerHud" and "UpdateEnemyHud" is probably I'm looking for, because the HUD updates every time you press a button, but I'm not sure what I would have to change even if I am in the right place. Could someone tell me if I'm even going in the right direction and maybe help me out a little?
Last edited by Munchulax (2013-06-25 02:46:47)
“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde
Offline
Pages: 1