4.5.9 Custom HUD text on different screens?

karikas

New member
Hi, I'm pretty new to NESMaker (working on my first project!) and have some coding background, unfortunately not in assembly... but, I am learning!

I am trying to get the HUD to display different "location" text depending on what screen you're on. My plan is to use different screen flags per screen to set one of 8 flags, and then depending on the flag the HUD would display a different value for the player's location. A screen with Screen Flag 2 set would show the location text "INSIDE HOUSE", Screen Flag 3 would show "OUTSIDE", etc.

To this end I have defined some variables like this in a new file which is loaded in LoadAllSubroutines.asm:
Code:
HUD__0_LOC_STRING:    ; "INSIDE HOUSE" text
    .db #$22, #$27, #$2c, #$22, #$1d, #$1e, #$35, #$21, #$28, #$2e, #$2c, #$1e, #$35, #$35, #$35, #$FF

HUD__1_LOC_STRING:    ; "OUTSIDE" text
    .db #$28, #$2e, #$2d, #$2c, #$22, #$1d, #$1e, #$35, #$35, #$35, #$35, #$35, #$35, #$35, #$35, #$FF

In my HUD in NESMaker I have Element 0 set to show a HUD Asset with a default value, and then adjusted the code in Bank18_AdventureBase.asm so instead of calling JSR updateHudElement0 it calls JSR updateHudElement0Custom, which I have defined like so:

Code:
updateHudElement0Custom:
 DrawTilesDirect #HUD_BANK, HUD__0_LOC_STRING, #2, #2, #HUD_OFFSET
 RTS

That doesn't do anything with screen flags, just trying to get it to do something custom at first. I assumed this would draw the value of HUD__0_LOC_STRING in the HUD instead of the default, but that's not the case - it draws the default as it's been defined in NESMaker. I was worried maybe I was editing the wrong file, but if I add a bad command or change a label I do get an error, so I know it's reading the files.

Any advice? This is my first crack at editing the scripts, I'm probably overlooking something crucial? Maybe I'm approaching this whole problem the wrong way? Grateful for any direction and happy to provide scripts and screenshots if it will help. Thank you!
 

karikas

New member
UPDATE: I figured it out! I was calling the HUD update code from the wrong place. Will put my solution together and post it here soon for people of the future (but for now, sleep!)!
 
Top Bottom