diff --git a/mist/Makefile b/mist/Makefile index 61498d1a..08ce5e47 100644 --- a/mist/Makefile +++ b/mist/Makefile @@ -89,7 +89,7 @@ OCTAGON: octagon.o octagon.o: octagon.s zp.inc hardware.inc common_defines.inc \ graphics_octagon/octagon_graphics.inc \ books/octagon_books.inc \ - common_sprites.inc \ + common_sprites.inc page_sprites.inc \ leveldata_octagon.inc \ letter_cat.s \ marker_switch.s \ diff --git a/mist/brother_books.s b/mist/brother_books.s index 63bbb1f4..003a2570 100644 --- a/mist/brother_books.s +++ b/mist/brother_books.s @@ -3,6 +3,22 @@ ;=========================== touch_red_book: + ; first see if picking up the page + lda CURSOR_X + cmp #24 + bcc yes_touching_red_book ; blt + + lda RED_PAGES_TAKEN + and #OCTAGON_PAGE + bne no_touch_red_page + + lda #OCTAGON_PAGE + jsr take_red_page +no_touch_red_page: + rts + + +yes_touching_red_book: ; if have a red page, take it and increment count lda HOLDING_PAGE @@ -32,6 +48,22 @@ not_red_page: ;=========================== touch_blue_book: + ; first see if picking up the page + lda CURSOR_X + cmp #24 + bcc yes_touching_blue_book ; blt + + lda BLUE_PAGES_TAKEN + and #OCTAGON_PAGE + bne no_touch_blue_page + + lda #OCTAGON_PAGE + jsr take_blue_page +no_touch_blue_page: + rts + +yes_touching_blue_book: + ; if have a blue page, take it and increment count lda HOLDING_PAGE diff --git a/mist/graphics_octagon/blue_book_shelf.png b/mist/graphics_octagon/blue_book_shelf.png index 5110189c..6eda23f7 100644 Binary files a/mist/graphics_octagon/blue_book_shelf.png and b/mist/graphics_octagon/blue_book_shelf.png differ diff --git a/mist/graphics_octagon/red_book_face.png b/mist/graphics_octagon/red_book_face.png new file mode 100644 index 00000000..387e2f8c Binary files /dev/null and b/mist/graphics_octagon/red_book_face.png differ diff --git a/mist/graphics_octagon/red_book_open.png b/mist/graphics_octagon/red_book_open.png index 241a3f3e..e8737139 100644 Binary files a/mist/graphics_octagon/red_book_open.png and b/mist/graphics_octagon/red_book_open.png differ diff --git a/mist/graphics_octagon/red_book_shelf.png b/mist/graphics_octagon/red_book_shelf.png index 933f9a22..93cb5578 100644 Binary files a/mist/graphics_octagon/red_book_shelf.png and b/mist/graphics_octagon/red_book_shelf.png differ diff --git a/mist/graphics_octagon/temple_center_e.png b/mist/graphics_octagon/temple_center_e.png index 91c6cff2..cc1cd21e 100644 Binary files a/mist/graphics_octagon/temple_center_e.png and b/mist/graphics_octagon/temple_center_e.png differ diff --git a/mist/graphics_octagon/temple_center_w.png b/mist/graphics_octagon/temple_center_w.png index 8bf5994a..56526a35 100644 Binary files a/mist/graphics_octagon/temple_center_w.png and b/mist/graphics_octagon/temple_center_w.png differ diff --git a/mist/leveldata_octagon.inc b/mist/leveldata_octagon.inc index 1b0106eb..b0d115c7 100644 --- a/mist/leveldata_octagon.inc +++ b/mist/leveldata_octagon.inc @@ -72,7 +72,7 @@ location2: .word red_book_shelf_lzsa ; west bg .byte BG_WEST ; west .byte DIRECTION_W ; special exit - .byte 16,25 ; special x + .byte 16,28 ; special x .byte 16,32 ; special y .word touch_red_book-1 ; special function @@ -219,7 +219,7 @@ location10: .word $0000 ; west bg .byte BG_EAST .byte DIRECTION_E ; special exit - .byte 16,25 ; special x + .byte 16,28 ; special x .byte 16,32 ; special y .word touch_blue_book-1 ; special function diff --git a/mist/octagon.s b/mist/octagon.s index 7edb68d6..ca15eccc 100644 --- a/mist/octagon.s +++ b/mist/octagon.s @@ -65,6 +65,26 @@ game_loop: cmp #OCTAGON_TOWER_ROTATION beq animate_tower_rotation + cmp #OCTAGON_TEMPLE_CENTER + bne check_page_close_red + jsr draw_octagon_page_far + jmp done_foreground + +check_page_close_red: + cmp #OCTAGON_RED_BOOKSHELF + bne check_page_close_blue + jsr draw_octagon_page_close_red + jmp done_foreground + +check_page_close_blue: + cmp #OCTAGON_BLUE_BOOKSHELF + jsr draw_octagon_page_close_blue + +done_foreground: + ;==================================== + ; handle animations + ;==================================== + ; things only happening when animating lda ANIMATE_FRAME @@ -208,7 +228,7 @@ goto_map: goto_red_book: ldy #OCTAGON_RED_BOOKSHELF - lda #DIRECTION_W + lda #DIRECTION_W|DIRECTION_ONLY_POINT jmp done_goto goto_shelf_frame: @@ -228,7 +248,7 @@ goto_door_frame: goto_blue_book: ldy #OCTAGON_BLUE_BOOKSHELF - lda #DIRECTION_E + lda #DIRECTION_E|DIRECTION_ONLY_POINT jmp done_goto goto_fireplace: @@ -247,6 +267,102 @@ done_goto: jmp change_location + ;====================================== + ; draw pages if in octagon center (far) +draw_octagon_page_far: + lda DIRECTION + and #$f + + cmp #DIRECTION_W + beq draw_octagon_red + cmp #DIRECTION_E + beq draw_octagon_blue +no_draw_page_far: + rts + +draw_octagon_red: + lda RED_PAGES_TAKEN + and #OCTAGON_PAGE + bne no_draw_page_far + + lda #red_page_small_sprite + sta INH + + jmp draw_small_page + +draw_octagon_blue: + lda BLUE_PAGES_TAKEN + and #OCTAGON_PAGE + bne no_draw_page_far + + lda #blue_page_small_sprite + sta INH + +draw_small_page: + lda #21 + sta XPOS + lda #24 + sta YPOS + + jmp put_sprite_crop ; tail call + + ;====================================== + ; draw pages if in octagon center (close) +draw_octagon_page_close_red: + lda DIRECTION + and #$f + + cmp #DIRECTION_W + beq draw_octagon_close_red + +no_draw_page_close: + rts + +draw_octagon_close_red: + lda RED_PAGES_TAKEN + and #OCTAGON_PAGE + bne no_draw_page_close + + lda #red_page_sprite + sta INH + + jmp draw_page_close + +draw_octagon_page_close_blue: + lda DIRECTION + and #$f + + cmp #DIRECTION_E + beq draw_octagon_close_blue + rts + +draw_octagon_close_blue: + + lda BLUE_PAGES_TAKEN + and #OCTAGON_PAGE + bne no_draw_page_close + + lda #blue_page_sprite + sta INH + +draw_page_close: + lda #24 + sta XPOS + lda #24 + sta YPOS + + jmp put_sprite_crop ; tail call + + + ;========================== @@ -278,12 +394,14 @@ done_goto: .include "octagon_rotation.s" ; linking books + .include "handle_pages.s" ; books .include "books/octagon_books.inc" .include "common_sprites.inc" + .include "page_sprites.inc" .include "leveldata_octagon.inc" diff --git a/mist/page_sprites.inc b/mist/page_sprites.inc index 9e76dd7d..8b91e958 100644 --- a/mist/page_sprites.inc +++ b/mist/page_sprites.inc @@ -19,4 +19,15 @@ white_page_sprite: .byte $aa,$ff,$ff,$ff,$ff .byte $aa,$ff,$ff,$ff,$ff +blue_page_small_sprite: + .byte 2,3 + .byte $6A,$6A + .byte $66,$66 + .byte $66,$66 + +red_page_small_sprite: + .byte 2,3 + .byte $3A,$3A + .byte $33,$33 + .byte $33,$33 diff --git a/mist/zp.inc b/mist/zp.inc index 5a2650f5..b1750d0b 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -58,7 +58,7 @@ BTC_H = $6F ; the following values RED_PAGES_TAKEN = $80 - OCTOGON_PAGE = 1 + OCTAGON_PAGE = 1 MECHE_PAGE = 2 SELENA_PAGE = 4 STONEY_PAGE = 8