mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-11-01 01:06:33 +00:00
keen: update scroll for left edge of screen
This commit is contained in:
parent
018f407828
commit
e2327896d2
@ -61,7 +61,7 @@ KEEN_LEVEL1: keen_level1.o
|
||||
|
||||
keen_level1.o: keen_level1.s zp.inc hardware.inc \
|
||||
print_help.s gr_fast_clear.s quit_yn.s text_drawbox.s level_end.s \
|
||||
enemies_level1.s actions_level1.s item_level1.s \
|
||||
enemies_level1.s item_level1.s \
|
||||
graphics/keen_graphics.inc sprites/keen_sprites.inc \
|
||||
maps/level1_map.lzsa \
|
||||
status_bar.s draw_keen.s move_keen.s gr_putsprite_crop.s \
|
||||
|
@ -8,7 +8,8 @@ Memory map:
|
||||
$0800-$0bff = lo-res page2
|
||||
$0c00-$0fff = background image
|
||||
$1000-$1fff = loader
|
||||
$2000-????? = code
|
||||
$2000-$3fff = code (8k? currently 5k)
|
||||
|
||||
$9000-$93ff = tiles (1k)
|
||||
$9400-????? = big_tilemap (10k)
|
||||
$BC00-????? = tilemap (1k) 10x16
|
||||
|
@ -1,204 +0,0 @@
|
||||
|
||||
; someone pressed UP
|
||||
|
||||
up_action:
|
||||
|
||||
|
||||
; set X and Y value
|
||||
; convert tile values to X,Y
|
||||
; X=((KEEN_X/2)-1)+TILEX
|
||||
|
||||
lda KEEN_X
|
||||
lsr
|
||||
sec
|
||||
sbc #1
|
||||
clc
|
||||
adc TILEMAP_X
|
||||
sta XPOS
|
||||
|
||||
; Y = (KEENY/4)+TILEY
|
||||
lda KEEN_Y
|
||||
lsr
|
||||
lsr
|
||||
clc
|
||||
adc TILEMAP_Y
|
||||
sta YPOS
|
||||
|
||||
; $39,$22 = 57,34
|
||||
|
||||
; check if it's a key slot
|
||||
check_red_keyhole:
|
||||
|
||||
|
||||
; key slot is 280,148
|
||||
; 280,148 (-80,-12) -> 200,136 -> (/4,/4) -> 50,34
|
||||
|
||||
lda XPOS
|
||||
cmp #50
|
||||
beq redkey_x
|
||||
cmp #51
|
||||
bne check_if_exit
|
||||
|
||||
redkey_x:
|
||||
|
||||
lda YPOS
|
||||
cmp #34
|
||||
bne check_if_exit
|
||||
|
||||
; check that we have the key
|
||||
lda INVENTORY
|
||||
and #INV_RED_KEY
|
||||
bne open_the_wall
|
||||
|
||||
no_red_key:
|
||||
jsr buzzer_noise
|
||||
jmp done_up_action
|
||||
|
||||
; open the red wall
|
||||
; there has to be a more efficient way of doing this
|
||||
open_the_wall:
|
||||
; reset smc
|
||||
lda #>big_tilemap
|
||||
sta rwr_smc1+2
|
||||
sta rwr_smc2+2
|
||||
|
||||
remove_red_wall_outer:
|
||||
ldx #0
|
||||
remove_red_wall_loop:
|
||||
rwr_smc1:
|
||||
lda big_tilemap,X
|
||||
cmp #49 ; red key tile
|
||||
bne not_red_tile
|
||||
lda #2 ; lblue bg tile
|
||||
rwr_smc2:
|
||||
sta big_tilemap,X
|
||||
not_red_tile:
|
||||
inx
|
||||
bne remove_red_wall_loop
|
||||
|
||||
inc rwr_smc1+2
|
||||
inc rwr_smc2+2
|
||||
|
||||
lda rwr_smc1+2
|
||||
cmp #(>big_tilemap)+40
|
||||
bne remove_red_wall_outer
|
||||
|
||||
; refresh local tilemap
|
||||
|
||||
jsr copy_tilemap_subset
|
||||
|
||||
jsr rumble_noise
|
||||
|
||||
jmp done_up_action
|
||||
|
||||
|
||||
; check if it's the exit
|
||||
check_if_exit:
|
||||
|
||||
; exit is 296,148
|
||||
; 296,148 (-80,-12) -> 216,136 -> (/4,/4) -> 54,34
|
||||
|
||||
lda XPOS
|
||||
cmp #54
|
||||
beq exit_x
|
||||
|
||||
cmp #55
|
||||
bne done_up_action
|
||||
|
||||
exit_x:
|
||||
lda YPOS
|
||||
cmp #34
|
||||
bne done_up_action
|
||||
|
||||
; check that we have the key
|
||||
lda INVENTORY
|
||||
and #INV_RED_KEY
|
||||
beq done_up_action
|
||||
|
||||
lda #1
|
||||
sta DOOR_ACTIVATED
|
||||
|
||||
sta FRAMEL ; restart timer
|
||||
|
||||
done_up_action:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;==========================
|
||||
; open the door, end level
|
||||
;==========================
|
||||
check_open_door:
|
||||
lda DOOR_ACTIVATED
|
||||
beq done_open_door
|
||||
|
||||
asl
|
||||
tay
|
||||
lda door_opening,Y
|
||||
sta INL
|
||||
lda door_opening+1,Y
|
||||
sta INH
|
||||
|
||||
; need to find actual door location
|
||||
; it's at 54,34
|
||||
; Y is going to be at 20 unless something weird is going on
|
||||
; X is going to be ((54-TILE_X)+2)*2
|
||||
|
||||
lda #56
|
||||
sec
|
||||
sbc TILEMAP_X
|
||||
asl
|
||||
sta XPOS
|
||||
|
||||
lda #20
|
||||
sta YPOS
|
||||
|
||||
jsr put_sprite_crop
|
||||
|
||||
lda FRAMEL
|
||||
and #$7
|
||||
bne done_open_door
|
||||
|
||||
; increment
|
||||
|
||||
inc DOOR_ACTIVATED
|
||||
lda DOOR_ACTIVATED
|
||||
cmp #6
|
||||
bne done_open_door
|
||||
|
||||
jsr level_end
|
||||
|
||||
done_open_door:
|
||||
rts
|
||||
|
||||
|
||||
|
||||
door_opening:
|
||||
.word door_sprite0
|
||||
.word door_sprite0
|
||||
.word door_sprite1
|
||||
.word door_sprite2
|
||||
.word door_sprite1
|
||||
.word door_sprite0
|
||||
|
||||
door_sprite0:
|
||||
.byte 4,4
|
||||
.byte $15,$55,$55,$f5
|
||||
.byte $55,$f5,$5f,$55
|
||||
.byte $25,$25,$25,$25
|
||||
.byte $55,$55,$55,$55
|
||||
|
||||
door_sprite1:
|
||||
.byte 4,4
|
||||
.byte $51,$f5,$f5,$5f
|
||||
.byte $55,$05,$05,$50
|
||||
.byte $05,$50,$50,$55
|
||||
.byte $52,$55,$55,$52
|
||||
|
||||
door_sprite2:
|
||||
.byte 4,4
|
||||
.byte $f5,$05,$05,$f0
|
||||
.byte $55,$00,$00,$55
|
||||
.byte $55,$00,$00,$55
|
||||
.byte $05,$50,$50,$25
|
||||
|
@ -109,8 +109,6 @@ keen_start:
|
||||
; we copy in full screen, 40x48 = 20x12 tiles
|
||||
; we start out assuming position is 0,5
|
||||
|
||||
|
||||
|
||||
lda #0
|
||||
sta TILEMAP_X
|
||||
lda #5
|
||||
@ -205,7 +203,7 @@ level1_bg_zx02:
|
||||
.include "text_print.s"
|
||||
.include "gr_offsets.s"
|
||||
.include "gr_fast_clear.s"
|
||||
.include "gr_copy.s"
|
||||
; .include "gr_copy.s"
|
||||
.include "gr_pageflip.s"
|
||||
.include "gr_putsprite_crop.s"
|
||||
.include "zx02_optim.s"
|
||||
@ -225,7 +223,6 @@ level1_bg_zx02:
|
||||
.include "handle_laser.s"
|
||||
.include "draw_tilemap.s"
|
||||
.include "enemies_level1.s"
|
||||
.include "actions_level1.s"
|
||||
.include "item_level1.s"
|
||||
|
||||
.include "sound_effects.s"
|
||||
|
@ -36,6 +36,12 @@ move_keen:
|
||||
lda KEEN_DIRECTION ; check direction
|
||||
bmi move_left
|
||||
|
||||
;==============================
|
||||
; Move Keen Right
|
||||
;==============================
|
||||
; if (keen_x<22) || (tilemap_x>xmax-20) walk
|
||||
; otherwise, scroll
|
||||
|
||||
lda KEEN_X ; if X more than 22
|
||||
cmp #22 ; scroll screen rather than keen
|
||||
bcc keen_walk_right
|
||||
@ -69,6 +75,15 @@ dwr_noflo:
|
||||
|
||||
move_left:
|
||||
|
||||
;==============================
|
||||
; Move Keen Right
|
||||
;==============================
|
||||
; if (keen_x>=14) || (tilemap_x=0) walk
|
||||
; otherwise, scroll
|
||||
|
||||
lda TILEMAP_X
|
||||
beq keen_walk_left
|
||||
|
||||
lda KEEN_X ; get current X
|
||||
cmp #14
|
||||
bcs keen_walk_left ; bge ; if >=14 walk
|
||||
|
Loading…
Reference in New Issue
Block a user