User | Post |
Glyph Phoenix
Posts: 574/745 |
This will be better than having to make a custom palette every level, but still, I'm not too fond of subroutining each level by hand. I think I'll start working on a spriteASM system instead.
But I shouldn't look a gift blob in the mouth. I don't want to be Rising Meatloaf Backhand Combo'd. |
d4s
Posts: 312/325 |
heres my code that writes the current level number to a certain variable. ive attached the overworld zones, too, my code handles them as level numbers $200-$204. because overworld hdma stuff tends to be buggy, i havent documented it, but you can enable hdma effects on the overworld by adding 5 more level slots to the levelattributes file in my hdma pack. heres the subroutine for that without comments, but its not hard at all, just a tad messy. :>
SmwCalculateLevelNumber: php rep #$30 lda.w $13BF ;get games level number cmp.w #$01FF bpl SmwProcessOverworldNumber cmp.w #$0024 ;check if level number is below $24 bmi SmwDontAddLevelNumber clc adc.w #$00dc SmwDontAddLevelNumber:
sta.w SmwLevelNumberLo SmwDontProcessLevelNumber: plp rts SmwProcessOverworldNumber: lda.w $1F11 and.w #$00ff clc adc.w #$0200 bra SmwDontAddLevelNumber |
BMF98567
Posts: 1151/1261 |
$010C. The level number's 16-bit. |
HyperLamer
Posts: 7181/8210 |
Hey, where does it stick the high bit? (To determine whether you're in level 0xx or 1xx.) |
BMF98567
Posts: 1149/1261 |
Originally posted by d4s am i wrong when i'm saying you got the inspiration for that level-based selection from my hdma pack? :> anyway, cool stuff.
Well, maybe just a little. I knew I forgot to add something to the README...
Just out of curiosity, how did you find the current level number? The game temporarily writes it to $0E during the level-loading routine, so I just hacked it to write to $010B as well (which is never erased). |
d4s
Posts: 311/325 |
am i wrong when i'm saying you got the inspiration for that level-based selection from my hdma pack? :> anyway, cool stuff. |
HyperLamer
Posts: 7152/8210 |
Originally posted by BMF54123 I can finally [...] alter the message box code to load different messages for sub-levels...
You do and I'll... uh... be very thankful. |
Tweaker
Posts: 56/57 |
Heh, awesome how something so simple can make things so much easier.
Great job, BMF. You never cease to amaze me. |
BMF98567
Posts: 1147/1261 |
Aww, I'm sorry.
In response to your post in my other thread: the levelnum.ips patch included in this package is all you need to get the current level number. The miniscule hack simply snags the number during the level loading routine, before it's erased, and stores it at $010B.
Knowing the current level number will allow me to overhaul practically everything in my hack...I can finally assign HDMA effects by level (as d4s's system does), or alter the message box code to load different messages for sub-levels... |
Smallhacker
Posts: 2104/2273 |
Level ASM? Executes code depending on level number instead of palettes? Damn! I was planning on doing that! |
The Kins
Posts: 569/595 |
Sounds like chocolate.
Can't wait to see what the ASM people come up with using this. |
BMF98567
Posts: 1145/1261 |
Using top-secret technology previously revealed in my "Name That Level!" thread, I have come up with a level-number-based successor to palette-based ASM: LevelASM!
Just call it "PALASM - The Next Generation."
RELEVANT LINKAGE
Complete instructions are in the README. Enjoy! |