Banner
Views: 925,030,727
Time:
27 users online: anonimzwx,  Anorakun, AppleBoy54321, Black Goku, CalHal, carlos_5yo, Coockie1173, dashlet, edgar, Epic_stuff, Evernn, Francium, Golden Yoshi, h.carrell, Hooded Edge,  idol, Jolpengammler, lx5,  Nameless, NGB, rafaelfutbal, Schwarti, SJandCharlieTheCat, Stivi, umbreon3209,  xHF01x, zjplayer - Guests: 69 - Bots: 89 Users: 51,724 (2,065 active)
Latest: carlos_5yo
Tip: Be aware that if you put a coin over a question block, unless you apply this hex edit, it will create an invisible solid block above the ? Block if the block is hit first.
Not logged in.
How to add a delay in an uberasm code
Forum Index - SMW Hacking - SMW Hacking Help - How to add a delay in an uberasm code
Pages: « 1 » Link
I am working on an uberasm that swaps the players gfx on the overworld. Thing is the transition needs to happen during a fade out and fade in. The transition loads a value to a ram address in order to swap the gfx but currently it is happening too quickly and swaps the gfx before the fade effect. Anyone know how to do this?

--------------------
Trust the Fungus.
You could try checking for when $0DAE is at 0 (complete black screen) before setting the ram address to swap.
Well that's the part I don't understand how to do. I understand having the routine skipped if a value isn't met but the routine relies on pushing the L button so I'm not sure how to loop it back around to check the value again.

--------------------
Trust the Fungus.
This is just an example I quickly wrote up and untested, but here's what it would roughly look like. Commented it so you know what's going on and how it works.

Code
!FreeRam = $0F5E

PlayerSwap:
LDA !FreeRam	;If ram flag is set, wait until routine is finished before L can be pressed again
BNE StartSwap
LDA $18		;If player presses L, set flag to begin swap
AND #$20
BNE PressedL
RTS

PressedL:
INC !FreeRam	;Sets flag to #$01
RTS

StartSwap:
LDA !FreeRam	;Waits for screen fade to black then moves on
CMP #$02	;once flag is set to #$02
BEQ FadeIn
LDA $0DAE	;Once brightness register makes the screen black (#$00)
BEQ Dark	;swap players and moves on to next step
DEC $0DAE	;Decrease Brightness until #$00 (black)
RTS

Dark:
LDA $0DB3	;Don't know what your code is but for this example
EOR #$01	;this swaps Mario to Luigi
STA $0DB3	;Whatever your swap routine is would go here
INC !FreeRam	;Flag set to #$02
RTS

FadeIn:			
LDA $0DAE	;If flag is #$02, wait until the screen reaches full brightness (#$0F)
CMP #$0F
BEQ Done
INC $0DAE	;Increase brightness until fully lit again
RTS

Done:
STZ !FreeRam	;Resets flag ends the swap
RTS
Unfortunately my switching routine involves loading the levels (gamemode #$0F) and then snapping the player back to the overworld (GameMode #$0B in order to trigger luigi's switch. $0DB3 doesnt work right if you do it on the overworld. Only way I could make the Press R to Switch Mario and Luigi uberasm work is to trick the game into thinking its fading to a level where i then load luigi's info and then bringing back to the overworld. Problem is if this gets interrupted with RTL's the code breaks. Im trying to expand on this uberasm to accommodate more characters and I got something working but when it comes to other characters they switch their little map gfx before the fade and I can't seem to get your method to work with it.

--------------------
Trust the Fungus.
Pages: « 1 » Link
Forum Index - SMW Hacking - SMW Hacking Help - How to add a delay in an uberasm code

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2021 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks