Proper inventory rendering

This commit is contained in:
blondie7575 2018-06-09 20:29:00 -06:00
parent ee1e3965c8
commit 4edd8540f5
13 changed files with 52 additions and 12 deletions

BIN
Art/Bomb_003.xcf Normal file

Binary file not shown.

Binary file not shown.

BIN
Art/bomb_003.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

View File

@ -15,7 +15,7 @@ ADDR=800
PGM=gscats
MRSPRITE=../MrSprite/mrsprite
CHROMA=00ff00
CHROMA=a4dffb
PALETTE=a4dffb a4dffb 008800 886611 cc9933 eebb44 dd6666 ff99aa 00ff00 ff0000 b7b7b7 dddddd 0077bb ffff00 000000 ffffff
SPRITES=SpriteBank
REMOTESYMBOLS=-Wl $(shell ./ParseMapFile.py *.map)

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@
;
INVENTORY_ITEMS = 6
INVENTORY_ITEMS = 2
ITEM_WIDTH = 16 ; In pixels
ICON_WIDTH = 8 ; In pixels
ICON_ORIGIN = (ITEM_WIDTH-ICON_WIDTH)/4 ; In bytes
@ -14,14 +14,24 @@ ICON_ORIGIN = (ITEM_WIDTH-ICON_WIDTH)/4 ; In bytes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; renderInventory
;
; Renders inventory for current player
;
; Trashes PARAML0
;
renderInventory:
SAVE_AXY
; Find inventory we need to render
ldy currentPlayer
PLAYERPTR_Y
lda playerData+PD_INVENTORY,y
sta PARAML0
; Compute initial VRAM position
ldy #(8192 + (160*10 + (160*ICON_ORIGIN + ICON_ORIGIN)))
ldx #0
renderInventoryLoop:
jsr renderInventoryItem
@ -43,19 +53,25 @@ RESTORE_AXY
;
; X = Item index
; Y = VRAM pos
; PARAML0 = Inventory state
;
renderInventoryItem:
SAVE_AXY
phy
phx
lda #2
lda #2 ; Frame
clc
jsr DrawSpriteBank
plx
; Find projectile type data
txy
PROJECTILETYPEPTR_Y
; Render projectile
lda projectileTypes+PT_FRAME1,y
ply
txa
clc
jsr DrawSpriteBank

View File

@ -20,8 +20,9 @@ playerData:
.word 100 ; Anger
.byte 8,"SPROCKET " ; Name
.word 1 ; Base Sprite
.word 10,0,0,0,0,0,0,0 ; Inventory
.repeat 106
.repeat 90
.byte 0 ; Padding to 256-byte boundary
.endrepeat
@ -38,8 +39,9 @@ playerData:
.word 100 ; Anger
.byte 8,"TINKER " ; Name
.word 0 ; Base Sprite
.word 10,0,0,0,0,0,0,0 ; Inventory
.repeat 106
.repeat 90
.byte 0 ; Padding to 256-byte boundary
.endrepeat
@ -48,6 +50,7 @@ PD_POWER = 134
PD_ANGER = 136
PD_NAME = 138
PD_BASESPRITE = 148
PD_INVENTORY = 150
PD_SIZE = 256
.macro PLAYERPTR_Y

View File

@ -7,7 +7,7 @@
projectileData:
; gameobject data (we're a subclass, effectively)
; Gameobject data (we're a subclass, effectively)
.word -1 ; Pos X in pixels (from left terrain edge)
.word 0 ; Pos Y in pixels (from bottom terrain edge)
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
@ -33,15 +33,34 @@ JD_VY = 138
JD_TYPE = 140
JD_NEW = 142
GRAVITY = $ffff ; 8.8 fixed point
projectileTypes: ; Byte offsets into projectile type data structure
projectileTypes:
; Spit
.word 3 ; Damage
.word 1 ; Crater radius
.word 4 ; Frame 0
.word 5 ; Frame 1
.word 6 ; Frame 2
.word 0,0,0 ; Padding to 16-byte boundary
; Bomb
.word 50 ; Damage
.word 10 ; Crater radius
.word 0,0 ; Padding
.word 3 ; Frame 0
.word 3 ; Frame 1
.word 3 ; Frame 2
PT_DAMAGE = 0
.word 0,0,0 ; Padding to 16-byte boundary
PT_DAMAGE = 0 ; Byte offsets into projectile type data structure
PT_RADIUS = 2
PT_FRAME0 = 4
PT_FRAME1 = 6
PT_FRAME2 = 8
.macro PROJECTILEPTR_Y
@ -61,6 +80,8 @@ PT_RADIUS = 2
tya ; Pointer to projectile type structure from index
asl
asl
asl
asl
tay
.endmacro

View File

@ -8,7 +8,7 @@ DrawSpriteBank :
JMP (SpriteBankBank,X) ; Bank Number Table
SpriteBankNum :
.dbyt $0100,$0200,$0600,$0000,$0300,$0500,$0400
.dbyt $0100,$0000,$0500,$0200,$0300,$0600,$0400
SpriteBankBank :
.addr SpriteBankBank00,SpriteBankBank00,SpriteBankBank00,SpriteBankBank00,SpriteBankBank00,SpriteBankBank00,SpriteBankBank00