projectile: Added p0 flag to indicate if projectile is owned by player or enemy
authorLukas Krickl <lukas@krickl.dev>
Sat, 4 Oct 2025 05:08:25 +0000 (07:08 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 4 Oct 2025 05:08:25 +0000 (07:08 +0200)
src/projectile.s

index 922511b1e9d0afb2b20b05387ecefc5a832d3102..e193c476ef9946c2f84b7bf56c66b207658651d8 100644 (file)
@@ -1,13 +1,18 @@
 
 #define PISTOL_SPRITE 0x82
 
+; projectile flags
+.se 1
+.de PROJECTILE_F_PLAYER, 1
+
        ; spawns a pistol projectile for player
        ; inputs:
        ;               hl: actor ptr
 act_spawn_projectile_pistol_player:
        ld a, ACT_T_PISTOL_BULLET
        ld [hl], a ; write type
-
+       
+       push hl
        ld de, act_pos_y
        add hl, de
        ; hl = new pos y        
@@ -19,6 +24,14 @@ act_spawn_projectile_pistol_player:
        ld a, [player+act_pos_x]
        add a, 4 
        ld [hl+], a
+       pop hl
+       
+       ; set to player type
+       ld de, act_p0
+       add hl, de
+       ld a, PROJECTILE_F_PLAYER
+       ld [hl], a
+
 
        ret