ootw: can now walk right

added over-complicaetd flipped sprite routine hack rather
than flipping the sprites as per previous tradition
This commit is contained in:
Vince Weaver 2019-01-14 16:19:51 -05:00
parent 3ac5dd4ba0
commit 23208b3636
5 changed files with 214 additions and 59 deletions

12
ootw/TODO Normal file
View File

@ -0,0 +1,12 @@
+ only erase the middle of screen where things change
+ walking animation
+ crouching animation
+ kicking animation
+ death scenes (slugs + tentacles)
+ some sort of "level over" message
+ water ripples
far-out:
+ add the shooting-in-hallway scene

View File

@ -148,3 +148,165 @@ put_sprite_done_draw:
rts ; return ; 6
;=============================================
; put_sprite_flipped
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; transparent color is $A (grey #2)
; this means we can have black ($0) in a sprite
put_sprite_flipped:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
dey ; make Y zero again ; 2
lda INH
sta ppf_smc+2
clc
lda INL
adc #1 ; add one (not two) because X counts
; from CH to 1 (not CH-1 to 0)
sta ppf_smc+1
bcc psf16
inc ppf_smc+2
psf16:
lda YPOS ; make a copy of ypos ; 3
sta TEMPY ; as we modify it ; 3
;===========
; 28
put_spritef_loop:
sty TEMP ; save sprite pointer ; 3
ldy TEMPY ; 3
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
ldy TEMP ; restore sprite pointer ; 3
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
;===========
; 34
put_spritef_pixel:
ppf_smc:
lda $C000,X ; get sprite colors ; 5
iny ; increment sprite pointer ; 2
sty TEMP ; save sprite pointer ; 3
ldy #$0 ; 2
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq put_spritef_done_draw ; don't draw it ; 2nt/3
;==============
; 16/17
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne put_spritef_bottom ; if not skip ahead ; 2nt/3
;==============
; 7/8
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi put_spritef_mask ; always? ; 3
;=============
; 8
put_spritef_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne put_spritef_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
put_spritef_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp put_spritef_done_draw ; we are done ; 3
;===========
; 20
put_spritef_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
;============
; 9
put_spritef_done_draw:
ldy TEMP ; restore sprite pointer ; 3
inc OUTL ; increment output pointer ; 5
dex ; decrement x counter ; 2
bne put_spritef_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
inc TEMPY ; each line has two y vars ; 5
inc TEMPY ; 5
lda CH
clc
adc ppf_smc+1
sta ppf_smc+1
bcc psfo
inc ppf_smc+2
psfo:
dec CV ; decemenet total y count ; 5
bne put_spritef_loop ; loop if not done ; 2nt/3
;==============
; 17/18
rts ; return ; 6

View File

@ -1,5 +1,11 @@
5 HOME
10 PRINT "OOTW V0.1 BY DEATER"
10 PRINT "OOTW PROOF-OF-CONCEPT V0.5 BY DEATER"
20 PRINT:PRINT
30 PRINT "ORIGINAL BY ERIC CHAHI"
40 PRINT "INSPIRED BY PAUL NICHOLAS PICO-8 VERSION"
50 PRINT
60 PRINT "WASD OR ARROWS TO MOVE"
70 PRINT "SPACEBAR FOR ACTION"
80 PRINT
100 PRINT CHR$ (4)"BRUN OOTW"

View File

@ -185,32 +185,26 @@ draw_physicist:
sta GAIT
tax
lda DIRECTION
beq facing_left
facing_right:
lda adv_walk_right_progression,X
lda phys_walk_progression,X
sta INL
lda adv_walk_right_progression+1,X
lda phys_walk_progression+1,X
sta INH
jmp draw_him
lda PHYSICIST_X
sta XPOS
lda PHYSICIST_Y
sta YPOS
lda DIRECTION
bne facing_right
facing_left:
lda adv_walk_left_progression,X
sta INL
lda adv_walk_left_progression+1,X
sta INH
draw_him:
lda PHYSICIST_X
sta XPOS
lda PHYSICIST_Y
sta YPOS
jsr put_sprite ; make this a "jmp"?
rts
facing_right:
jsr put_sprite_flipped
rts

View File

@ -1,36 +1,17 @@
adv_walk_left_progression:
.word adv_stand_left
.word adv_walk_left1
.word adv_walk_left2
.word adv_walk_left3
.word adv_walk_left4
.word adv_walk_left5
.word adv_walk_left6
.word adv_walk_left7
phys_walk_progression:
.word phys_stand
.word phys_walk_left1
.word phys_walk_left2
.word phys_walk_left3
.word phys_walk_left4
.word phys_walk_left5
.word phys_walk_left6
.word phys_walk_left7
adv_walk_right_progression:
.word adv_stand_right
.word adv_walk_left1
.word adv_walk_left2
.word adv_walk_left3
.word adv_walk_left4
.word adv_walk_left5
.word adv_walk_left6
.word adv_walk_left7
;====================
; Going Left
adv_stand_right:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$99,$bb,$aa
.byte $aa,$0b,$aa,$aa
.byte $aa,$bb,$aa,$aa
.byte $aa,$bb,$aa,$aa
.byte $aa,$44,$aa,$aa
.byte $aa,$44,$aa,$aa
.byte $aa,$f4,$fa,$aa
adv_stand_left:
phys_stand:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -41,7 +22,7 @@ adv_stand_left:
.byte $aa,$aa,$44,$aa
.byte $aa,$fa,$f4,$aa
adv_walk_left1:
phys_walk_left1:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -52,7 +33,7 @@ adv_walk_left1:
.byte $aa,$cc,$44,$aa
.byte $aa,$fa,$f4,$a5
adv_walk_left2:
phys_walk_left2:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -63,7 +44,7 @@ adv_walk_left2:
.byte $aa,$cc,$44,$4a
.byte $aa,$a5,$fc,$f4
adv_walk_left3:
phys_walk_left3:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -74,7 +55,7 @@ adv_walk_left3:
.byte $aa,$cc,$a4,$4a
.byte $5a,$5c,$fa,$f4
adv_walk_left4:
phys_walk_left4:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -85,7 +66,7 @@ adv_walk_left4:
.byte $aa,$aa,$c4,$4a
.byte $aa,$5a,$5f,$af
adv_walk_left5:
phys_walk_left5:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -96,7 +77,7 @@ adv_walk_left5:
.byte $aa,$44,$c4,$aa
.byte $af,$5f,$5c,$aa
adv_walk_left6:
phys_walk_left6:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa
@ -107,7 +88,7 @@ adv_walk_left6:
.byte $aa,$aa,$44,$aa
.byte $fa,$f4,$5c,$5c
adv_walk_left7:
phys_walk_left7:
.byte $4,$8
.byte $aa,$9a,$9a,$aa
.byte $aa,$bb,$99,$aa