Advertisement
Guest User

Untitled

a guest
Nov 1st, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ; *$3963B-$39784 JUMP LOCATION
  2.     {
  3.         ; MODE 4 SWIMMING
  4.         LDA $4D : BEQ BRANCH_ALPHA ; checks some link handler
  5.         LDA.b #$02 : STA $5D ; sets link to recoil mode, I don't think this instruction is in JP1.0
  6.         STZ $25 ; something with attract mode
  7.         JSR Player_ResetSwimCollision
  8.         STZ $032A ; sets one of the fast swimming counters to 0
  9.         STZ $034F ; sets a similar counter to 0
  10.         LDA $50 : AND.b #$FE : STA $50 ; takes link's ability to change direction and masks it because why...?
  11.         BRL BRANCH_$386B5 ; GO TO RECOIL MODE
  12.     BRANCH_ALPHA: ; mostly sets shit to 0
  13.         STZ $3A ; press status of B/Y
  14.         STZ $3C ; length of b button press
  15.         STZ $3D ; spin attack stuff
  16.         STZ $79 ; spin attack charge counter
  17.         STZ $0308 ; Link carrying stuff
  18.         STZ $0309 ; ↓↓↓
  19.         LDA $7EF356 : BNE .hasFlippers ; checks flippers in mirrored sram
  20.         RTS
  21.     .hasFlippers
  22.         LDA $033C : ORA $033D : ORA $033E : ORA $033F : BNE BRANCH_GAMMA ; load link's swim acceleration and mash em all together, then jump if all of them are 0
  23.         LDA $032B : CMP.b #$02 : BEQ BRANCH_DELTA ; subpixel stuff?
  24.         LDA $032D : CMP.b #$02 : BEQ BRANCH_DELTA ; seems to just do animation
  25.         JSR Player_ResetSwimCollision
  26.     BRANCH_DELTA:
  27.         LDA $2E : AND.b #$01 : STA $2E ; animation step junk
  28.         INC $2D : LDA $2D : CMP.b #$10 : BCC BRANCH_EPSILON ; incrementing some counter then masking it, counts 0-7 in game
  29.         STZ $2D ; set this counter to 0
  30.         STZ $02CC ; zeros some flag/counter
  31.         LDA $2E : AND.b #$01 : EOR.b #$01 : STA $2E ; more animation steps
  32.         BRA BRANCH_EPSILON
  33.     BRANCH_GAMMA:
  34.         INC $2D ; incrementing this counter again
  35.         LDA $2D : CMP.b #$08 : BCC BRANCH_EPSILON ; compare to 7, jump
  36.         STZ $2D ; set to 0
  37.         LDA $2E : INC A : AND.b #$03 : STA $2E : TAX ; animation junk
  38.         LDA $9635, X : STA $02CC ; I think these are link's hands
  39.     BRANCH_EPSILON: ; is this where the speed magic happens
  40.         LDA $034F : BNE BRANCH_ZETA ; jump if faster swimming flag isn't set
  41.         LDA $033C : ORA $033D : ORA $033E : ORA $033F : BEQ BRANCH_THETA ; mash all of link's accelerations together, jump if not 0
  42.         LDA $F6 : AND.b #$80 : STA $00 ; load some face buttons + shoulders and compare for A button press, put that in $00
  43.         LDA $F4 : ORA $00 : AND.b #$C0 : BEQ BRANCH_THETA ; load other buttons and mash with A being pressed, comparison looks for B or Y as new buttons, jumps when not 0
  44.         STA $034F ; store this to the faster swimming flag
  45.         LDA $25 : JSR Player_DoSfx2 ; i wonder what this does hmmmmmmmmmmmmmmmmmmmmmmmmmmmMMMMMMMMMMMMMMM
  46.         LDA.b #$01 : STA $032A ; set the swimming counter thing to 1
  47.         LDA.b #$07 : STA $02CB ; set this other swimming thing to 7
  48.         JSR $98A8 ; $398A8 IN ROM
  49.     BRANCH_ZETA: ; we swimmin slow
  50.         DEC $02CB : BPL BRANCH_THETA ; counts down that one counter, jump to fast swim when we're >=0
  51.         LDA.b #$07 : STA $02CB ;reset that counter to 7
  52.         INC $032A : LDA $032A : CMP.b #$05 : BNE BRANCH_THETA ; when that counter loops, increment this one, go to fast swim when not 0
  53.         STZ $032A ; set that counter to 0
  54.         LDA $034F : AND.b #$3F ; take this anim? counter and mask it
  55.         STA $034F ; then store it
  56.     ; *$39715 LONG BRANCH LOCATION
  57.     BRANCH_THETA:
  58.         LDA $49 : AND.b #$0F : BNE BRANCH_IOTA ; some auto move crap
  59.         LDA $F0 : AND.b #$0F : BNE BRANCH_IOTA ; looks like it's branching on directionals
  60.         STZ $30 ; zero Y speed
  61.         STZ $31 ; zero X speed
  62.         JSR $9785 ; $39785 IN ROM
  63.         LDA $034A : BEQ BRANCH_KAPPA ; branch when that one counter is 0
  64.         LDA $0372 : BEQ BRANCH_LAMBDA ; bonk...?
  65.         LDA $0340 ; when swimming, this seems to be a bitfield for dpad buttons
  66.         BRA BRANCH_IOTA
  67.     BRANCH_LAMBDA:
  68.         LDA $033C : ORA $033D : ORA $033E : ORA $033F : BNE BRANCH_MU ; mash together acceleration again, branch if not 0
  69.         STZ $48 ; prevents link from grabbing stuff
  70.         JSL Player_ResetSwimState
  71.         BRA BRANCH_MU
  72.     BRANCH_KAPPA: ; both of these branch to the same place, but animation step is reset when link isn't in the swim state
  73.         LDA $5D : CMP.b #$04 : BEQ BRANCH_MU
  74.         STZ $2E ; animation step
  75.         BRA BRANCH_MU
  76.     BRANCH_IOTA: ; i think this is looking for dpad input then branching, or zeroing stuff if no input
  77.         CMP $0340 : BEQ BRANCH_NU
  78.         STZ $2A ; Y subpixel
  79.         STZ $2B ; X subpixel
  80.         STZ $6B ; slope collision
  81.         STZ $48 ; grab things flag
  82.     BRANCH_NU:
  83.         STA $0340 ; puts dpad input apparently into this address
  84.         JSR $97A6 ; $397A6 IN ROM
  85.         JSR $97C7 ; $397C7 IN ROM
  86.         JSR $9903 ; $39903 IN ROM
  87.     BRANCH_MU:
  88.         JSR $B64F   ; $3B64F IN ROM
  89.         JSL $07E245 ; $3E245 IN ROM
  90.         JSR $B7C7   ; $3B7C7 IN ROM
  91.         JSL $07E6A6 ; $3E6A6 IN ROM
  92.         STZ $0302
  93.         JSR $E8F0 ; $3E8F0 IN ROM
  94.         RTS
  95.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement