From 09fd63ecc5dc335886965dde822e862ab78a3018 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 18 Aug 2020 02:25:51 -0400 Subject: [PATCH] mist: nibel: add animated head over projector --- mist/default_save.s | 2 + mist/graphics_nibel/Makefile | 5 +- mist/loadstore.s | 2 +- mist/nibel.s | 5 + mist/nibel_switches.s | 211 ++++++++++++++++++++++++++++++++++- mist/playthrough_save.inc | 1 + mist/zp.inc | 3 +- 7 files changed, 225 insertions(+), 4 deletions(-) diff --git a/mist/default_save.s b/mist/default_save.s index f31b469a..1285c76a 100644 --- a/mist/default_save.s +++ b/mist/default_save.s @@ -156,4 +156,6 @@ .byte $00 ; SELENA_ANTENNA_ACTIVE = $D5 .byte $00 ; SUB_DIRECTION = $D6 .byte $00 ; SUB_LOCATION = $D7 +.byte $00 ; NIBEL_PROJECTOR = $D8 .endif + diff --git a/mist/graphics_nibel/Makefile b/mist/graphics_nibel/Makefile index ff8b1c1c..f8cd1edb 100644 --- a/mist/graphics_nibel/Makefile +++ b/mist/graphics_nibel/Makefile @@ -32,7 +32,8 @@ nibel_graphics.inc: \ shack_hallway_n.lzsa shack_hallway_s.lzsa \ shack_exit_n.lzsa shack_exit_s.lzsa \ shack_center_n.lzsa shack_center_s.lzsa \ - shack_entrance_n.lzsa shack_entrance_s.lzsa shack_entrance_open_n.lzsa + shack_entrance_n.lzsa shack_entrance_s.lzsa shack_entrance_open_n.lzsa \ + shack_entrance_playing_s.lzsa echo "elevator2_open_top_lzsa: .incbin \"elevator2_open_top.lzsa\"" > nibel_graphics.inc echo "elevator2_closed_top_lzsa: .incbin \"elevator2_closed_top.lzsa\"" >> nibel_graphics.inc echo "outside_elevator2_e_lzsa: .incbin \"outside_elevator2_e.lzsa\"" >> nibel_graphics.inc @@ -87,6 +88,8 @@ nibel_graphics.inc: \ echo "shack_entrance_n_lzsa: .incbin \"shack_entrance_n.lzsa\"" >> nibel_graphics.inc echo "shack_entrance_open_n_lzsa: .incbin \"shack_entrance_open_n.lzsa\"" >> nibel_graphics.inc echo "shack_entrance_s_lzsa: .incbin \"shack_entrance_s.lzsa\"" >> nibel_graphics.inc + echo "shack_entrance_playing_s_lzsa: .incbin \"shack_entrance_playing_s.lzsa\"" >> nibel_graphics.inc + %.gr: %.png $(PNG2GR) $< $@ diff --git a/mist/loadstore.s b/mist/loadstore.s index e2716d2f..13894c8e 100644 --- a/mist/loadstore.s +++ b/mist/loadstore.s @@ -54,7 +54,7 @@ load_loop: lda $e00,X sta WHICH_LOAD,X inx - cpx #(END_OF_SAVE-WHICH_LOAD) + cpx #(END_OF_SAVE-WHICH_LOAD+1) bne load_loop lda #$ff diff --git a/mist/nibel.s b/mist/nibel.s index bfb4ea26..f9b93d78 100644 --- a/mist/nibel.s +++ b/mist/nibel.s @@ -79,6 +79,8 @@ game_loop: beq fg_draw_red_page cmp #NIBEL_BLUE_HOUSE_VIEWER beq animate_viewer + cmp #NIBEL_SHACK_ENTRANCE + beq animate_projector jmp nothing_special @@ -90,6 +92,9 @@ fg_draw_red_page: jsr draw_red_page jmp nothing_special +animate_projector: + jsr draw_projection + jmp nothing_special animate_viewer: lda ANIMATE_FRAME diff --git a/mist/nibel_switches.s b/mist/nibel_switches.s index 34381736..5bea5d21 100644 --- a/mist/nibel_switches.s +++ b/mist/nibel_switches.s @@ -1,3 +1,183 @@ +draw_gate_animation_s: + rts + +draw_gate_animation_n: + rts + +close_rts: + rts + +draw_projection: + lda DIRECTION + cmp #DIRECTION_S + bne close_rts + + lda ANIMATE_FRAME + beq close_rts + + cmp #2 ; blt + bcc projection_inc_frame ; start with nothing + beq setup_background + bne projector_animation + + ; setup light background with text +setup_background: + ldy #LOCATION_SOUTH_BG + lda #shack_entrance_playing_s_lzsa + sta location28+1,Y ; NIBEL_SHACK_ENTRANCE + + lda #DIRECTION_S|DIRECTION_SPLIT + jsr change_direction + bit TEXTGR + + lda DRAW_PAGE + pha + + lda #8 + sta DRAW_PAGE + + lda NIBEL_PROJECTOR + asl + tay + lda viewer_text,Y + sta OUTL + lda viewer_text+1,Y + sta OUTH + + jsr move_and_print + jsr move_and_print + jsr move_and_print + jsr move_and_print + + pla + sta DRAW_PAGE + + inc ANIMATE_FRAME + +projector_animation: + lda ANIMATE_FRAME + asl + tay + lda achenar_projection_sprites,Y + sta INL + lda achenar_projection_sprites+1,Y + sta INH + lda #11 + sta XPOS + lda #10 + sta YPOS + + + jsr put_sprite_crop + + + ; increment animation +projection_inc_frame: + lda FRAMEL + and #$3f + bne done_projection + inc ANIMATE_FRAME + lda ANIMATE_FRAME + cmp #20 + bne done_projection + + + ; reset + lda #0 + sta ANIMATE_FRAME + + ldy #LOCATION_SOUTH_BG + lda #shack_entrance_s_lzsa + sta location28+1,Y ; NIBEL_SHACK_ENTRANCE + + lda #DIRECTION_S + jsr change_location + +done_projection: + + rts + + + +achenar_projection_sprites: + .word achenar_sprite0 ; 0 skipped + .word achenar_sprite0 ; 1 skipped + .word achenar_sprite0 ; 2 only bg + .word achenar_sprite0 ; 3 + .word achenar_sprite1 ; 4 + .word achenar_sprite2 ; 5 + .word achenar_sprite1 ; 6 + .word achenar_sprite2 ; 7 + .word achenar_sprite1 ; 8 + .word achenar_sprite2 ; 9 + .word achenar_sprite1 ; 10 + .word achenar_sprite3 ; 11 + .word achenar_sprite1 ; 12 + .word achenar_sprite2 ; 13 + .word achenar_sprite1 ; 14 + .word achenar_sprite3 ; 15 + .word achenar_sprite1 ; 16 + .word achenar_sprite2 ; 17 + .word achenar_sprite0 ; 18 + .word empty_sprite ; 19 + + + + + +empty_sprite: + .byte 1,1 + .byte $AA + +achenar_sprite0: + .byte 7,8 + .byte $AA,$EA,$A0,$0A,$A0,$0A,$AA + .byte $A5,$EA,$AE,$6A,$A6,$6A,$A0 + .byte $AE,$0A,$AE,$FA,$A6,$0A,$A0 + .byte $AE,$EA,$A0,$FA,$A0,$6A,$A0 + .byte $AE,$EA,$AE,$EA,$A6,$6A,$A0 + .byte $AE,$EA,$A0,$0A,$A6,$0A,$A0 + .byte $A0,$0A,$A6,$5A,$A0,$0A,$A0 + .byte $A6,$0A,$A0,$0A,$A0,$AA,$AA + +achenar_sprite1: + .byte 7,8 + .byte $AA,$E0,$E0,$00,$00,$0A,$AA + .byte $55,$EE,$EE,$66,$66,$66,$00 + .byte $EE,$0E,$0E,$F6,$06,$06,$00 + .byte $EE,$EE,$E0,$FF,$60,$66,$00 + .byte $EE,$EE,$5E,$EF,$66,$66,$00 + .byte $0E,$EE,$00,$00,$06,$00,$00 + .byte $00,$00,$56,$56,$00,$00,$00 + .byte $A6,$00,$00,$00,$00,$A0,$AA + +achenar_sprite2: + .byte 7,8 + .byte $AA,$E0,$E0,$00,$00,$0A,$AA + .byte $55,$EE,$EE,$66,$66,$66,$00 + .byte $EE,$EE,$EE,$F6,$66,$66,$00 + .byte $EE,$E0,$E0,$FF,$60,$60,$00 + .byte $EE,$EE,$0E,$EF,$66,$66,$00 + .byte $0E,$0E,$F0,$F0,$06,$00,$00 + .byte $00,$00,$E6,$E6,$00,$00,$00 + .byte $A6,$00,$00,$00,$00,$A0,$AA + +achenar_sprite3: + .byte 7,8 + .byte $AA,$E0,$E0,$00,$00,$0A,$AA + .byte $55,$EE,$EE,$66,$66,$66,$00 + .byte $EE,$E0,$00,$F6,$00,$60,$00 + .byte $EE,$EE,$E0,$FF,$60,$66,$00 + .byte $EE,$EE,$0E,$0F,$66,$66,$00 + .byte $0E,$00,$2F,$2F,$00,$00,$00 + .byte $00,$00,$22,$22,$00,$00,$00 + .byte $A6,$00,$00,$00,$00,$A0,$AA + + goto_shack_outside: @@ -28,8 +208,10 @@ scary_entrance: jsr change_location - lda #1 + lda #$1 sta ANIMATE_FRAME + lda #$f + sta FRAMEL rts @@ -201,6 +383,9 @@ button0: lda #>button0_and_2_animation sta current_button_animation+1 + lda #0 + sta NIBEL_PROJECTOR + lda #viewer1_text @@ -217,6 +402,9 @@ button1: lda #>button1_animation sta current_button_animation+1 + lda #1 + sta NIBEL_PROJECTOR + lda #viewer2_text @@ -232,6 +420,9 @@ button2: lda #>button0_and_2_animation sta current_button_animation+1 + lda #2 + sta NIBEL_PROJECTOR + lda #viewer3_text @@ -247,6 +438,9 @@ button3: lda #>button3_animation sta current_button_animation+1 + lda #3 + sta NIBEL_PROJECTOR + lda #viewer4_text @@ -316,23 +510,38 @@ nibel_open_drawer: ; viewer +viewer_text: + .word viewer1_text + .word viewer2_text + .word viewer3_text + .word viewer4_text + ; position 1 ; [talking in another language] viewer1_text: .byte 5,22,"[ WORDS IN ANOTHER LANGUAGE ]",0 +.byte 0,23,0 +.byte 0,23,0 +.byte 0,23,0 ; position 2 ; [scary talking in another language] viewer2_text: .byte 1,22,"[ OMINOUS WORDS IN ANOTHER LANGUAGE ]",0 +.byte 0,23,0 +.byte 0,23,0 +.byte 0,23,0 ; position 3 ; [ more talking in another language] viewer3_text: .byte 9,22,"[ MORE OMINOUS WORDS ]",0 +.byte 0,23,0 +.byte 0,23,0 +.byte 0,23,0 ; position 4 ; Sirrus: I hope I pushed the right button diff --git a/mist/playthrough_save.inc b/mist/playthrough_save.inc index 53c4fdcf..43bad1d0 100644 --- a/mist/playthrough_save.inc +++ b/mist/playthrough_save.inc @@ -109,3 +109,4 @@ .byte $00 ; SUB_DIRECTION = $D6 .byte $00 ; SUB_LOCATION = $D7 +.byte $00 ; NIBEL_PROJECTOR = $D8 diff --git a/mist/zp.inc b/mist/zp.inc index 4a9df7cc..5417b8a2 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -273,8 +273,9 @@ SELENA_ANTENNA_ACTIVE = $D5 ; which antenna currently selected SUB_LOCATION = $D6 SUB_DIRECTION = $D7 +NIBEL_PROJECTOR = $D8 ; which button on projector in nibel -END_OF_SAVE = $D8 +END_OF_SAVE = $D9 ; done game puzzle state