mist: meche: can get into elevator now

This commit is contained in:
Vince Weaver 2020-03-21 16:55:48 -04:00
parent 49c6420f2e
commit 318d09279b
11 changed files with 286 additions and 78 deletions

View File

@ -95,6 +95,7 @@ meche.o: meche.s zp.inc hardware.inc common_defines.inc \
leveldata_meche.inc \
link_book_meche.s \
link_book_mist.s \
meche_rotation.s \
keyboard.s \
draw_pointer.s \
gr_copy.s audio.s text_print.s decompress_fast_v2.s

View File

@ -144,6 +144,10 @@ MECHE_RIGHT_HALL2 = 21
MECHE_RIGHT_HALL_CORNER = 22
MECHE_BLUE_ROOM_CENTER = 23
MECHE_CENTER_HALL2 = 24
MECHE_ELEVATOR_PATH = 25
MECHE_ELEVATOR_GROUND = 26
MECHE_ELEVATOR_HALF = 27
MECHE_ELEVATOR_UP = 28
;MECHE_EAST_PLATFORM = 9

View File

@ -35,7 +35,9 @@ meche_graphics.inc: \
right_hall2_s.lzsa \
right_hall_corner_n.lzsa right_hall_corner_w.lzsa \
blue_room_center_n.lzsa blue_room_center_s.lzsa \
center_hall2_n.lzsa center_hall2_s.lzsa center_hall2_w.lzsa
center_hall2_n.lzsa center_hall2_s.lzsa center_hall2_w.lzsa \
elevator_path_e.lzsa elevator_path_w.lzsa \
elevator_ground_e.lzsa
echo "departure_e_lzsa: .incbin \"departure_e.lzsa\"" > meche_graphics.inc
echo "arrival_w_lzsa: .incbin \"arrival_w.lzsa\"" >> meche_graphics.inc
echo "entrance_e_lzsa: .incbin \"entrance_e.lzsa\"" >> meche_graphics.inc
@ -94,7 +96,9 @@ meche_graphics.inc: \
echo "center_hall2_n_lzsa: .incbin \"center_hall2_n.lzsa\"" >> meche_graphics.inc
echo "center_hall2_s_lzsa: .incbin \"center_hall2_s.lzsa\"" >> meche_graphics.inc
echo "center_hall2_w_lzsa: .incbin \"center_hall2_w.lzsa\"" >> meche_graphics.inc
echo "elevator_path_w_lzsa: .incbin \"elevator_path_w.lzsa\"" >> meche_graphics.inc
echo "elevator_path_e_lzsa: .incbin \"elevator_path_e.lzsa\"" >> meche_graphics.inc
echo "elevator_ground_e_lzsa: .incbin \"elevator_ground_e.lzsa\"" >> meche_graphics.inc
%.gr: %.png
$(PNG2GR) $< $@

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

View File

@ -56,3 +56,6 @@ blue_room_center_s_lzsa: .incbin "blue_room_center_s.lzsa"
center_hall2_n_lzsa: .incbin "center_hall2_n.lzsa"
center_hall2_s_lzsa: .incbin "center_hall2_s.lzsa"
center_hall2_w_lzsa: .incbin "center_hall2_w.lzsa"
elevator_path_w_lzsa: .incbin "elevator_path_w.lzsa"
elevator_path_e_lzsa: .incbin "elevator_path_e.lzsa"
elevator_ground_e_lzsa: .incbin "elevator_ground_e.lzsa"

View File

@ -10,7 +10,8 @@ locations:
.word location12,location13,location14,location15
.word location16,location17,location18,location19
.word location20,location21,location22,location23
.word location24
.word location24,location25,location26,location27
.word location28
; MECHE_INSIDE_GEAR -- Inside gear on Mist
location0:
@ -378,7 +379,10 @@ location20:
.word $ff ; east bg
.word basement_controls_w_lzsa ; west bg
.byte BG_WEST
.byte $ff ; special exit
.byte DIRECTION_W ; special exit
.byte 21,29 ; special x
.byte 14,36 ; special y
.word elevator_panel_clicked-1 ; special function
; MECHE_RIGHT_HALL2 -- looks a lot like left hall2
location21:
@ -451,3 +455,71 @@ location24:
.byte BG_WEST|BG_NORTH|BG_SOUTH
.byte $ff ; special exit
; MECHE_ELEVATOR_PATH -- path to elevator
location25:
.byte $ff ; north exit
.byte $ff ; south exit
.byte MECHE_RED_BUTTON ; east exit
.byte MECHE_ELEVATOR_GROUND ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte DIRECTION_E ; east exit_dir
.byte DIRECTION_E ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word elevator_path_e_lzsa ; east bg
.word elevator_path_w_lzsa ; west bg
.byte BG_WEST|BG_EAST
.byte $ff ; special exit
; MECHE_ELEVATOR_GROUND -- elevator ground floor
location26:
.byte $ff ; north exit
.byte $ff ; south exit
.byte MECHE_ELEVATOR_PATH ; east exit
.byte $ff ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte DIRECTION_E ; east exit_dir
.byte $0000 ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word elevator_ground_e_lzsa ; east bg
.word $0000 ; west bg
.byte BG_EAST
.byte $ff ; special exit
; MECHE_ELEVATOR_HALF -- elevator halfway
location27:
.byte $ff ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte DIRECTION_E ; east exit_dir
.byte $0000 ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word elevator_ground_e_lzsa ; east bg
.word $0000 ; west bg
.byte BG_EAST
.byte $ff ; special exit
; MECHE_ELEVATOR_TOP -- elevator top
location28:
.byte $ff ; north exit
.byte $ff ; south exit
.byte $ff ; east exit
.byte $ff ; west exit
.byte $ff ; north exit_dir
.byte $ff ; south exit_dir
.byte $ff ; east exit_dir
.byte $0000 ; west exit_dir
.word $0000 ; north bg
.word $0000 ; south bg
.word elevator_ground_e_lzsa ; east bg
.word $0000 ; west bg
.byte BG_EAST
.byte $ff ; special exit

View File

@ -63,7 +63,12 @@ game_loop:
lda LOCATION
cmp #MECHE_OPEN_BOOK
bne nothing_special
beq animate_meche_book
cmp #MECHE_ELEVATOR_ROTATE
beq animate_elevator_rotate
jmp nothing_special
animate_meche_book:
; handle animated linking book
@ -92,8 +97,12 @@ game_loop:
bne done_animate_book
lda #0
sta ANIMATE_FRAME
done_animate_book:
jmp nothing_special
animate_elevator_rotate:
jsr draw_elevator_panel
nothing_special:
@ -137,78 +146,6 @@ really_exit:
jmp end_level
;==================================
; elevator stuff
;==================================
basement_button:
; flip switch
lda #$80
eor MECHE_ELEVATOR
sta MECHE_ELEVATOR
jsr adjust_basement_door
jsr change_location
rts
adjust_basement_door:
lda MECHE_ELEVATOR
bmi floor_open
floor_closed:
jmp floor_closed_elevator_off
floor_open:
jmp floor_open_elevator_off
floor_open_elevator_on:
floor_open_elevator_off:
ldy #LOCATION_WEST_EXIT
lda #MECHE_BASEMENT
sta location18,Y
ldy #LOCATION_WEST_BG
lda #<red_button_of_ce_w_lzsa
sta location18,Y
lda #>red_button_of_ce_w_lzsa
jmp adjust_basement_door_done
floor_closed_elevator_on:
floor_closed_elevator_off:
ldy #LOCATION_WEST_EXIT
lda #$ff
sta location18,Y
ldy #LOCATION_WEST_BG
lda #<red_button_cf_ce_w_lzsa
sta location18,Y
lda #>red_button_cf_ce_w_lzsa
jmp adjust_basement_door_done
adjust_basement_door_done:
sta location18+1,Y
rts
adjust_fortress_rotation:
rts
;==========================
; includes
;==========================
@ -224,6 +161,8 @@ adjust_fortress_rotation:
.include "draw_pointer.s"
.include "end_level.s"
.include "meche_rotation.s"
.include "audio.s"
.include "graphics_meche/meche_graphics.inc"

185
mist/meche_rotation.s Normal file
View File

@ -0,0 +1,185 @@
;==================================
; elevator stuff
;==================================
;=================
; elevator panel clicked
; behavior a bit different in real game (it slides around more)
; also in theory could animate handle
; Apple II doesn't let you know length of keypress
elevator_panel_clicked:
lda MECHE_ELEVATOR
clc
adc #1
and #$83
sta MECHE_ELEVATOR
jsr adjust_basement_door
rts
;=====================
; draw elevator panel
draw_elevator_panel:
lda MECHE_ELEVATOR
and #$f
asl
tay
lda elevator_rotation_sprites,Y
sta INL
lda elevator_rotation_sprites+1,Y
sta INH
lda #13
sta XPOS
lda #20
sta YPOS
jsr put_sprite_crop
rts
;==================================
; basement door button
;==================================
basement_button:
; flip switch
lda #$80
eor MECHE_ELEVATOR
sta MECHE_ELEVATOR
jsr adjust_basement_door
jsr change_location
rts
;==================================
; adjust basement door
;==================================
adjust_basement_door:
lda MECHE_ELEVATOR
bmi floor_open
floor_closed:
and #$f
cmp #2
beq floor_closed_elevator_on
bne floor_closed_elevator_off
floor_open:
; point exit to basement
ldy #LOCATION_WEST_EXIT
lda #MECHE_BASEMENT
sta location18,Y
lda MECHE_ELEVATOR
and #$f
cmp #2
beq floor_open_elevator_on
bne floor_open_elevator_off
floor_open_elevator_on:
; point background to open floor / open elevator
ldy #LOCATION_WEST_BG
lda #<red_button_of_oe_w_lzsa
sta location18,Y
lda #>red_button_of_oe_w_lzsa
jmp adjust_basement_door_done
floor_open_elevator_off:
; point background to open floor / closed elevator
ldy #LOCATION_WEST_BG
lda #<red_button_of_ce_w_lzsa
sta location18,Y
lda #>red_button_of_ce_w_lzsa
jmp adjust_basement_door_done
floor_closed_elevator_on:
; point hallway to elevator path
ldy #LOCATION_WEST_EXIT
lda #MECHE_ELEVATOR_PATH
sta location18,Y
ldy #LOCATION_WEST_BG
lda #<red_button_cf_oe_w_lzsa
sta location18,Y
lda #>red_button_cf_oe_w_lzsa
jmp adjust_basement_door_done
floor_closed_elevator_off:
; disabl exit
ldy #LOCATION_WEST_EXIT
lda #$ff
sta location18,Y
ldy #LOCATION_WEST_BG
lda #<red_button_cf_ce_w_lzsa
sta location18,Y
lda #>red_button_cf_ce_w_lzsa
jmp adjust_basement_door_done
adjust_basement_door_done:
sta location18+1,Y
rts
adjust_fortress_rotation:
rts
;==================================
; sprites
;==================================
elevator_rotation_sprites:
.word elevator0,elevator1,elevator2,elevator3
elevator0:
.byte 3,2
.byte $00,$ff,$00
.byte $f0,$0f,$f0
elevator1:
.byte 3,2
.byte $0f,$f0,$f0
.byte $f0,$0f,$0f
elevator2:
.byte 3,2
.byte $1f,$f1,$1f
.byte $11,$ff,$11
elevator3:
.byte 3,2
.byte $f0,$f0,$0f
.byte $0f,$0f,$f0