(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-08-24 02:39 PM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - Making Lightning flash in certain levels of Super Mario Bros. 3 New poll | |
Pages: 1 2 3Add to favorites | Next newer thread | Next older thread
User Post
Skreename

Giant Red Paratroopa


 





Since: 11-18-05

Last post: 6295 days
Last view: 6288 days
Posted on 05-16-06 12:45 AM Link | Quote
If I'm not mistaken, a certain register is typically used for essentially random numbers... but I don't remember which one. If there is one, just grab the value from it each time the screen flashes and use that for the number of frames for the next, or something similar.
DahrkDaiz

Nipper Plant
U wan hax Mario?!








Since: 11-17-05

Last post: 6290 days
Last view: 6289 days
Posted on 05-16-06 12:46 AM Link | Quote
I've done this whole flash of lighting trick in my hack. I don't want to dig up the code and document it all but what I did was modify the palette copy kept in RAM (changing this in RAM does effect the palette in the PPU) and switching the bg color from white to the original and so on for a few frames then stopping. I take $15 and added it to two other RAM values to get a random number so that the timer is random, but if the value is too low, I modify to bring it above $80 (ORing the value with 1000 000).
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-16-06 03:14 PM Link | Quote
what is the significance of $80 and the flashing register, im kinda lost about how it works or what exactly it does?
Giga_Bowser_009

Red Paragoomba


 





Since: 04-16-06

Last post: 6507 days
Last view: 6507 days
Posted on 05-16-06 05:52 PM Link | Quote
I'm trying to do it exactly the same way JaSp did. Where it detects whether Nothing ($AB) is the first enemy sprite and if it is then it jumps to the Thunder Routine but if it isn't...Well it doesn't. It's easier that way but I'm still having trouble with it.
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-16-06 06:33 PM Link | Quote
what is the significance of nothing being the first sprite? wouldn't you want to detect the level and go from there?
Giga_Bowser_009

Red Paragoomba


 





Since: 04-16-06

Last post: 6507 days
Last view: 6507 days
Posted on 05-16-06 06:35 PM Link | Quote
That's what I'm trying to do. I also want to get that custom ASM routine to where the Lightning flashes white as you fight Bowser.
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-16-06 06:38 PM Link | Quote
ok well assemble the routine (first edit to fit your needs), but where im losing you is why are you detecting empty sprites?
Giga_Bowser_009

Red Paragoomba


 





Since: 04-16-06

Last post: 6507 days
Last view: 6507 days
Posted on 05-16-06 06:40 PM Link | Quote
That's how JaSp did his routine. The nothing enemy sprite is rarely used so I'm wanting to use it for something.
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-16-06 06:41 PM Link | Quote
what do you plan to use it for?
Giga_Bowser_009

Red Paragoomba


 





Since: 04-16-06

Last post: 6507 days
Last view: 6507 days
Posted on 05-16-06 06:48 PM Link | Quote
The Thunder routine. I need to figure out what is wrong with the code and see if deleting the whole level and put Nothing as the first sprite before putting anything else works. (I've got to try that.)
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-16-06 06:50 PM Link | Quote
what exactly are you refering to by "nothing sprite"? is it a routine, a ram value, a tile in pattern tables?
Giga_Bowser_009

Red Paragoomba


 





Since: 04-16-06

Last post: 6507 days
Last view: 6507 days
Posted on 05-16-06 06:54 PM Link | Quote
All right. Nothing ($AB) is an enemy that you can put with SMB3 Workshop. JaSp made a routine which checks to see if that sprite is the first enemy sprite in the level and if it is then it jumps to the thunder routine. Now you get what I'm saying?
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-16-06 07:00 PM Link | Quote
ok i see and you place that nothing as the first sprite in the levels you want to use the thunder. then you check against it and branch from there if it is nothing else contiue as normal. fair enough.

do you plan to use the routine i posted, because that was slapped together fairly hastily? also how much space in unused rom do you have for adding the routine?
Giga_Bowser_009

Red Paragoomba


 





Since: 04-16-06

Last post: 6507 days
Last view: 6507 days
Posted on 05-16-06 07:13 PM Link | Quote
I have enough unused space around the 003000 offset. I see a bunch FFs there so yeah. I have enough.
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-17-06 01:05 AM Link | Quote
well after looking at the mmc3 specs, i believe it is able to support adding more prg and chr banks. if i calculated correctly smb3 only uses half of its potential in both catagories. bank switching would allow more room to toy with and its not that difficult to do.
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6289 days
Last view: 6289 days
Posted on 05-17-06 08:06 AM Link | Quote
Well, here is my routine with a few coments. It might not be the best anyway because I'm not that good at cleaning up code. If you have any questions, feel free to ask.

$BF10:AD 41 7B * LDA $7B41 = #$AB ; $7B41 is the address of the first sprite in a level
$BF13:C9 AB * CMP #$AB ; checks if it is the sprite $AB
$BF15:D0 15 * BNE $BF2C ; if not, goes to $BF2C
$BF17:A5 15 * LDA $15 = #$6D
$BF19:29 F3 * AND #$F3
$BF1B:D0 0B * BNE $BF28
$BF1D:A9 10 * LDA #$10
$BF1F:8D FB 7C * STA $7CFB = #$00 ; $7CFB is an offset activating an already-existing flashing bg routine in the game, the value stored at it determines how long it flashes
$BF22:EE B2 7D * INC $7DB2 = #$00 ; this was to activate the sound later in the code; I couldn't directly write to any of the $4FX sounds addresses because they were zeroed after this routine before being read to play the sounds, if I remember right
$BF25:8D B5 7D * STA $7DB5 = #$10 ; $7DB5 is a custom-offset I used (replaced from a player2 related offset) to have different sets of colors for the flashing generated by $7CFB. That way in my hack there is a multicolor bg flashing & a white-grey bg flashing
$BF28:20 C0 E2 * JSR $E2C0 ; the routine I replaced (that was at $E738), placed at the end of the new routine
$BF2B:60 * RTS
$BF2C:AD 41 7B * LDA $7B41 = #$AB
$BF2F:C9 47 * CMP #$47 ; checks if it is the sprite $47 (this one activates the grey/white flashing)
$BF31:D0 F5 * BNE $BF28
$BF33:A5 15 * LDA $15 = #$6D
$BF35:29 DE * AND #$DE
$BF37:D0 EF * BNE $BF28
$BF39:A9 10 * LDA #$10
$BF3B:4C B6 BF * JMP $BFB6
(...)
$BFB6:8D FB 7C * STA $7CFB = #$00
$BFB9:EE B2 7D * INC $7DB2 = #$00
$BFBC:A9 00 * LDA #$00
$BFBE:8D B5 7D * STA $7DB5 = #$10
$BFC1:4C 25 BF * JMP $BF25

Note that with this way, it will flash regularly; I didn't bother to try it checking with two different offsets to create a random factor.
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-17-06 10:08 AM Link | Quote
where you reference the sound register (which is what im guessing it is):

    inc $7DB2


is that something in original code that needed to be added, or what purpose does it serve? and does the routine at $E2C0 have any effect on the flashing or is something else i shouldn't be concerned with?

and if the sprite = $AB, then its the color flash, if sprite = $47 its the white/grey flash?

in your hack im assuming you enabled sram.


(edited by never-obsolete on 05-17-06 09:13 AM)
(edited by never-obsolete on 05-17-06 09:39 AM)
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6289 days
Last view: 6289 days
Posted on 05-17-06 03:15 PM Link | Quote
$7DB2 is originally part of player2 offsets, it's increased here so that with another custom routine placed somewhere else, when it's equal to 01 it plays the sound; I couldn't write directly to the original sound offsets in that part of the ROM because they were zeroed and thus the sound wouldn't play.
$E2C0 is a subroutine called somewhere in the ROM, that's where I placed my custom JSR $BF10, so I re-placed a JSR $E2C0 at the end of my routine, but it isn't related to my routine.
You're right with the sprites. Actually, the colors are defined by the offset $7DB5 : according to its value, a different table of colors is loaded for the flashing routine (the table is custom, it wasn't originally in the game).
DahrkDaiz

Nipper Plant
U wan hax Mario?!








Since: 11-17-05

Last post: 6290 days
Last view: 6289 days
Posted on 05-17-06 04:29 PM Link | Quote
Originally posted by never-obsolete
well after looking at the mmc3 specs, i believe it is able to support adding more prg and chr banks. if i calculated correctly smb3 only uses half of its potential in both catagories. bank switching would allow more room to toy with and its not that difficult to do.


Just know I've already expected SMB3 to double it's size and bank swapping is not as easy as you think only because if you start adding enough code, then SMB3 will have executed SO much code that there's a small potential for Vblank to occur mid-bank swap, which basically means your game crashes at random moments (anyone who's beta tested Mario Adventure 2 can attest to this) so you have to figure a way to get around this (I did a small byte check in the PRG bank I was wanting to switch to, if that byte did not match what it should be, attempt to bank swap again.)
never-obsolete

Paragoomba








Since: 05-14-06
From: AZ

Last post: 6290 days
Last view: 6290 days
Posted on 05-17-06 04:52 PM Link | Quote
yes ive already taken the NMI into account because ive had similar promblems with different mappers. i had a the nmi check for what the "original" banks should be and switch them, and then just before the rti, switch back.


(edited by never-obsolete on 05-17-06 03:53 PM)
Pages: 1 2 3Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - Making Lightning flash in certain levels of Super Mario Bros. 3 |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.026 seconds; used 433.55 kB (max 553.48 kB)