diff --git a/mist/common_defines.inc b/mist/common_defines.inc index ebbad8a4..0e707bd1 100644 --- a/mist/common_defines.inc +++ b/mist/common_defines.inc @@ -139,6 +139,7 @@ OCTAGON_BLUE_BOOK_CLOSED= 29 OCTAGON_BLUE_BOOK_OPEN = 30 OCTAGON_RED_END = 31 OCTAGON_BLUE_END = 32 +OCTAGON_GRID_BOOK = 33 ; Mechanical Engineering diff --git a/mist/leveldata_octagon.inc b/mist/leveldata_octagon.inc index f3ad1501..735dac4f 100644 --- a/mist/leveldata_octagon.inc +++ b/mist/leveldata_octagon.inc @@ -12,7 +12,7 @@ locations: .word location20,location21,location22,location23 .word location24,location25,location26,location27 .word location28,location29,location30,location31 - .word location32 + .word location32,location33 ; OCTAGON_TEMPLE_DOORWAY -- temple doorway location0: @@ -611,3 +611,23 @@ location32: .word $0000 ; west bg .byte BG_EAST .byte $ff + +; OCTAGON_GRID_BOOK -- the bookcase close in +location33: + .byte OCTAGON_BOOKSHELF_CLOSE ; north exit + .byte $ff ; south exit + .byte $ff ; east exit + .byte $ff ; west exit + .byte DIRECTION_N|DIRECTION_ONLY_POINT; north exit_dir + .byte $ff ; south exit_dir + .byte $ff ; east exit_dir + .byte $ff ; west exit_dir + .word fireplace_book_lzsa ; north bg + .word $0000 ; south bg + .word $0000 ; east bg + .word $0000 ; west bg + .byte BG_NORTH + .byte DIRECTION_N ; special exit + .byte 6,34 ; special x + .byte 5,35 ; special y + .word turn_page-1 ; special function diff --git a/mist/octagon.s b/mist/octagon.s index ebc95c77..78ab2865 100644 --- a/mist/octagon.s +++ b/mist/octagon.s @@ -75,6 +75,9 @@ game_loop: cmp #OCTAGON_TOWER_ROTATION beq animate_tower_rotation + cmp #OCTAGON_GRID_BOOK + beq looking_at_grid_book + cmp #OCTAGON_TEMPLE_CENTER bne check_page_close_red jsr draw_octagon_page_far @@ -140,6 +143,10 @@ animate_tower_rotation: jsr handle_tower_rotation jmp nothing_special +looking_at_grid_book: + jsr draw_book_grid + jmp nothing_special + animate_red_book: jsr red_book_animation jmp nothing_special diff --git a/mist/octagon_bookshelf.s b/mist/octagon_bookshelf.s index e46ee766..3bf92b91 100644 --- a/mist/octagon_bookshelf.s +++ b/mist/octagon_bookshelf.s @@ -44,6 +44,29 @@ bottom_shelf: read_burnt_book: jmp all_done_book +read_fireplace: + lda #OCTAGON_GRID_BOOK + sta LOCATION + jsr change_location + bit SET_TEXT + + ; reset which page we are on + + lda #127 + sta GRID_PAGE + lda #'1' + sta grid_left_h + sta grid_right_h + lda #'2' + sta grid_left_t + sta grid_right_t + lda #'7' + sta grid_left_o + lda #'8' + sta grid_right_o + + rts + read_selenitic: lda #fireplace_book_lzsa - sta getsrc_smc+2 ; LZSA_SRC_HI - - lda #$c ; load to page $c00 - jsr decompress_lzsa2_fast - - jsr gr_copy_to_current - +draw_book_grid: ldy #8 fp_book_outer_loop: @@ -154,15 +168,95 @@ fp_book_smc: cpy #32 bne fp_book_outer_loop - jsr page_flip + ; draw page number -wait_fireplace_book: - lda KEYPRESS - bpl wait_fireplace_book - bit KEYRESET + ; line 34? $4d0? + + lda #$50 + sta OUTL + lda #$4 + clc + adc DRAW_PAGE + sta OUTH + + ldy #4 + + lda grid_left_h + beq glhz + sta (OUTL),Y + iny +glhz: + lda grid_left_t + beq gltz + sta (OUTL),Y + iny +gltz: + lda grid_left_o + sta (OUTL),Y + iny + lda #' ' + sta (OUTL),Y + iny + sta (OUTL),Y + + rts - jmp all_done_book + ;========================== + ; turn the grid book page + +turn_page: + + lda CURSOR_X + cmp #20 + bcs increment_page + +decrement_page: + ldx GRID_PAGE + cmp #1 + beq done_decrement_page ; don't go lower than 1 + + dex + dex + stx GRID_PAGE + + dec grid_left_o + dec grid_left_o + + dec grid_right_o + dec grid_right_o + + +done_decrement_page: + rts + + +increment_page: + ldx GRID_PAGE + cmp #253 ; don't go above 253/254 + beq done_increment_page + + inx + inx + stx GRID_PAGE + + inc grid_left_o + inc grid_left_o + + inc grid_right_o + inc grid_right_o + +done_increment_page: + rts + + +grid_left_h: .byte '1' +grid_left_t: .byte '2' +grid_left_o: .byte '7' +grid_right_h: .byte '1' +grid_right_t: .byte '2' +grid_right_o: .byte '8' + ;========================= diff --git a/mist/zp.inc b/mist/zp.inc index c92b1c65..d20552dd 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -156,6 +156,7 @@ END_OF_SAVE = $B7 ; done game puzzle state +GRID_PAGE = $DF ANIMATE_FRAME = $E0 LEVEL_OVER = $E1 LOCATIONS_L = $E2