mist: can pick up pages in the octagon

This commit is contained in:
Vince Weaver 2020-05-20 00:41:44 -04:00
parent 7db01990ea
commit 5d55e87ca1
12 changed files with 167 additions and 6 deletions

View File

@ -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 \

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -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

View File

@ -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 INL
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 INL
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 INL
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 INL
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"

View File

@ -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

View File

@ -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