Browse Source

Add attribute field for items

master
Forest Belton 3 years ago
parent
commit
6abb46a69c
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      src/item.s

+ 11
- 3
src/item.s View File

@ -1,8 +1,14 @@
DEF ITEM_ATTRF_NONE EQU 0
DEF ITEM_ATTRF_USABLE EQU (1 << 0)
DEF ITEM_ATTRF_WEAPON EQU (1 << 1)
DEF ITEM_ATTRF_ARMOR EQU (1 << 2)
DEF NEXT_ITEM_ID SET 1 DEF NEXT_ITEM_ID SET 1
; Declare a new item ; Declare a new item
; \1 Display name ; \1 Display name
; \2 Sprite data filename
; \2 Attributes
; \3 Sprite data filename
MACRO Item MACRO Item
ASSERT STRLEN("\1") < 16 ASSERT STRLEN("\1") < 16
@ -12,6 +18,8 @@ MACRO Item
EXPORT {ID_NAME} EXPORT {ID_NAME}
REDEF NEXT_ITEM_ID SET NEXT_ITEM_ID + 1 REDEF NEXT_ITEM_ID SET NEXT_ITEM_ID + 1
DB \2
; Display name ; Display name
DB "\1" DB "\1"
REPT 16 - STRLEN("\1") REPT 16 - STRLEN("\1")
@ -19,11 +27,11 @@ MACRO Item
ENDR ENDR
; Sprite data ; Sprite data
INCBIN \2
INCBIN \3
ENDM ENDM
SECTION "Item Data", ROM0 SECTION "Item Data", ROM0
; NOTE: Macro invocation MUST be indented in order to be expanded correctly ; NOTE: Macro invocation MUST be indented in order to be expanded correctly
Items:: Items::
Item COIN, "png/sprite/item/coin.2bpp"
Item COIN, ITEM_ATTRF_NONE, "png/sprite/item/coin.2bpp"

Loading…
Cancel
Save