Help with a basic screenfade/transition 4.1.5 (solved)

mouse spirit

Well-known member
Is there a relatively simple way to use fades, or was it never really fleshed out? Also if anyone knows a good link or has some advice i would like to know.

I just want my cutscene screens to fade in and out black.
Kinda slowly or somethin.I did see some stuff from dale coop from 2019 but wanted to make sure i had up to date information if anyone could supply it.
 

AllDarnDavey

Active member
dale_coop has a fade to black script.

It's supposed to be for 4.1.5 I think. I haven't touched that version in forever, but I did convert this to 4.5.6 pretty easily, so it probably works fine. Fading in is a little harder I'm afraid, requires extra variables to store palette values too, but I think there's a script somewhere if you search deep enough.
 

Mugi

Member
i restored the handlefades asm that was left in the older version of nesmaker back in the day, and while it's sort of inefficient, it does work and it's fairly easy to use with macros.

http://nesmakers.com/viewtopic.php?f=36&t=2480#p15412
http://nesmakers.com/viewtopic.php?f=36&t=2480&start=10#p15730

this code is for 4.1.4/4.1.5 though, and will most likely not work on the current version of nesmaker.
 

mouse spirit

Well-known member
So i read all the info and warnings and advice and have it installed fine,i think.
Without using the macro i get no errors.
But when i actually use the macro, starting up my game makes a bunch of addresses
unlocatable.

xfhzdafhadh.png

Do i have to "activate" macro arguments somehow?Or initialize?
Honestly im guessing here.
 

voltopt

Member
I'll look around the Fade In script too. As far as the Fade Out, Dale's Monster AI works great, you just need to update "updatePalettes" to "updateScreenData" for 4.5.6


Dale Coop's fade out AI script, updated for 4.5.6

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; do fading to black for background pals
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	LDX #$00 
doFadeCurrentBckPal:
	LDA bckPal,x ;; loads joes pallete for background (0-3) (4-7) (8-11) (12-15) 4,8,and 12 is not needed since its the same bgcolor as 0
	CMP #$10 ;; compares 10
	BCC + ;; if less than 10 skip to p1, if not continue below
	SEC ;; needs for subtraction
	SBC #$10 ;; subtract #$10
	STA bckPal,x ;; store it back into pallete
	JMP goNextBckPal;; jump to the next pal2
	+ 
	LDA #$0F ;; set accumalator to 0F which is (black)
	STA bckPal,x ;; store it into pallete
goNextBckPal:
	INX	
	CPX #4
	BEQ goNextBckPal
	CPX #8
	BEQ goNextBckPal
	CPX #12
	BEQ goNextBckPal
	CPX #16
	BCC doFadeCurrentBckPal

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; do fading to black for sprite pals
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	LDX #$00 
doFadeCurrentSpritePal:
	LDA sprPal,x ;; loads joes pallete for background (0-3) (4-7) (8-11) (12-15) 4,8,and 12 is not needed since its the same bgcolor as 0
	CMP #$10 ;; compares 10
	BCC + ;; if less than 10 skip to p1, if not continue below
	SEC ;; needs for subtraction
	SBC #$10 ;; subtract #$10
	STA sprPal,x ;; store it back into pallete
	JMP goNextSpritePal;; jump to the next pal2
	+ 
	LDA #$0F ;; set accumalator to 0F which is (black)
	STA sprPal,x ;; store it into pallete
goNextSpritePal:
	INX	
	CPX #4
	BEQ goNextSpritePal
	CPX #8
	BEQ goNextSpritePal
	CPX #12
	BEQ goNextSpritePal
	CPX #16
	BCC doFadeCurrentSpritePal



	;; Important you need to load a non 0 number into updatePalettes and do a RTS so it can work.
	;; If you want to do palletes use "sprPal" instead of "bckPal"
	LDA #$01
	STA updateScreenData
RTS
 

mouse spirit

Well-known member
Nice. Im on 4.1.5. Yeah maybe ill try the dale_coop way. Im sure mugi's way is great too, whatever works is good
 

Mugi

Member
your errors look like you ran out of space on your code bank (im assuming bank14)
I did mention that the macro tends to eat space and if you're tight on it already (as most people are) this happens pretty fast.
 

mouse spirit

Well-known member
Can this go faster? Like go black quicker?

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; do fading to black for background pals
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	LDX #$00 
doFadeCurrentBckPal:
	LDA bckPal,x ;; loads joes pallete for background (0-3) (4-7) (8-11) (12-15) 4,8,and 12 is not needed since its the same bgcolor as 0
	CMP #$10 ;; compares 10
	BCC + ;; if less than 10 skip to p1, if not continue below
	SEC ;; needs for subtraction
	SBC #$10 ;; subtract #$10
	STA bckPal,x ;; store it back into pallete
	JMP goNextBckPal;; jump to the next pal2
	+ 
	LDA #$0F ;; set accumalator to 0F which is (black)
	STA bckPal,x ;; store it into pallete
goNextBckPal:
	INX	
	CPX #4
	BEQ goNextBckPal
	CPX #8
	BEQ goNextBckPal
	CPX #12
	BEQ goNextBckPal
	CPX #16
	BCC doFadeCurrentBckPal

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; do fading to black for sprite pals
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	LDX #$00 
doFadeCurrentSpritePal:
	LDA spritePalFade,x ;; loads joes pallete for background (0-3) (4-7) (8-11) (12-15) 4,8,and 12 is not needed since its the same bgcolor as 0
	CMP #$10 ;; compares 10
	BCC + ;; if less than 10 skip to p1, if not continue below
	SEC ;; needs for subtraction
	SBC #$10 ;; subtract #$10
	STA spritePalFade,x ;; store it back into pallete
	JMP goNextSpritePal;; jump to the next pal2
	+ 
	LDA #$0F ;; set accumalator to 0F which is (black)
	STA spritePalFade,x ;; store it into pallete
goNextSpritePal:
	INX	
	CPX #4
	BEQ goNextSpritePal
	CPX #8
	BEQ goNextSpritePal
	CPX #12
	BEQ goNextSpritePal
	CPX #16
	BCC doFadeCurrentSpritePal



	;; Important you need to load a non 0 number into updatePalettes and do a RTS so it can work.
	;; If you want to do palletes use "spritePalFade" instead of "bckPal"
	LDA #$01
	STA updatePalettes
	;;;Blank script
	
RTS
 

mouse spirit

Well-known member
Very cool answer alldarn. I will try that.I just wasnt real sure how this was even going so slow in the first place.
 

mouse spirit

Well-known member
Maybe it did something, but not what i wanted. It just skipped more colors, which technically was slightly faster. I messed with my monster object and could do some stuff to make it faster but still not what i wanted .

I ended up keeping a ling fadeout and thats fine. Thanks for trying, im just picky. Solved though.
 

AllDarnDavey

Active member
How are you triggering the script?

If the script is triggered every frame it should only take 5 frames max to fade to black... Maybe it's not the script but how often the script is triggered?
 

mouse spirit

Well-known member
Id say it happens every 4.1.5 seconds. Joking but a little more than 4 seconds. But i figured it out.It happens ones each state. Had to use 4 states at 1 second each and yes,its once a state.My bad, but we did it.

Its actually really cool and useful now. Well, even moreso than before. For a cutscene its worth a monster. But in game....i guess id put it on a tile?

Now can it fade in also?
 
Top Bottom