Idle or Duck not animating in [4.1]?

AllDarnDavey

Active member
I found a bug that my character idle would play but not animate in 4.1 (you'd only get the first frame no matter what), same thing happens if you have a duck set up for Action5. It's a tiny bug in the ExtraControllReadCode.asm file. It changes the object state to idle if you're on the ground not moving or pressing anything, and changes to a duck state if you're on the ground not moving and only pressing down, but it doesn't look to see if you are already in that state first, so the animation never plays because it constantly sets it back to the starting frame. I made a simple fix. Just update your ExtraControllReadCode.asm with the changes below.

Code:
ExtraInputControl:

    ;;; occasionally, there is input code that may be very specific, and it may be 
    ;;; difficult to implement via the visual interface and accompanying scripts.
    ;;; this is a code that runs after all input checks, and allows for custom ASM.
    LDA gameState
    CMP #GS_MainGame
    BEQ doMainGameUpdates
    JMP skipMainGameExtraInputControl
doMainGameUpdates:  
    LDX player1_object

    GetCurrentActionType player1_object
    STA temp
    LDA Object_physics_byte,x
    AND #%00000010
    BEQ isNotClimbing
    LDA temp
    CMP #$04
    BNE isNotClimbing
    LDA gamepad
    AND #%11000000
    BEQ noDirWhileClimbing
    ChangeObjectState #$02, #$04
noDirWhileClimbing:
    ;;; is climbing.
    ;;; which means don't check to change to idle.
   JMP skipMainGameExtraInputControl
isNotClimbing:
    LDA temp
    CMP #$03 ;; is it shooting (shooting is same anim in air and on ground)
    BNE isNotAttackingAction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    JMP skipMainGameExtraInputControl
isNotAttackingAction:   

    
    LDA gamepad
    AND #%11000000 ;;; left and right
    BEQ dontskipMainGameExtraInputControl
    JMP skipMainGameExtraInputControl
dontskipMainGameExtraInputControl:
    ;;; if left and right are not pressed
    
    LDA screenFlags
    AND #%00100000 ;; does it use gravity?
                    ;; if it does not, it would not have jumping or ducking, so
                    ;; skip state updates for jumping and ducking.
    BEQ notDucking ;; just will change to idle.

    LDA Object_physics_byte,x
    AND #%00000001 ;; if is in air
    BNE notInAir
    GetCurrentActionType player1_object
    STA temp
    CMP #$02 ;; is it already state 2?
    BEQ skipMainGameExtraInputControl 
    ChangeObjectState #$02, #$04
    JMP skipMainGameExtraInputControl
notInAir:
    LDA Object_h_speed_lo,x
    ORA Object_h_speed_hi,x
    BNE skipMainGameExtraInputControl
    ;;;; controller is not pressed
    ;;;; horizontal speed is zero.
    ;; check to see if in air, shooting, etc.
     LDA gamepad
    AND #%00100000 ; if down is pressed
    BEQ notDucking
    LDA temp
    CMP #$05 ;; is it already state 5?
    BEQ skipMainGameExtraInputControl    
    ChangeObjectState #$05, #$04
     JMP skipMainGameExtraInputControl
skipMainGameExtraInputControl:  
    
    RTS     
notDucking:
    LDA gamepad
    AND #%11100000
    BNE skipMainGameExtraInputControl 
    LDA temp
    CMP #$00 ;; is it already state 0?
    BEQ skipMainGameExtraInputControl    
    ChangeObjectState #$00, #$04
 

AllDarnDavey

Active member
dale_coop said:
Same than this ?
http://www.nesmakers.com/viewtopic.php?p=10294#p10294

Of course a fix already existed and I just didn't search the forums well enough. Oh well, it was a good asm exercise for me anyway.
 
Top Bottom