Monkeying With Text

Bucket Mouse

Active member
I find the way text is set up in NESMaker kind of frustrating. The big problem is that there's no way to add a lowercase set of letters, so I have to have characters shout at each other in cutscenes, and I have no way to emphasize certain words over others.

Someone once suggested I make all the letters lowercase and then convert the extra characters into uppercase letters. Problem is there aren't enough of them for that. In the end, getting NESMaker to accept upper and lowercase text would require a re-wire of the entire GUI, way beyond my skill level (and it'd be imcompatible with future updates to boot).

I can politely ask the guys who make this software to consider adding lowercase text in a future update, but that usually gets me nowhere.

BUT I have an alternate scheme. There are a couple of screens in Pandora's Blocks where parts of the text turn green. This is a graphical glitch -- green happens to be the fourth color in the first background palette, whereas white is the fourth color in the fourth palette. I have no idea how the palettes shifted mid-text-crawl, but if I had a way to make that happen on purpose, I could make certain words another color, thereby emphasizing them and making line delivery somewhat better.

Ideally, the color shift would happen by using a special character in the text entry like @ or #. You would use one of those characters to shift the palette for that one part of the text crawl and then another character to shift it back. Is this possible to pull off?
 

Kasumi

New member
One issue with color shift is letters are 8x8 and palette boundaries are 16x16. So switching the color of part of a line would affect the line below it. (Trying to switch a word with an odd number of letters has a similar problem horizontally in theory, but in practice the space between the words could be used as a buffer.) The line trade off can be made a non issue (for non scrolling games), but it's harder to do without a scanline counter which mapper 30 doesn't have.

Text is stored in npcText in Screen Data. The defines for the keys there are in GameData/HUD_Constants.dat. Text drawing checks for a few keys (_BREAK, _END, _MORE etc, whose values are $F9-$FF), and if the character is none of those keys it will add $C0 to get the tile of the final letter. So, say you had lowercase a in the tileset at position $20. If you made a constant _a = $20-$C0, you could type it into any string in npcText manually. _A, _a. (That said, any key whose final tile number ends up as $F9-$FF after the subtraction of $c0 will end up interpreted as the special control characters.)

Shorter: If you rename the npcText file and include the renamed file instead of the one NES Maker generates (to avoid it getting overwritten all the time) you can manually type your text. The less fun part would be adding the lowercase letters as tiles for the level graphics. Official support would be better, but that's the workaround.

Final Note: It's even possible to have UI tiles entirely separate from your level tiles (So you could have 52 letters, 10 digits, various punctuation and STILL use 256 tiles for your level graphics). Essentially the same way the HUD can be made to not scroll with the screen, it can also be made to display a different tileset than the rest of the screen. The caveat is the textbox would need to occupy the entire row (no level to the left or right of it). But doing so is a much steeper mod for textboxes (rather than just the HUD).
 

Bucket Mouse

Active member
Kasumi said:
One issue with color shift is letters are 8x8 and palette boundaries are 16x16. So switching the color of part of a line would affect the line below it. (Trying to switch a word with an odd number of letters has a similar problem horizontally in theory, but in practice the space between the words could be used as a buffer.) The line trade off can be made a non issue (for non scrolling games), but it's harder to do without a scanline counter which mapper 30 doesn't have.

Text is stored in npcText in Screen Data. The defines for the keys there are in GameData/HUD_Constants.dat. Text drawing checks for a few keys (_BREAK, _END, _MORE etc, whose values are $F9-$FF), and if the character is none of those keys it will add $C0 to get the tile of the final letter. So, say you had lowercase a in the tileset at position $20. If you made a constant _a = $20-$C0, you could type it into any string in npcText manually. _A, _a. (That said, any key whose final tile number ends up as $F9-$FF after the subtraction of $c0 will end up interpreted as the special control characters.)

Trying to make sense of this. Are you saying if I added the lowercase letters into HUD_Constants and assigned them a hex value ($40 and beyond don't seem to be taken), they'd show up in "HUD And Boxes" and I could assign them to graphics there? The entire top row is wasted with arrows and other things I don't use so that would be a great place to put the lowercase graphics, if I was allowed. I hope that's what you mean, because that would be pretty easy.

UPDATE: No, they don't show up in HUD And Boxes, and they get erased whenever you compile the game. How can I do any of those options when I can't assign any values to the lowercase letters in the first place?
 

Kasumi

New member
I said to rename npcText and include the renamed file instead of the one NES Maker generates so it doesn't get erased every time you rebuild the game. I guess I missed that HUD contants gets bopped too, but everything I recommend doesn't deal with the tool at all.

The idea is rather than use the tool, type ".db _S, _o, _m, _e, _t, _h, _i, _n, _g, _SPACE, _l, _i, _k, _e, _SPACE, _t, _h, _i, _s" instead into a renamed npcText that you include instead of the npcText NES Maker generates. The letters themselves still have to be added manually to the level set, which is the annoying part.

So, as an example, open npcText for Pandora's Blocks. One of the labels will have something similar to _Q, _U, _I, _T, _SPACE, _I, _T in it, because that's text from the game.

If you change the Q to $06 (the tile value for the top left of the block in the levelset) - $C0, it will display that instead. Like:

$06-$C0, _U, _I, _T (etc.)

You'd see this:
vYyq16h.png

if you recompiled the game (using asm6, not export and test).
(I hacked in what the change I'm suggesting would assemble as.)
To make it work with export and test, you'd include a file that isn't the one NES Maker overwrites every single time. (By copying it and including the copy.) Then changes made in NES Maker's UI would no longer be seen in the game, but if you still sort of made the data match, you could keep track in the UI at least.

Now supposing $26 in that set was a lowercase Q, you could make a constant (_q = $26-$C0) for it and type this:

_q, _U, _I, _T (etc)

iE67UTC.png


This lets you use (almost) any tile in your levelset in the text boxes, so if you put lowercase letters in your tileset you can use them. It's a workaround, not a great thing.

Pros: You get to use lowercase letters.
Cons: They use up level tilespace, and you can't use the NES Maker UI and have to type an underscore and comma for every letter. You have to add the strings yourself manually under each label.

Edit: I guess the whole of bank17 is likely to get bopped, so include a copy of bank17 inside AssignBanks, then inside the copy of it change the include of npcText to a copy of that file. Then manually enter whatever strings you want in the copy of the npcText file.
 

Bucket Mouse

Active member
But if you rename npcText, won't that break the game? How does it know what name to look for now?

And how can you make constants if HUD_Constants gets overwritten? That's the only place that defines the values of the characters.

And I don't understand $26-$C0....do you have to put -C0 every time? Why? And where would you do this?

And if the letters are part of the graphics bank anyway, as they are above, would you really have to use the address of something in the tile bank? Couldn't you put the address of that left arrow in there (whatever it is)?

And how do you know what address everything is to begin with?

Sorry if this is annoying. I'm trying to learn.
 

Kasumi

New member
NES Maker is kind of a frontend for asm6. NES Maker doesn't build the ROM. Asm6 does. If you go in GameEngineData where asm6 is, you can click and drag the "mainASM.asm" file over the "asm6.exe" file, and you'll get "mainASM.bin". If you rename "mainASM.bin" to "mainASM.nes" it will be an identical ROM to whatever you last built in NES Maker.

Recognizing this, how the assembler works is that it basically takes all of the individual files the first file ("mainASM.asm" in this case) tells it about and makes them into one big file with all the data from all the files. "demo.txt" in GameEngineData is an example of this (somewhat.) It is all the data from all the files used to build the ROM. (With a tiny bit stripped out to make it easier to read.)

The assembler knows which files to use because their filenames are contained within the first file the assembler is given. ("mainASM.asm", in NES Maker's case.) So say inside mainASM.asm is this line:
Code:
.include "GameData/thisfile.asm"
If you open the GameData folder and rename "thisfile.asm" to "thatfile.asm", the assembler would complain it cannot find "thisfile.asm" But if you changed the filename in the include:
Code:
.include "GameData/thatfile.asm"
Everything would work exactly as it did before. It would be the same if you copied "npcText01.dat" and renamed the copy, "npcTextBucketMouse.dat". The program wouldn't work until you changed the include that tells the assembler that file exists. Which is in bank17.asm. (Which doesn't seem to get overwritten on a second look). NES Maker is programmed to overwrite "npcText01.dat". It is not programmed to overwrite "npcTextBucketMouse.dat". You could add new strings to your heart's content to "npcTextBucketMouse.dat" and NES Maker would not overwrite them. But, similarly, you could add new strings to your heart's content within NES Maker and you'd never see them in the game. (Because NES Maker is exporting to a file you are no longer including.)

You can make constants ANYWHERE, because the assembler just makes one giant file anyway. But, I guess the best place to put them is at the top of "npcTextBucketMouse.dat" where you'll be using them.

Code:
_q = $26-$c0
_r = $27-$C0
;etc

Yes, you have to put the -$c0 for every constant (or do the math yourself), because the code that draws the text adds $C0. So if q is tile $26, and you put $26 WITHOUT the subtraction, NES Maker's engine will draw $E6. (It will load the $26, and then add $C0).

So you offset the add it will inevitably do with a subtraction of the same value, which ends up giving the value you want. _0 = $10 in HUD_Constants, but it's $D0 in the tileset. $10 is equal to $D0-$C0.

And if the letters are part of the graphics bank anyway, as they are above, would you really have to use the address of something in the tile bank? Couldn't you put the address of that left arrow in there (whatever it is)?
I'm not too sure how to best answer this. NES Maker separates HUD/UI and the tile bank, but NES does not. You can put any value 0 to 255 and NES Maker's engine will deal with it. (Usually draw it, except for $F9 through $FF)

Yes, you could replace the left arrow and all that other HUD stuff with lowercase letters, and then use the tile numbers of those instead of using the "level" tile data. But there aren't 26 free characters there, so eventually you would have to add letters to your level tiles.
 
Top Bottom