Thread: [Tutorial] 1st Gen Hacking: Useful Links
View Single Post
  #33    
Old March 2nd, 2016 (2:05 PM).
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: Ohio
Age: 21
Gender: Male
Nature: Relaxed
Posts: 3,821
Quote:
Originally Posted by RaidenRaider View Post
Okay, the first part I can do, I can edit the specific .png files to say "Red 251 Version", "Blue 251 Version" and "Green 251 Version, but the numbers 251 don't display at all in-game because I think the font is wrong, and secondly, I don't know how to edit the data to display the desired text based on the tileset in engine/titlescreen.asm.

The text is either flowing offscreen on the left or right, the 251 doesn't show up instead being replaced by big blocks of red/blue/green, depending on the version, or even see's the whole text being severly centered to the right of the screen.
(before you read this, know this is mostly what I'm figuring out as I go... RBY hacking is not my forte)

So when you edit a tileset like this, you need to find the code where it is loaded and ensure that the entire size of the image is loaded into memory. In this case, in engine/titlescreen.asm you'll want to find this code (I found it at line 59):
Code:
...
ld hl, Version_GFX ; $402f
IF DEF(_RED)
	ld de,vChars2 + $600
	ld bc,$50
ENDC
IF DEF(_BLUE)
	ld de,vChars2 + $600 + $10
	ld bc,$50 - $10
ENDC
ld a, BANK(Version_GFX)
...
This code is interesting because of the value being loaded into bc in the instruction "ld bc,$50" and "ld bc,$50-$10" because $50 is 80 in decimal while $50 - $10 = $40 which is 64 in decimal, which you might realize is the size of our version text in pixels. So in order to load a larger image, we want to change this value. Say for example I ended up expanding the new text for Red version to 96 pixels in width, then I would it like so:
Code:
IF DEF(_RED)
	ld de,vChars2 + $600
	ld bc,$60 ; note here that $60 is 96 in hexadecimal
ENDC
By doing this we should hopefully be allocating 96 pixels of space for our image instead of the original 80 that was there.

As for editing data, well, what we do is break our logo into small squares ("tiles") that are 8 pixels by 8 pixels in size, like so:


Now, based on this line of data and our image, we can figure out how this tilemap is laid out:
Code:
db $60,$61,$7F,$65,$66,$67,$68,$69,"@" ; "Red Version"
As we can see, $60 corresponds to the first block in the image (which shows "Re"). Knowing this, the rest of the layout becomes clear, and we can map the blocks of the tileset as follows:

Where $60 is the first tile, and every subsequent tile increases by one. It is important to note that this is in hexadecimal, so a tile to the right of $69 would be $6A. Also, you'll see that $7F is not present on our tileset. This is OK! Because it simply maps to a part of the memory that would essentially be $16 tiles beyond our image, which would be "blank" data because no other images were loaded in that spot. Because it's blank, it will display as all white on the titlescreen and is used as a space character here. Finally, we can assume that "@" refers to an "end of tilemap" character or something similar.

So when you make your new tileset, break it apart into 8x8 tiles and map as I have done here. You can even fit multiple logos onto one image, as has been done with the original "RedGreenVersion" image and through clever use of the data you can only display the specific parts you want the player to see for a specific version. The important part in this specific case is that your tile starts at $60 instead of $0 like we might normally think when programming. If you look at the code for the Copyright string tilemap, you'll see it follows this same convention.

I hope this works for you, as I am partially guessing on the code editing part. :)
__________________
What are you so afraid of?
Reply With Quote