player: reworked equipment
authorLukas Krickl <lukas@krickl.dev>
Sat, 17 Jan 2026 10:17:13 +0000 (11:17 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 17 Jan 2026 10:17:13 +0000 (11:17 +0100)
Equipment is now a separate struct and not part of regular actors.
Only the player has equipment.

src/attributes.s
src/defs.s
src/levels.s
src/macros.inc
src/wram.s

index d813a33075886431c13a450c6bc1d53e633ffdc9..335e788349438fa6bc44f148e604a1cc7ffdc426 100644 (file)
@@ -26,7 +26,13 @@ act_attr_get_str:
        ;       returns:
        ;               a: damage value
 act_attr_get_attack_damage:
-       ld hl, act_weapon
+       ; if not player do not use weapon
+       ld a, [hl]
+       cp a, ACT_T_PLAYER
+       jp nz, @unarmed 
+
+       ; if player use right hand weapon       
+       ld hl, player_eq+eq_handr
        add hl, de
        ld a, [hl] ; load weapon type
        cp a, 0 ; if 0 -> unarmed
index c203e6bf362a1b70e533f0cfcb4e620c9ce35599..61ae2888352d6f042d9cb795ffd9881d908a7f70 100644 (file)
        ; NNNN0000: debuff status
        ;       0000NNNN: debuff type
 .de act_debuff, 1
-       ; item ids for each slot
-       ; each slot type has its own table
-       ; of items
-.de act_armor, 1
-.de act_ring, 1
-.de act_weapon, 1
        ; ptr to attribute table
 .de act_attr, 2
 .de act_size, 0
 
  
+       ; equipment struct
+       ; list of ptrs to items
+.se 0
+.de eq_head, 2
+.de eq_armor, 2
+.de eq_neck, 2
+.de eq_ringl, 2
+.de eq_ringr, 2
+.de eq_handl, 2
+.de eq_handr, 2
+.de eq_size, 0
+
        ; map flags
 .se 1
 .de MAP_F_DO_FULL_REDRAW, 1
index 603f35f68d18b3c104c299ffc9b0b23df3bf719f..407756a4bf400cc581586196d0b8049ee23dbe98 100644 (file)
@@ -14,8 +14,8 @@ l1:
        
        ; l1 actor table
 l1_acts:
-       actdef ACT_T_BAT, 0, 9, 10, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
-       actdef ACT_T_BAT, 0, 1, 2, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
+       actdef ACT_T_BAT, 0, 9, 10, 2, 1, attr_bat
+       actdef ACT_T_BAT, 0, 1, 2, 2, 1, attr_bat
        .db 0 ; terminate
 
 tile_banks_default:
index 0b0e075fee19af3aafcd44b008ca79d934208ee4..ba38410e2fad5aa9ef6090bf1f96d07b41aa5e4e 100644 (file)
@@ -196,20 +196,16 @@ $1:
        ;               $4: x
        ;               $5: hp
        ;               $6: mp
-       ;               $7: armor
-       ;               $8: ring
-       ;               $9: weapon
-       ;               $10: attributes
+       ;               $7: attributes
 #macro actdef
        .db $1, $2, $3, $4
-       ; dir, p0 and state
+       ; p0 and state
        .db 0, 0 
        dw $5
        dw $6
        ; buff/debuff
        .db 0, 0 
-       .db $7, $8, $9
-       dw $10
+       dw $7
 #endmacro
        
        ; defines an attribute list
index 0c5372f607cc3c147117ff7551ea36dc1cc49fe2..465408eafe4ecaab46be162619d601f343080d4f 100644 (file)
@@ -87,6 +87,8 @@ srand: .adv 2
 player_attr: .adv attr_size
 player_exp: .adv 2
 player_level: .adv 1
+       ; player equipment
+player_eq: .adv eq_size
 
        ; player view distance radius
 player_viewradius: .adv 1