peasant: work on adding item sprites

This commit is contained in:
Vince Weaver 2021-09-03 00:31:15 -04:00
parent 6b45f182d9
commit c1a176279b
4 changed files with 85 additions and 4 deletions

View File

@ -0,0 +1,44 @@
;======================
; hgr 2x16 draw sprite
;======================
; Note: NOT TRANSPARENT
;
; SPRITE in INL/INH
; Location at CURSOR_X*7 CURSOR_Y
; X, Y, A trashed
hgr_draw_sprite_2x16:
; set up pointers
lda INL
sta hds2_smc1+1
lda INH
sta hds2_smc1+2
ldx #0
hgr_2x16_sprite_yloop:
txa
pha
clc
adc CURSOR_Y
tax
lda hposn_low,X
sta GBASL
lda hposn_high,X
sta GBASH
pla
tax
ldy CURSOR_X
hds2_smc1:
lda $D000
sta (GBASL),Y
inx
cpx #16
bne hgr_2x16_sprite_yloop
rts

View File

@ -180,9 +180,12 @@ handle_inv_keypress:
and #$7f ; clear top bit
cmp #27
beq done_inv_keypress ; ESCAPE
beq urgh_done ; ESCAPE
cmp #$7f
beq done_inv_keypress ; DELETE
bne inv_check_down ; DELETE
urgh_done:
jmp done_inv_keypress
inv_check_down:
cmp #$0A
@ -269,6 +272,24 @@ inv_done_moving:
ldy INVENTORY_Y
jsr overwrite_entry
;================
; draw item
; ldy INVENTORY_Y
lda #<arrow_sprite
sta INL
lda #>arrow_sprite
sta INH
lda #18
sta CURSOR_X
lda #88
sta CURSOR_Y
jsr hgr_draw_sprite_2x16
;================
; repeat
@ -711,3 +732,20 @@ overwite_char_smc:
masks:
.byte $01,$02,$04,$08, $10,$20,$40,$80
arrow_sprite:
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
no_sprite:
.byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f
.byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f
.byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f
.byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f
.include "hgr_2x16_sprite.s"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -20,8 +20,7 @@ PEASANT_PRIORITY = $30
INVENTORY_MASK = $60
INVENTORY_X = $61
INVENTORY_Y = $62
INVENTORY_Y = $61
CURSOR_X = $63
CURSOR_Y = $64