 |
|
 |
|
| How do I display something on the overworld border? |
|
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - How do I display something on the overworld border? |
|
Pages: 1  |
|
|
|
| Posted on 2011-12-19 09:13:55 AM |
Link | Quote |
|
There are a few statistics that I'd like to display on the overworld border (similar to the way I've seen a few Japanese hacks display a coin icon when you've collected 5 Dragon Coins in a level).
I tried looking at some existing patches that affect the overworld border, but couldn't figure it out. Could anyone explain how to do this?
(By the way, I can display them fine on the in-level status bar.)
|
|
| Posted on 2011-12-19 09:48:04 AM |
Link | Quote |
|
This is not a very easy thing to do =/
Smallhacker has made one patch that shows the coin count on the overworld border(it's called "[Xkas] OW Coin Counter", credited to Iceguy)
You may be able to extract some info from that one(it isn't commented though =/)
Oh, and also, Alcaro has made a patch that should be easier to hijack, but it is for SMWCP2(more specifically, it shows the SMWC coins in each level, from the overworld).
|
|
| Posted on 2011-12-19 10:58:44 AM |
Link | Quote |
|
I did something similar for my own hack a while ago (although I ended up using sprites to display the icon, which might not be what you want to do) - all I did was hijack the "draw player sprite" routine (around $0485E8) to display additional sprite tiles. The only hard part was figuring out that the OW border has priority over sprites so I had to edit the border to have a "hole" in that place and fill that with extra sprite tiles, just like how SMW did it with the player sprite on the overworld).
That probably was either unintelligible or not helpful to you though, so... if you want to utilize layer 3, how about editing the layer 3 image pointer for the OW border to some free RAM and changing that with OWASM? Haven't tried that, admittedly, but it seems like the eaisest way.
|
|
| Posted on 2011-12-19 12:34:10 PM |
Link | Quote |
|
If it matters, this is what I'm hoping to display:
- An exit counter
- The exits obtained in the level you're currently at, similar to SMA2's results screen (using a table to determine whether to display no exits, normal exit only, two exits, or two exits with normal/secret exit reversed)
- The "Dragon Coin high score" (something I've already calculated) of the level you're currently at, with a coin icon next to it, only if it's non-zero (if for some reason I could only choose one, this is the one I really care about displaying)
Also, I don't have any experience with displaying sprite tiles or anything like that.
Anyway, that OW Coin Counter patch, although it makes even less sense to me than the other patches I looked at, basically confirms what I thought from looking at the Extended Overworld Level Names patch and the 999 lives patch-- that it involves $7F837B, $7F837D, and the bytes immediately after that... it seems to be in a certain format (as far as I can tell, the actual tiles start at $7F8381, alternating tile number and properties), but how exactly does it work? (The RAM map just calls that entire region VRAM upload table, which doesn't really help...)
And if updating the overworld border involves storing to those RAM addresses, how is it that something else can store to those same addresses later on, but not necessarily overwrite the same tiles? Do $7F837D etc. act differently from other RAM addresses?
Also, why is it that the Extended Overworld Level Names patch seems to leave out the 7F? Doesn't STA $837B store to $837B in whatever ROM bank you're currently in (which makes no sense)?
|
| Last edited on 2011-12-19 12:35:38 PM by Zeldara109. |
|
| Posted on 2011-12-19 01:51:26 PM |
Link | Quote |
|
I did this through uploading my own stripe images for the border.
Sprites could of course work too, as there's plenty of room for graphics for those.
I suppose it depends if you know how to use the OAM or how to use stripe images/DMA. Since you said you don't know how to display sprite tiles manually, you should probably try uploading custom stripe images.
Quote
Also, why is it that the Extended Overworld Level Names patch seems to leave out the 7F? Doesn't STA $837B store to $837B in whatever ROM bank you're currently in (which makes no sense)?
It probably sets the bank prior to doing that.
Code
LDA #$7F
PHA
PLB
LDA #$00
STA $8000
will store to $7F8000.
|
|
| Posted on 2012-02-11 12:47:04 PM |
Link | Quote |
|
It seems I'd forgotten about this.
Anyway, since I wasn't quite sure how to directly write to the overworld border, I tried modifying the Extended Overworld Level Names patch (the upper line added by that patch was all I needed). This was the result:
ExOWLNa.asm
I think I got the basic idea working, but since Lunar Magic moves around the level name data, the LDA.l $908B55,x that I included in the patch won't necessarily work after the hack is edited in Lunar Magic again... Can anyone help me find a way to get it to jump back to the Lunar Magic level name code (so it runs the code at $03BB56 instead of the Label2 part)? Everything I tried resulted in a crash.
|
|
| Posted on 2012-02-11 01:01:14 PM |
Link | Quote |
|
Instead of the LDA $908B55,x, try...
CodeLDA $03BB57
STA $00
LDA $03BB58
STA $01
LDA $03BB59
STA $02
LDA [$00]
As long as the routine stays in the same place, $03BB30 (and it should), that should get you the pointer to the table wherever Lunar Magic puts it.
|
|
| Posted on 2012-02-11 04:06:50 PM |
Link | Quote |
|
That doesn't work... All the level names are blank-- I think it's always loading from $908B55, not $908B55,x. (Also, $00-$03 are already being used in this patch, so I doubt it's a good idea to overwrite them here.)
That gave me an idea, though...
Code LDA $03BB57
STA $04
LDA $03BB58
STA $05
LDA $03BB59
STA $06
PHY
TXY
LDA [$04],y
PLY
I tried this instead, and it seems to be working (well, the entire patch isn't yet, but Lunar Magic's level names are functioning correctly even after I save in Lunar Magic, which is what I asked for help with). Thanks.
|
| Last edited on 2012-02-11 04:08:38 PM by Zeldara109. |
|
| Posted on 2012-02-11 04:50:20 PM |
Link | Quote |
|
Originally posted by Zeldara109That doesn't work... All the level names are blank-- I think it's always loading from $908B55, not $908B55,x. (Also, $00-$03 are already being used in this patch, so I doubt it's a good idea to overwrite them here.)
...Oops. Yeah, I didn't think about the fact that it was indexed...well, yeah, doing what you did and using [$00],y, transferring X to Y first, should work. And if $00-$03 are being used, just use $04-$06 or something instead, then.
|
|
| Posted on 2012-02-11 05:11:49 PM |
Link | Quote |
|
OK, new problem:
I've managed to get my overworld exit counter sort of working, but for some reason, the 1's digit of the exit counter is always being replaced by a glitched tile (the same glitched tile no matter what number it's supposed to be). (The 10's digit works fine.)
Does anyone know why that's happening?
The patch link is the same as before.
ExOWLNa.asm
|
| Last edited on 2012-02-11 05:12:26 PM by Zeldara109. |
|
| Posted on 2012-02-11 05:35:19 PM |
Link | Quote |
|
|
Hm...does the problem happen no matter where you place the exit counter? And can you identify which tile the glitched one is (i.e. the tile number)?
|
|
| Posted on 2012-02-11 05:49:51 PM |
Link | Quote |
|
It seems to be tile AD.
And the glitched tile still appeared even when I changed the STA $0F3D to STA $0F42 (though it moved to tile $88 in my "status bar", where $0F42 corresponds to).
Also, it doesn't matter whether the exit counter is one or two digits (the same glitched tile replaces the 1's digit regardless), but the glitched tile only appears when the exit counter exists, not when the player has 0 exits.
Edit:
It seems the problem was that X was in 16-bit mode? Changing X to 8-bit mode seems to have solved it... no idea why, though.
Anyway, does anyone know how to access the current translevel number on the overworld (of the level the player is currently on)? It seems $13BF only updates after entering a level, not when moving around the map.
|
| Last edited on 2012-02-11 06:56:14 PM by Zeldara109. |
|
| Posted on 2012-02-11 07:21:37 PM |
Link | Quote |
|
This should help you out.
By the way would you mind sharing the working product with me? I've been trying to do this myself with no luck.
|
|
| Posted on 2012-02-11 08:18:37 PM |
Link | Quote |
|
It seems to be working now, so I've updated the patch (the link is still the same).
Note that it's pretty specialized for use with Alyssa's Unlikely Trap, so I'm not sure how useful it would be, other than for the exit counter (or as an alternate version of Extended Overworld Level Names that uses less freespace since it keeps Lunar Magic's level names for the second line).
(Specifically, the "Dragon Coin high score" is calculated elsewhere (I'll release that patch as well if anyone asks, though it's also somewhat reliant on other patches used in AUT1), so it won't work with this patch alone. Also, it relies on some custom layer 3 tiles for various things.)
Also, it isn't compatible with a 3-digit exit count (I didn't see a point in doing that until my hack's overworld is nearly complete, since I'd have to set up a 100+ exit overworld to test it anyway).
Edit: It also needs the table file included with the Extended Overworld Level Names patch. (I'd added two lines at the end of that file for the tiles that I'd used for 8 and 9 (8=3D and 9=3F), which you may or may not need.)
|
| Last edited on 2012-02-12 12:24:36 PM by Zeldara109. |
|
| Posted on 2012-02-27 07:13:25 AM |
Link | Quote |
|
OK, now I have a new issue: Sometimes, activating a keyhole will crash the game.
It happens consistently, but not always for any particular keyhole. By that, I mean that if I activate the keyhole in 2-1 or 2-A, the game always crashes, but the exact same keyholes will still work via a pipe from level 105 to 2-1 or 2-A.
From checking various backups of my hack, I seem to have traced it to the time when I was working on this patch-- it crashes in v.127 (after I finished the patch) and future backups, but not in v.126, which was before I fixed the issue with the glitched one's digit and added RPG Hacker's $13BF subroutine.
Any idea why this is occurring?
(I'd list which patches I've used on my hack as well, but the list is rather long. I'm pretty sure I didn't make any changes between v.125 and v.127 other than applying ExOWLNa and perhaps using Lunar Magic, though I did re-apply my main patch with my test code (that displayed the Dragon Coin high score on the in-level status bar) commented out.)
Edit 2012-3-11: The problem seems to have mysteriously solved itself when I reapplied my patches. Perhaps it was some kind of patching issue. I don't know.
Edit 2012-3-24:
I finally figured out what the problem was-- it was actually due to incorrectly fixing a bug in a mostly unrelated patch I'd created, that happens to hijack the goal and keyhole scenes.
(Editing this in since I feel like recording it somewhere but it's not really worth making a post for it.)
Code;;;;;;;;;;;;;;;;;;;;;;;;;;
; Dragon coin high score (overworld display portion is in ExOWLNa.asm) ;
; by Zeldara109 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;
%hijack("org $00C918 : JSL DCHSLabel : BRA $00") ; replaced: STZ $18C2 : STZ $13DE
%hijack("org $01E210 : JSL DCHSKeyhole : NOP") ; replaced: LDA #$30 : STA $1434
DCHSLabel:
STZ $18C2
STZ $13DE
BRA DCHSMain
DCHSKeyhole:
LDA #$30
STA $1434
DCHSMain:
PHX
REP #$30
LDA $010A
AND #$00FF
ASL #7
CLC
ADC $13BF
TAX ; X now contains save file number * 0x80 + translevel number
LDA $1422
AND #$00FF
SEP #$20
CMP $701400,x
BCC DCHSEnd
STA $701400,x
DCHSEnd:
SEP #$10
PLX
RTL
I'd originally included SEP #$30 where the SEP #$20 is now, but that made X 8-bit, when it needed to be 16-bit for save file 3 (otherwise save file 3 would share save file 1's Dragon Coin counts). (I discovered this because I happened to be using all three save files to test my overworld border edits.)
However, when I fixed that earlier issue by splitting the SEP #$30 into a SEP #$20 and a SEP #$10, I'd placed the SEP #$10 before the DCHSEnd label, not after. This meant the game would crash at the goal/keyhole scene if the number of Dragon Coins you'd collected was not at least equal to your existing high score.
That's why it crashed on certain levels' keyholes-- I'd already played their normal exits first (and collected more Dragon Coins on that path). (The reason why I thought it was fixed earlier was because I'd started a new game, and played the keyhole exits I thought were broken before their corresponding normal exits.)
|
| Last edited on 2012-03-25 12:09:28 AM by Zeldara109. |
|
|
Pages: 1  |
|
|
|
|
Forum Index - SMW Hacking - General SMW Hacking Help - ASM & Related Topics - How do I display something on the overworld border? |
|
|
 |
|
 |
The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.
Copyright © 2005 - 2013 - SMW Central Legal Information - Link To UsTotal queries: 27
|
|
|
|