Langue…
13 utilisateurs en ligne: anonymousbl00dlust,  bebn legg, Davidkizajr, FedoraFriday, Hiro, Klug, LinkVideo64, NerDose, oyok, Rohan2401, TheOrangeToad, TS_N, Zavok - Invités: 70 - Robots: 154
Utilisateurs: 55 645 (2 434 actifs)
Dernier utilisateur: Rohan2401

Forced cape flight state

So, i have been experimenting with some code.
I worked with the LX5 patch for additionnal power ups, combining it with Darolac L/R Power-up selector. Wich mean switching your powerup state with L or R.

They work together no problem. But, i wanted to get a bit more from it. I tried to add some extra to it. Right now i am switching from the shell suit powerup and the cape. When i switch to the shell suit, i wanted it to always be in it,s shell state. I pretty much got this part covered.

On the other hand, i wanted to make so when i switch back to the cape, that i go into regular flight state. I tried to find something in the ram/rom to help me achieved that but all my attempt so far was unsuccessfull.

Anybody know which value i should check to achieve that?


The RAM address you're looking for is $1407. Setting that to a non-zero value will activate flight. Though, there are two limitations worth noting that you'll want to sort out depending on what you're doing:
1) The address also controls the animation and behavior of the flight, so you won't want to store the same value to it every frame or it'll make things function weird.
2) If the player isn't holding X/Y when you activate flight, it will end immediately the frame you stop writing to $1407.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
So i have been trying to get around some issue.
I have tried to compare the flight value to prevent mario from initiating the flight everyframe. However it does not work as i was expecting. I keep getting the weirdest result.

This is what i got the closest to what i wanted but it still get mario in a weird glitched state where physic is barely a suggestion. I isolated the part that i added for flight betwen lines in the example below. Without that addition the code work fine (Except for the fact that i want mario in a flight state when pressing R).

What am i still doing wrong?

Code
;  Powerup selector with L/R, by Darolac
; This code allows to gain a configurable powerup after pressing L, R or both. 

!powerup1 = $02 ; powerup status that is gained upon pressing R: #$00 = small; #$01 = big; #$02 = cape; #$03 = fire.

!powerup2 = $0F ; powerup status that is gained upon pressing L. 


!R = 1  ; set this to 0 if you don't want to gain a powerup after pressing R.
!L = 1 ; set this to 0 if you don't want to gain a powerup after pressing L.

main:

lda $9D
ora  $13D4|!addr
bne .ret
lda $18
if !R
bit #$10
beq +
ldy #!powerup1
sty $19
+
;---------------------------------------------------------------------------
LDA $1407	; load the flight state
CMP #$00	; compare the loaded value with 00
BEQ .once	; Execute the code below if equal
LDA $00		; load the flight state 00 in the accumulator
STA $1407	; Set the flight state
.once		; End of comparaison
;---------------------------------------------------------------------------
endif


if !L
bit #$20
beq +
ldy #!powerup2
sty $19
+
endif
.ret
rtl


Also i just realised that my added CMP might be messing with the .ret one


Code
LDA $00		; load the flight state 00 in the accumulator
STA $1407	; Set the flight state

You're probably getting weird results because you're loading the address $00, not the value #$00.

Also, I'm assuming you're intending to write a non-zero value there instead, since with #$00 that code will effectively never do anything since the comparison in the previous lines guarantees $1407 already has a value of #$00.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
I have been able to solve the issue with your help.
It,s a bit weird but it is consistent.
Now let's see if it is possible to make something actually fun with it..

Anyway thanks for the support once again.
One of these day i will get gud at asm.