diff --git a/mist/TODO b/mist/TODO index b8bf237d..d219104f 100644 --- a/mist/TODO +++ b/mist/TODO @@ -2,9 +2,10 @@ General: + Insert floppy #100 joke? + double link noise (once when leave, once when get there?) + allow turning around ++ allow going 45 degree angles + adjust grab window on letter + add missing red book step -+ Move sound to language card (meaning no sound on II+ w/o language card) ++ move link sound to be loaded from disk Make game winnable: + Allow access to all marker switches @@ -15,16 +16,16 @@ Make game winnable: MIST island: + Scenery - Projector room, with message - - Tunnel to generator - Climb towers with circuit breakers (2) - Dentist chair - Raised ship - fireplace close/open + - constellation panels + - roof of temple for return + fireplace puzzle + bookshelf close? + book? + atrus at end -+ Generator puzzle + Dentist chair + Raise ship + Fireplace: 8x6 grid diff --git a/mist/common_sprites.inc b/mist/common_sprites.inc index c21651de..98d2d5c8 100644 --- a/mist/common_sprites.inc +++ b/mist/common_sprites.inc @@ -27,7 +27,7 @@ finger_right_sprite: .byte 6,4 .byte $AA,$BA,$AB,$AA,$AA,$AA .byte $BB,$BB,$BB,$BB,$BB,$BB - .byte $BA,$BB,$BB,$BB,$AA,$AA + .byte $BB,$BB,$BB,$BB,$AA,$AA .byte $AB,$BB,$BB,$AB,$AA,$AA diff --git a/mist/draw_pointer.s b/mist/draw_pointer.s index ec539a40..d6cea68f 100644 --- a/mist/draw_pointer.s +++ b/mist/draw_pointer.s @@ -17,7 +17,8 @@ draw_pointer: ; see if inside special region ldy #LOCATION_SPECIAL_EXIT lda (LOCATION_STRUCT_L),Y - bmi finger_not_special ; if $ff not special + cmp #$ff + beq finger_not_special ; if $ff not special cmp DIRECTION bne finger_not_special ; only special if facing right way @@ -47,11 +48,18 @@ finger_grab: lda #1 sta IN_SPECIAL + lda DIRECTION + and #DIRECTION_ONLY_POINT + bne special_but_point + lda #finger_grab_sprite jmp finger_draw +special_but_point: + jmp finger_point + finger_not_special: ; check for left/right diff --git a/mist/generator_puzzle.s b/mist/generator_puzzle.s index 957278ed..dc458126 100644 --- a/mist/generator_puzzle.s +++ b/mist/generator_puzzle.s @@ -8,7 +8,7 @@ open_gen_door: sta location35,Y ldy #LOCATION_NORTH_EXIT_DIR - lda #DIRECTION_N + lda #(DIRECTION_N | DIRECTION_SPLIT | DIRECTION_ONLY_POINT) sta location35,Y ldy #LOCATION_NORTH_BG @@ -22,3 +22,339 @@ open_gen_door: rts +button_lookup: +.byte $10,$8,$4,$2,$1 + +button_values_top: +.byte $01,$02,$22,$19,$09 ; BCD +button_values_bottom: +.byte $10,$07,$08,$16,$05 ; BCD + +needle_strings: + .byte '\'|$80,' '|$80,' '|$80,' '|$80 + .byte ' '|$80,':'|$80,' '|$80,' '|$80 + .byte ' '|$80,' '|$80,':'|$80,' '|$80 + .byte ' '|$80,' '|$80,' '|$80,'/'|$80 + +;============================ +; handle button presses +;============================ + +generator_button_press: + + lda YPOS + cmp #38 + bcs button_bottom_row ; bge + +button_top_row: + + lda XPOS + sec + sbc #24 + lsr + bmi done_press + cmp #5 + bcs done_press ; bge + + tax + lda SWITCH_TOP_ROW + eor button_lookup,X ; toggle switch + sta SWITCH_TOP_ROW + + jmp done_press + +button_bottom_row: + + lda XPOS + sec + sbc #25 + lsr + bmi done_press + cmp #5 + bcs done_press ; bge + + tax + lda SWITCH_BOTTOM_ROW + eor button_lookup,X ; toggle switch + sta SWITCH_BOTTOM_ROW +no_bottom_press: + +done_press: + + +calculate_button_totals: + + lda #0 + sta ROCKET_VOLTS + sta GENERATOR_VOLTS + tax + +calc_buttons_loop: + + ; top button + + lda SWITCH_TOP_ROW + and button_lookup,X + beq ctop_button_off + +ctop_button_on: + sed + clc + lda GENERATOR_VOLTS + adc button_values_top,X + sta GENERATOR_VOLTS + cld + +ctop_button_off: + + lda SWITCH_BOTTOM_ROW + and button_lookup,X + beq cbottom_button_off + +cbottom_button_on: + sed + clc + lda GENERATOR_VOLTS + adc button_values_bottom,X + sta GENERATOR_VOLTS + cld + +cbottom_button_off: + + inx + cpx #5 + bne calc_buttons_loop + + ; calculate rocket volts + lda BREAKER_TRIPPED + bne done_rocket_volts + + lda GENERATOR_VOLTS + cmp #$59 + bcs oops_flipped + + sta ROCKET_VOLTS + jmp done_rocket_volts + +oops_flipped: + lda #$3 + sta BREAKER_TRIPPED + +done_rocket_volts: + + rts + +;=========================== +; draw the voltage displays +;=========================== + +generator_update_volts: + + ; gradually adjust generator voltage + sed + lda GENERATOR_VOLTS_DISP + cmp GENERATOR_VOLTS + beq no_adjust_gen_volts + bcs gen_volts_dec + + clc + adc #1 + jmp done_adjust_gen_volts +gen_volts_dec: + sec + sbc #1 +done_adjust_gen_volts: + sta GENERATOR_VOLTS_DISP + +no_adjust_gen_volts: + + + ; gradually adjust rocket voltage + lda ROCKET_VOLTS_DISP + cmp ROCKET_VOLTS + beq no_adjust_rocket_volts + bcs rocket_volts_dec + + clc + adc #1 + jmp done_adjust_rocket_volts +rocket_volts_dec: + sec + sbc #1 +done_adjust_rocket_volts: + sta ROCKET_VOLTS_DISP + +no_adjust_rocket_volts: + cld + + + lda DRAW_PAGE + clc + adc #$6 + sta gen_volt_ones_smc+2 + sta gen_volt_tens_smc+2 + sta rocket_volt_ones_smc+2 + sta rocket_volt_tens_smc+2 + sta gen_put_needle_smc+2 + sta rocket_put_needle_smc+2 + + lda GENERATOR_VOLTS_DISP + and #$f + clc + adc #$b0 +gen_volt_ones_smc: + sta $6d0+14 ; 14,21 + + lda GENERATOR_VOLTS_DISP + lsr + lsr + lsr + lsr + and #$f + clc + adc #$b0 +gen_volt_tens_smc: + sta $6d0+13 ; 13,21 + + ; draw gen needle + lda GENERATOR_VOLTS_DISP + ldx #0 + cmp #$25 + bcc gen_put_needle + inx + cmp #$50 + bcc gen_put_needle + inx + cmp #$75 + bcc gen_put_needle + inx +gen_put_needle: + txa + asl + asl + tax + ldy #0 +gen_put_needle_loop: + + lda needle_strings,X +gen_put_needle_smc: + sta $650+12,Y + iny + inx + cpy #4 + bne gen_put_needle_loop + + + lda ROCKET_VOLTS_DISP + and #$f + clc + adc #$b0 +rocket_volt_ones_smc: + sta $6d0+21 ; 21,21 + + lda ROCKET_VOLTS_DISP + lsr + lsr + lsr + lsr + and #$f + clc + adc #$b0 +rocket_volt_tens_smc: + sta $6d0+20 ; 20,21 + + + ; draw rocket needle + lda ROCKET_VOLTS_DISP + ldx #0 + cmp #$25 + bcc rocket_put_needle + inx + cmp #$50 + bcc rocket_put_needle + inx + cmp #$75 + bcc rocket_put_needle + inx +rocket_put_needle: + txa + asl + asl + tax + ldy #0 +rocket_put_needle_loop: + + lda needle_strings,X +rocket_put_needle_smc: + sta $650+19,Y + iny + inx + cpy #4 + bne rocket_put_needle_loop + + rts + + ;========================= + ; draw the buttons + ;========================= + +generator_draw_buttons: + + ldx #0 + clc + lda DRAW_PAGE + adc #$4 + sta top_button_draw_smc+2 + adc #$1 + sta bottom_button_draw_smc+2 + lda #$d0+25 + sta top_button_draw_smc+1 + adc #$1 + sta bottom_button_draw_smc+1 + +draw_buttons_loop: + + ; top button + + lda SWITCH_TOP_ROW + and button_lookup,X + beq top_button_off + +top_button_on: + ldy #$95 + bne top_button_draw_smc + +top_button_off: + ldy #$35 + +top_button_draw_smc: + sty $4d0+25 + + inc top_button_draw_smc+1 + inc top_button_draw_smc+1 + + ; bottom button + + lda SWITCH_BOTTOM_ROW + and button_lookup,X + beq bottom_button_off + +bottom_button_on: + ldy #$19 + bne bottom_button_draw_smc + +bottom_button_off: + ldy #$13 + +bottom_button_draw_smc: + sty $5d0+26 + + inc bottom_button_draw_smc+1 + inc bottom_button_draw_smc+1 + + inx + cpx #5 + bne draw_buttons_loop + + rts + diff --git a/mist/gr_putsprite_crop.s b/mist/gr_putsprite_crop.s index cdd67f9a..a9b8e227 100644 --- a/mist/gr_putsprite_crop.s +++ b/mist/gr_putsprite_crop.s @@ -42,6 +42,8 @@ put_sprite_crop_loop: bne crop_increment_y put_sprite_crop_pos: + +psc_smc1: cpy #48 ; bge if >= 48, done sprite bcs crop_sprite_done @@ -222,6 +224,7 @@ put_spritefc_loop: ldy TEMPY ; 3 bmi fcrop_increment_y ; if < 0, skip to next +psc_smc2: cpy #48 ; bge if >= 48, done sprite bcs fcrop_sprite_done diff --git a/mist/graphics_island/generator_n.png b/mist/graphics_island/generator_n.png index 85fb9394..e63859a4 100644 Binary files a/mist/graphics_island/generator_n.png and b/mist/graphics_island/generator_n.png differ diff --git a/mist/keyboard.s b/mist/keyboard.s index 0671d08f..e060b6f9 100644 --- a/mist/keyboard.s +++ b/mist/keyboard.s @@ -120,6 +120,27 @@ change_direction: ; load background lda DIRECTION + bpl no_split + + ; split text/graphics + bit TEXTGR + + ; also change sprite cutoff + ldx #40 + stx psc_smc1+1 + stx psc_smc2+1 + + jmp done_split +no_split: + bit FULLGR + + ; also change sprite cutoff + ldx #40 + stx psc_smc1+1 + stx psc_smc2+1 + +done_split: + and #$f ; mask off special flags asl clc adc #LOCATION_NORTH_BG @@ -169,6 +190,7 @@ go_forward: ; update new location lda DIRECTION + and #$f clc adc #LOCATION_NORTH_EXIT tay @@ -182,6 +204,7 @@ go_forward: ; update new direction lda DIRECTION + and #$f clc adc #LOCATION_NORTH_EXIT_DIR tay diff --git a/mist/leveldata_island.inc b/mist/leveldata_island.inc index 7e3a110a..885f5f17 100644 --- a/mist/leveldata_island.inc +++ b/mist/leveldata_island.inc @@ -710,8 +710,10 @@ location36: .word $0000 ; east bg .word $0000 ; west bg .byte BG_NORTH | BG_SOUTH - .byte $ff - + .byte DIRECTION_N|DIRECTION_SPLIT|DIRECTION_ONLY_POINT + .byte 24,36 ; special x + .byte 34,40 ; special y + .word generator_button_press-1 ; special function diff --git a/mist/link_book_mist.s b/mist/link_book_mist.s index bc8f24f4..77f81cb4 100644 --- a/mist/link_book_mist.s +++ b/mist/link_book_mist.s @@ -4,14 +4,14 @@ mist_link_book: ; play sound effect? - +.if 0 lda #audio_link_noise sta BTC_H ldx #43 ; 45 pages long??? jsr play_audio - +.endif lda #1 sta LOCATION jsr change_location diff --git a/mist/mist.s b/mist/mist.s index ad6dc9b2..071dfe22 100644 --- a/mist/mist.s +++ b/mist/mist.s @@ -55,6 +55,14 @@ mist_start: lda #0 sta GEAR_OPEN + sta BREAKER_TRIPPED + sta GENERATOR_VOLTS + sta ROCKET_VOLTS + sta GENERATOR_VOLTS_DISP + sta ROCKET_VOLTS_DISP + sta SWITCH_TOP_ROW + sta SWITCH_BOTTOM_ROW + ; debug ; lda #1 ; sta GEAR_OPEN @@ -92,18 +100,22 @@ game_loop: ; handle special-case forground logic ;==================================== + ; handle gear opening + lda GEAR_OPEN beq not_gear_related jsr check_gear_delete not_gear_related: + ; handle clock puzzles + lda LOCATION cmp #25 ; clock puzzle beq location_clock cmp #27 beq location_inside_clock - bne nothing_special + bne location_generator location_clock: jsr draw_clock_face @@ -112,6 +124,18 @@ location_inside_clock: jsr draw_clock_inside jmp nothing_special + ; handle generator puzzle +location_generator: + cmp #36 + bne nothing_special + lda DIRECTION + and #$f + cmp #DIRECTION_N + bne nothing_special + + jsr generator_update_volts + jsr generator_draw_buttons + jmp nothing_special nothing_special: @@ -213,7 +237,7 @@ exit_level: ;.align $100 ;audio_red_page: ;.incbin "audio/red_page.btc" -audio_link_noise: -.incbin "audio/link_noise.btc" +;audio_link_noise: +;.incbin "audio/link_noise.btc" diff --git a/mist/zp.inc b/mist/zp.inc index 2e0e0211..bbe35fb2 100644 --- a/mist/zp.inc +++ b/mist/zp.inc @@ -40,6 +40,8 @@ DIRECTION = $66 DIRECTION_S = $1 DIRECTION_E = $2 DIRECTION_W = $3 + DIRECTION_ONLY_POINT = $40 ; do not change pointer to grab + DIRECTION_SPLIT = $80 ; split text/graphics LOCATION = $67 LOCATION_STRUCT_L = $68 LOCATION_STRUCT_H = $69 @@ -56,7 +58,7 @@ GEAR_OPEN = $82 MARKER_SWITCHES = $83 CLOCK_HOUR = $84 CLOCK_MINUTE = $85 -GENERATOR_ON = $86 +;GENERATOR_ON = $86 TREE_FURNACE_ON = $87 FIREPLACE_GRID0 = $88 FIREPLACE_GRID1 = $89 @@ -72,6 +74,15 @@ CLOCK_LAST = $92 ANIMATE_FRAME = $93 LEVEL_OVER = $94 +BREAKER_TRIPPED = $95 +GENERATOR_VOLTS = $96 +ROCKET_VOLTS = $97 +SWITCH_TOP_ROW = $98 +SWITCH_BOTTOM_ROW = $99 +GENERATOR_VOLTS_DISP = $9A +ROCKET_VOLTS_DISP = $9B + + DISP_PAGE = $ED ; ALL DRAW_PAGE = $EE ; ALL