Light World ~ Turtle Rock Peg Positions

View previous topic View next topic Go down

20151106

Post 

Light World ~ Turtle Rock Peg Positions




Code:
; ==============================================================================

    ; $75D61-$75D66
    LwTurtleRockPegPositions:
    {
        dw $0826
        dw $05A0
        dw $081A
    }

    ; *$75D67-$75DFB LONG
    HandlePegPuzzles:
    {
        LDA $8A : CMP.w #$0007
       
        BNE .notLwTurtleRock
       
        LDA $7EF287 : AND.w #$0020
       
        BNE .warpAlreadyOpen
       
        ; Y in this routine apparently contains the map16 address of the peg tile that Link hit
        STY $00
       
        LDX $04C8 : CPX.w #$FFFF
       
        BEQ .puzzleFailed
       
        ; As you all probably realize, the 3 pegs in this area have to be hit in a specific order
        ; in order for the warp to open up. If you fail, you have to exit the screen and come back.
        ; That's what $04C8 being -1 (0xFFFF) indicates
        LDA LwTurtleRockPegPositions, X : CMP $00
       
        BNE .puzzleFailed
       
        ; Play the successful puzzle step sound effect
        LDA.w #$2D00 : STA $012E
       
        ; Move to the next peg
        INX #2 : STX $04C8 : CPX.w #$0006
       
        BNE .puzzleIncomplete
       
        ; Play mystery solved sound effect
        LDA.w #$1B00 : STA $012E
       
        ; Set a flag so that next time we enter this screen
        ; The puzzle will already be complete
        LDA $7EF287 : ORA.w #$0020 : STA $7EF287
       
        SEP #$20
       
        LDA.b #$2F : STA $11
       
        REP #$20
   
    .puzzleIncomplete
   
        LDX $00
       
        RTL
   
    .puzzleFailed
   
        LDA.w #$003C : STA $012E
        LDA.w #$FFFF : STA $04C8
       
        LDX $00
   
    .warpAlreadyOpen
   
        RTL
   
    .notLwTurtleRock
   
        CMP.w #$0062
       
        BNE .notDwSmithyHouse
       
        INC $04C8
       
        LDA $04C8 : CMP.w #$0016
       
        BNE .notEnoughPegs
       
        PHX
       
        SEP #$20
       
        LDA $7EF2E2 : ORA.b #$20 : STA $7EF2E2
       
        LDA.b #$1B : STA $012F
       
        REP #$20
       
        LDA.w #$0050 : STA $0692
        LDA.w #$0D20 : STA $0698
       
        JSL Overworld_DoMapUpdate32x32_Long
       
        REP #$30
       
        PLX
   
    .notDwSmithyHouse
    .notEnoughPegs
   
        RTL
    }

    ; $75DFC-$75E28 LONG
    {
        LDA $B0 : BNE BRANCH_ALPHA
       
        LDA.b #$29 : STA $012E
       
        JML $0EF404 ; $77404 IN ROM
   
    BRANCH_ALPHA:
   
        JSL $00EEF1 ; $6EF1 IN ROM
       
        REP #$30
       
        LDA $7EC009 : CMP.w #$00FF : BNE BRANCH_BETA
       
        STA $7EC007
        STA $7EC009
       
        SEP #$30
       
        INC $B0
       
        RTL
   
    BRANCH_BETA:
   
        JML $0EF48C ; $7748C IN ROM
    }

avatar
SePH



Since : 2012-06-19

Back to top Go down

Share this post on: diggdeliciousredditstumbleuponslashdotyahoogooglelive

 
Permissions in this forum:
You cannot reply to topics in this forum