ootw: initial door support

slowing things down...
This commit is contained in:
Vince Weaver 2019-08-15 10:30:07 -04:00
parent e217bddfc4
commit 4a7cf594e2
6 changed files with 72 additions and 53 deletions

View File

@ -7,14 +7,7 @@ DOOR_STATUS = 0
DOOR_STATUS_EXPLODED = $10
DOOR_STATUS_LOCKED = $20
DOOR_STATUS_EXPLODING = $40
DOOR_EXPLODE_DIR = 1
DOOR_LEFT_TRIGGER = 2
DOOR_RIGHT_TRIGGER = 3
DOOR_STEP = 4
DOOR_XPOS = 5
DOOR_YPOS = 6
door_state:
door_state0:
.byte $0 ; status
@ -24,17 +17,17 @@ door_state0:
.byte $0 ; step
;==================================
; draw_doors
;==================================
; be sure to smc to point to right place
draw_doors:
lda NUM_DOORS
beq done_draw_doors
lda door_state+DOOR_STATUS
and #(DOOR_STATUS_OPEN | DOOR_STATUS_EXPLODED)
bne done_draw_doors
lda door_state+DOOR_STATUS
cmp #DOOR_STATUS_CLOSED
bne door_not_closed
door_closed:
ldx #0
draw_doors_loop:
lda #<door_closed_sprite
sta INL
lda #>door_closed_sprite
@ -46,13 +39,24 @@ door_not_closed:
actually_draw_door:
lda door_state+DOOR_XPOS
lda door_x,X
sta XPOS
lda door_state+DOOR_YPOS
lda door_y,X
sta YPOS
txa
pha
jsr put_sprite
pla
tax
draw_doors_continue:
inx
cmp NUM_DOORS
bne draw_doors_loop
done_draw_doors:
rts

View File

@ -17,18 +17,13 @@ ootw_city_init:
sta CHARGER_COUNT
sta GUN_STATE
sta GUN_FIRE
lda #100
sta GUN_CHARGE
sta NUM_DOORS
sta ACTION_TRIGGERED
sta ACTION_COUNT
; lda #1
; sta ACTION_COUNT
lda #100
sta GUN_CHARGE
;===============
; set up aliens
@ -91,6 +86,7 @@ ootw_city:
lda #0
sta GAIT
sta GAME_OVER
sta NUM_DOORS
;============================
; init shields
@ -127,12 +123,20 @@ alien_room_continue:
;==============================
; setup per-room variables
;==============================
lda WHICH_ROOM
bne room1
;======================
; Room0 with recharger
room0:
; set up doors
lda #5
sta NUM_DOORS
lda #(6+128)
sta LEFT_LIMIT
lda #(39+128)
@ -698,6 +702,12 @@ no_fire_laser:
jsr draw_shields
;================
; draw doors
;================
jsr draw_doors
;========================
; draw foreground cover
;========================
@ -1014,3 +1024,19 @@ pit_door_cover:
door_x:
c4_r0_door0_x: .byte 7
c4_r0_door1_x: .byte 18
c4_r0_door2_x: .byte 29
c4_r0_door3_x: .byte 31
c4_r0_door4_x: .byte 33
door_y:
c4_r0_door0_y: .byte 24
c4_r0_door1_y: .byte 24
c4_r0_door2_y: .byte 24
c4_r0_door3_y: .byte 24
c4_r0_door4_y: .byte 24

View File

@ -87,13 +87,18 @@ end_message:
.include "gr_putsprite_crop.s"
.include "gr_offsets.s"
.include "gr_offsets_hl.s"
.include "gr_hlin.s"
.include "random16.s"
.include "keyboard.s"
.include "physicist.s"
.include "alien.s"
.include "door.s"
.include "gun.s"
.include "blast.s"
.include "shield.s"
;.include "door.s"
; room backgrounds
.include "ootw_graphics/l5cave/ootw_c5_cave.inc"

View File

@ -11,32 +11,14 @@ recharge_rle: .byte $28 ; ysize=48
.byte $A0,$13,$00, $A4,$22, $00, $A5,$22, $00, $22, $00
.byte $22, $00, $A6,$22, $A0,$13,$00, $A4,$22, $00, $A5,$22
.byte $00, $22, $00, $22, $00, $A6,$22, $A5,$00
.byte $E0, $20, $00, $A4,$20, $F0, $A5,$20, $00
.byte $A4,$22, $00, $A5,$22, $00, $22, $00, $22
.byte $00, $A6,$22, $A5,$00, $FF, $22, $00, $A3,$22
.byte $27, $62, $A5,$22, $00, $A4,$22, $00, $A5,$22
.byte $00, $22, $00, $22, $00, $A6,$22, $A5,$00
.byte $EE, $22, $00, $A3,$22, $26, $F2, $A5,$22
.byte $00, $22, $82, $A8,$22, $00, $22, $00
.byte $22, $00, $A6,$22, $A5,$00, $FF, $22, $00
.byte $A3,$22, $2F, $F2, $A5,$22, $00, $22, $88
.byte $A8,$22, $00, $22, $00, $22, $00, $A6,$22
.byte $A5,$00, $EE, $22, $00, $A3,$22, $27, $72
.byte $A5,$22, $00, $88, $22, $52, $A7,$22, $00
.byte $22, $00, $22, $00, $A6,$22, $A5,$00, $FF
.byte $22, $00, $A3,$22, $27, $72, $A5,$22, $00
.byte $28, $82, $55, $A7,$22, $00, $22, $00
.byte $22, $00, $A6,$22, $A5,$00, $EE, $22, $00
.byte $A3,$22, $27, $F2, $A5,$22, $00, $22, $88
.byte $A8,$22, $00, $22, $00, $22, $00, $A6,$22
.byte $A5,$00, $FF, $22, $00, $A3,$22, $72, $A6,$22
.byte $00, $88, $22, $52, $A7,$22, $00, $22
.byte $00, $22, $00, $A6,$22, $A5,$00, $EF, $22
.byte $00, $A3,$22, $62, $2F, $A5,$22, $00, $28
.byte $82, $55, $A7,$22, $00, $22, $00, $22
.byte $00, $A6,$22, $A5,$00, $0E, $02, $00, $A4,$02
.byte $06, $A5,$02, $00, $02, $08, $05, $A7,$02
.byte $00, $02, $00, $02, $00, $A6,$02, $A0,$50,$00
.byte $AE,$20, $A4,$22, $00, $A5,$22, $20, $22, $20
.byte $22, $20, $A6,$22, $A5,$00, $A0,$12,$22, $00, $A0,$10,$22
.byte $A5,$00, $AF,$22, $82, $A0,$13,$22, $A5,$00, $AF,$22, $88
.byte $A0,$13,$22, $A5,$00, $AE,$22, $88, $22, $52, $A0,$12,$22
.byte $A5,$00, $AE,$22, $28, $82, $55, $A0,$12,$22, $A5,$00
.byte $AF,$22, $88, $A0,$13,$22, $A5,$00, $AE,$22, $88, $22
.byte $52, $A0,$12,$22, $A5,$00, $AE,$22, $28, $82, $55
.byte $A0,$12,$22, $A5,$00, $AF,$02, $08, $05, $A0,$12,$02, $A0,$50,$00
.byte $A1
hallway_rle: .byte $28 ; ysize=48
.byte $A0,$28,$00, $20, $A4,$00, $20, $A4,$00, $20, $A4,$00

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -118,6 +118,8 @@ LZ4_DONE = $96
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
NUM_DOORS = $D5 ; 2+
GUN_FIRE = $D6 ; 2+
GUN_STATE = $D7 ; 2+