defs: Added item struct
authorLukas Krickl <lukas@krickl.dev>
Sat, 20 Dec 2025 07:18:45 +0000 (08:18 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 20 Dec 2025 07:18:45 +0000 (08:18 +0100)
src/defs.s
src/item.s [new file with mode: 0644]
src/macros.inc
src/main.s

index ef87af2d3136539ae9d81cac6953be03eb9b3b89..0b7037ac099f18084ab12131b0f86524019871cd 100644 (file)
 .def int ATTR_PROF_MAGIC = 0b00000001
 
 .def int ITEM_NONE = 0
+
+       ; armor types
+.se 0
+.de ARMOR_NULL, 1
+
+       ; weapon type
+.se 0
+.de WEPAON_NULL, 1
+       
+       ; ring type
+.se 0
+.de RING_NULL, 1
+       
+       ; ring type
+.se 0
+
+       ; item struct
+.se 0
+.de item_type, 1
+       ; used for weapon damage
+.de item_damage, 1
+       ; proficiency mask needed to use the item
+.de item_prof, 1
+       ; bonus attributes provided by the item
+       ; attr struct pointer
+.de item_attr, 2
+.de item_size, 0
diff --git a/src/item.s b/src/item.s
new file mode 100644 (file)
index 0000000..b3d1b31
--- /dev/null
@@ -0,0 +1,11 @@
+items_weapons:
+       dw null_item
+       
+items_armor:
+       dw null_item
+
+items_ring:
+       dw null_item
+
+null_item:
+       itemdef 0, 0, 0, 0
index cc1a6b35754f6a6a5c2c07f96b739c72ecd5db07..9450519be0c7622599d8862dd9abee7b2cc1aa32 100644 (file)
@@ -210,3 +210,14 @@ $1:
 #macro attrdef
        .db $1, $2, $3, $4, $5, $6
 #endmacro
+       
+       ; defines an item
+       ; inputs:
+       ;               $1: type
+       ;               $2: damage
+       ;               $3: prof mask
+       ;               $4: attribute ptr (may be NULL)
+#macro itemdef
+       .db $1, $2, $3
+       dw $4
+#endmacro
index 321a571cabc6e5acc387f45afa40643d5c10863b..3884c34ff7394da74b98dd051f68d6b3f4b257a3 100644 (file)
@@ -69,6 +69,7 @@ main:
 #include "tiles.s"
 #include "levels.s"
 #include "attributes.s"
+#include "item.s"
 
 #include "tiles.inc"
 #include "text.s"