Language…
11 users online: AbuseFreakHacker,  BeeKaay, ben15420, Gorry, Green, Michel2023, OrangeBronzeDaisy, Ray Hamilton, Rykon-V73, ShoopDaWhoop,  YouFailMe - Guests: 258 - Bots: 621
Users: 64,795 (2,369 active)
Latest user: mathew

(Close Please) Custom timer help

smwcentral iconI finally finished my custom timer sprite. The timer patch needs a little more polishing to do. For one thing, I don't know how to check if the player is entering a level from the overworld. I would also like to disable the timer from the patch. May someone help? After I complete the timer, I'd like to submit it or put it here.
Edit: What is a hex to dec routine? I tried makng a custom timer,but when the time reaches 10 minutes, the 10s digit frame graphic glitches up, going over 60. (to 69, to be exact)
Where can I find a tutorial for hacking the status bar? or How do you hack the status bar?

You know, it would be cool if someone made a sword sprite(s) and released it to the public. That would help a lot of people........ Now that I think about it, that would be perfect for C3! (Not that I could program a sword sprite)
You can either make a sprite that hacks it or use LevelASM.
...or routine hack the status bar routine. Doing it in a sprite or LevelASM isn't a good idea if you want something done in every level.
smwcentral iconI'm not sure if I wasn't clear, but I mean: How do you make a status bar hacking code?
You know, it would be cool if someone made a sword sprite(s) and released it to the public. That would help a lot of people........ Now that I think about it, that would be perfect for C3! (Not that I could program a sword sprite)
Originally posted by scepile3
I'm not sure if I wasn't clear, but I mean: How do you make a status bar hacking code?

If you simply want to rearrange the status bar, use the tool in the Tools Section.

If you want to add additional counters/whatever, you can store to $0EF9-$0F42 either in LevelASM, a sprite, or the original routine.
This tool if you want to change the status bar.
Your layout has been removed.
smwcentral iconSo, what does storing to $0EF9-$0F42 do? I know it is the tilemap, but which byte does what? How would you turn these RAM addresses into a counter or something?
You know, it would be cool if someone made a sword sprite(s) and released it to the public. That would help a lot of people........ Now that I think about it, that would be perfect for C3! (Not that I could program a sword sprite)
Originally posted by scepile3
So, what does storing to $0EF9-$0F42 do? I know it is the tilemap, but which byte does what? How would you turn these RAM addresses into a counter or something?
Well SMW's programmers had the same idea! Look:


Those addresses are the values in the ram map- to find which value has which tile, just look in the GFX file for them.
smwcentral iconEdit: How do you set the palette?
I think I get it. To store into a tile, you put the value of the graphic you want in the proper RAM address. The RAM addresses control the graphic in that spot.
You know, it would be cool if someone made a sword sprite(s) and released it to the public. That would help a lot of people........ Now that I think about it, that would be perfect for C3! (Not that I could program a sword sprite)
Yes, the tiles are loaded from GFX28.bin. For example, the letter K would be #$14 and the coin symbol is #$2E. You store it to the RAM address you want. But if there are routines already going on in that address (like suppose you are writing your tiles to the bonus stars without disabling the bonus stars), then your code might not work. You have to disable that routine.

Adding a custom counter is simple too. You just load an unused RAM Address and store it to the status bar address. For example, LDA $0660 STA $0EF9 will store my counter to $0EF9 and I can use a custom block which increases $0660 by one. But keep in mind that it just increments to the next value in GFX28.bin if you do that, so if you're counter reaches 9 and then you increase it by one again, it will be A and not 10. You have to put a Hex -> Dec routine in that.

To change the palette, You can use the Status Bar Editor, choose the palette from there and place a blank tile (one at very bottom), and place it over the RAM Address tile. This doesn't really place a blank tile there, it just changes the colour because you're already writing your tiles in the ASM code.

Hope this helps ;)
The Hex -> Dec Routine is quite easy too. Just JSL to this HexDec label before storing your tiles.

HexDec:
LDX #$00 ; set X to 00
Loop:
CMP #$0A ; if A > 9
BCC Return
SEC
SBC #$0A ; reset A
INX ; and increment X
BRA Loop
Return:
RTL

Make sure you store the value in X to the status bar too. If you store A to $0F14, store X to $0F13.
smwcentral iconEdit3:So, it turns out that in order for the sprites to appear, X must not be changed. That answers why you can't modify X. Well, X can't be kept modified after the routine ends.
Edit2:OK, so my timer patch is done. The sprite works fine. There's just one problem. When I use it, all of the sprites are gone. The sprites arein there if you chack Lunar Magic, but they are gone ingame. It has something to do with Iceguy's routine. When I JSR to it, the sprites are gone.
Edit1:Oddly enough, everything was all right. When !T (used to show tens digit) increased for the minutes, it glitched up !F (frame counter).
Edit:After I tried that piece of code out, it still failed to repair the glitch.
I did that in my routine. It is:
Code

Show:
    LDA !F
    PHA
Label:
    LDA !F
    CMP #$0A
    BCS Lower
    LDA !F
    STA $0F11
    LDA !T
    STA $0F10
    STZ !T
    LDA !S
    PHA
    BRA Label1
Lower:
    LDA !F
    SEC
    SBC #$0A
    STA !F
    LDA !T
    CMP #$06
    BEQ tReset
    INC !T
    BRA Label
That's only a part of it, but that's the hex to dec routine for showing # frames in the status bar. It glitches up after minutes get to ten, causing it to reach 70 before reseting. Oddly, when it resets, it starts at ten also. I'll try this and see if it works.

You know, it would be cool if someone made a sword sprite(s) and released it to the public. That would help a lot of people........ Now that I think about it, that would be perfect for C3! (Not that I could program a sword sprite)