NSMBW_Float

by hwailaluta

Game:

Description:

;Use this as level or gamemode 14 (both must be in "main:").

;This one allows the player to do a mini-spinjump in the air with a tiny boost upwards by pressing A in midair,
;much like in NSMBW, where you shake the wii remote.

!Freeram_SpinTimer	= $FF		;>[1 byte], timer before the player stops spinning.

!AllowSpinAfterSpin	= 1		;>0 = only allow if normal jump, 1 = can spin reguardless of the first jump's type.
 !Freeram_JumpTypSav	= $61		;>Player would revert back to the last jump before performing a spin (only if above option = 1).
!AirSpinLast		= $FF		;>How long the player's pose spins after peforming it.
!AirspinRecoilLast	= $0F		;>How long the player is unable to spin while in midair after the first spin.
!AJJumpBoostType	= 0		;>0 = set Y speed to specific value (below), 1 = mario's current Y speed is based on the resulting speed.
!Yspeed			= $E0		;>Use values $80 to $FF. $80 is the fastest/highest.
!AirSpinSFXNumb		= $04		;>Sound number, put $00 to play nothing (will not clear the RAM)
!AirSpinSFXRam		= $1DFC		;>Sound RAM.

;Note: Freeram is not autoconverted to SA-1 address. This is in case if you wanted to use freeram that the SA-1
;patch itself creates.

main:
	.Airspin
    LDA $72
    CMP #$24
    BEQ ..Return
	..SpinTimer
	LDA $9D			;\If frozen, don't decrement.
	ORA $13D4+!addr		;|
	BNE ..Return		;/
	LDA !Freeram_SpinTimer	;\If timer clear, don't decrement
	BEQ ...NoDecrement	;/
	DEC			;
	CMP #!AirspinRecoilLast
	BNE ...Decrement 
	if !AllowSpinAfterSpin != 0
		PHA
		LDA !Freeram_JumpTypSav ;\Revert to last jump type. 
		STA $140D+!addr		;/
		PLA
	else
		STZ $140D+!addr		;>Revert to normal jump.
	endif

	...Decrement
	STA !Freeram_SpinTimer	;>Decrement timer

	...NoDecrement
	...DontSetPose
	..AirSpinMain
	LDA $75			;>If water
	ORA $1407+!addr		;>or cape flying
	;ORA $xxxxxx		;>Or freeram
	if !AllowSpinAfterSpin != 0
		ORA $140D+!addr		;>If prior spinjumping,
	endif
	BNE ..Return		;>Then don't allow.	
	LDA !Freeram_SpinTimer	;\Player cannot spin if already spinning OR in recoil
	BNE ..Return		;/
	LDA $77			;\Being On the floor
	AND.b #%00000100	;/
	BNE ..Return		;>If on floor, return
	LDA $18			;\If not pressing spinjump return
	BPL ..Return		;/

	...BoostPlayer
	if !AJJumpBoostType == 0
		LDA #!Yspeed	;\Ajust Y speed
		STA $7D
	else
		LDA $7D
		SEC
		SBC.b #!Yspeed-3
		STA $7D
	endif

	;Note to self: Timer values have 2 ranges: 0 to !AirspinRecoilLast-1 is when the player cannot airspin,
	;while !AirspinRecoilLast to !AirSpinLast is the spinning pose.

	LDA.b #!AirspinRecoilLast+!AirSpinLast	;\This is so that the amount of time of airspin last is always the same
	STA !Freeram_SpinTimer			;/when changing the recoillast.

	if !AirSpinSFXNumb != 0
		LDA #!AirSpinSFXNumb			;\SFX
		STA !AirSpinSFXRam+!addr		;/
	endif
	if !AllowSpinAfterSpin != 0
		LDA $140D+!addr		;\Save jump type
		STA !Freeram_JumpTypSav	;/
	endif
	LDA #$01		;\Spinjump
	STA $140D+!addr		;/
	..Return

	RTL
back to listings