diff --git a/ootw/alien.s b/ootw/alien.s index 6e837f03..120ca964 100644 --- a/ootw/alien.s +++ b/ootw/alien.s @@ -32,6 +32,8 @@ A_WALKING = 1 A_RUNNING = 2 A_CROUCHING = 3 A_TURNING = 4 +A_YELLING = 5 +A_SHOOTING_UP = 6 ;======================================= ; Move alien based on current state @@ -46,13 +48,21 @@ move_alien: lda alien_state+ALIEN_STATE,X - cmp #P_WALKING + cmp #A_WALKING beq move_alien_walking - cmp #P_RUNNING + cmp #A_RUNNING beq move_alien_running + cmp #A_YELLING + beq move_alien_yelling done_move_alien: rts + ;====================== + ; yelling +move_alien_yelling: + inc alien_state+ALIEN_GAIT,X ; cycle through animation + rts + ;====================== ; walking @@ -109,6 +119,7 @@ astate_table_lo: .byte alien_standing ; 00 @@ -116,6 +127,7 @@ astate_table_hi: .byte >alien_running ; 02 .byte >alien_crouching ; 03 .byte >alien_turning ; 04 + .byte >alien_yelling ; 05 ; Urgh, make sure this doesn't end up at $FF or you hit the ; NMOS 6502 bug @@ -279,6 +291,51 @@ alien_draw_turning: +;=============================== +; Yelling +;================================ + +alien_yelling: + lda alien_state+ALIEN_GAIT,X + and #$10 + + lsr + lsr + and #2 + tay + + lda alien_yell_progression,Y + sta INL + + lda alien_yell_progression+1,Y + sta INH + + jmp finally_draw_alien + + +;=============================== +; Shooting Upward +;================================ + +alien_shooting_up: + lda alien_state+ALIEN_GAIT,X + and #$10 + + lsr + lsr + and #2 + tay + + lda alien_shoot_up_progression,Y + sta INL + + lda alien_shoot_up_progression+1,Y + sta INH + + jmp finally_draw_alien + + + ;============================= ; Actually Draw Alien ;============================= diff --git a/ootw/ootw_c2_cage.s b/ootw/ootw_c2_cage.s index 76bf3014..e21253b3 100644 --- a/ootw/ootw_c2_cage.s +++ b/ootw/ootw_c2_cage.s @@ -69,6 +69,8 @@ cage_loop: sta YPOS lda CAGE_AMPLITUDE + cmp #3 + beq cage_amp_2 cmp #2 beq cage_amp_2 cmp #1 @@ -171,15 +173,44 @@ patrolling_right: sta alien0_state patrolling_move: - jsr move_alien - jsr draw_alien + lda CAGE_AMPLITUDE + cmp #2 + beq guard_yelling + cmp #3 + beq guard_shooting + + jmp guard_move_and_draw + +guard_yelling: + + lda alien0_x + cmp #21 + bne guard_move_and_draw + + lda #A_YELLING + sta alien0_state + jmp guard_move_and_draw guard_shooting: ; guard shooting + lda alien0_x + cmp #21 + bne guard_move_and_draw + lda #A_SHOOTING_UP + sta alien0_state + jmp guard_move_and_draw + + + +guard_move_and_draw: + + jsr move_alien + jsr draw_alien + jmp done_cage_guard done_cage_guard: @@ -204,10 +235,15 @@ check_amp1: check_amp2: cmp #2 bne check_amp3 - + ; if amp=2, guard shouts + jmp cage_continue check_amp3: cmp #3 + bne check_amp4 ; if amp=3, guard shoots + +check_amp4: + cmp #4 ; if amp=4, cage falls bne cage_continue diff --git a/ootw/ootw_graphics/sprites/sprites_alien.inc b/ootw/ootw_graphics/sprites/sprites_alien.inc index f983808b..d6ab1f5b 100644 --- a/ootw/ootw_graphics/sprites/sprites_alien.inc +++ b/ootw/ootw_graphics/sprites/sprites_alien.inc @@ -395,3 +395,60 @@ alien_turning_sprite: .byte $aa,$77,$55,$aa,$aa .byte $07,$aa,$05,$aa,$aa .byte $00,$aa,$00,$aa,$aa + + +;===================== +;===================== +; YELLING +;===================== +;===================== + +alien_yell_progression: + .word alien_yelling_1 + .word alien_yelling_2 + +alien_yelling_1: + .byte $5,$8 + .byte $aa,$7a,$57,$75,$aa + .byte $0a,$a7,$07,$00,$aa + .byte $00,$aa,$00,$77,$aa + .byte $aa,$55,$10,$77,$7a + .byte $aa,$aa,$00,$00,$a7 + .byte $aa,$aa,$55,$77,$aa + .byte $aa,$aa,$a5,$07,$aa + .byte $aa,$0a,$00,$00,$aa + +alien_yelling_2: + .byte $5,$8 + .byte $aa,$7a,$57,$75,$aa + .byte $00,$77,$07,$00,$aa + .byte $0a,$5a,$00,$77,$aa + .byte $aa,$a5,$10,$77,$7a + .byte $aa,$aa,$00,$00,$a7 + .byte $aa,$aa,$55,$77,$aa + .byte $aa,$aa,$a5,$07,$aa + .byte $aa,$0a,$00,$00,$aa + + +;===================== +;===================== +; SHOOTING UPWARD +;===================== +;===================== + +alien_shoot_up_progression: + .word alien_shooting_up_sprite + .word alien_shooting_up_sprite + .word alien_yelling_1 + .word alien_yelling_2 + +alien_shooting_up_sprite: + .byte $5,$8 + .byte $00,$7a,$57,$75,$aa + .byte $00,$77,$07,$00,$aa + .byte $55,$aa,$00,$77,$aa + .byte $aa,$55,$10,$77,$7a + .byte $aa,$aa,$00,$00,$a7 + .byte $aa,$aa,$55,$77,$aa + .byte $aa,$aa,$a5,$07,$aa + .byte $aa,$0a,$00,$00,$aa