This change was made to make general actors more slim.
Actors do not need equipment and inventory slots.
Instead general actors now have a runtime spot for loot table
information.
Only the player has a special memory space for inventory/equipment data
now.
#include "unit_demo.s"
+; actor table:
+; an actor table is a list of actors
+; that can either be loaded into the active table directly
+; or it can be used as a template for placing new actors
+; that are valid for this map.
+; to use as a template use the actors but move the position
+; as needed and setting act_loot_table_dat.
+
map_c_actor_table:
.db 10 ; size
dw unit_demo_2
dw unit_demo_warrior
dw unit_demo_warrior
dw unit_demo_warrior
+
+
#define REDRAW_TILES_PER_FRAME 4
- ; each unit can have up to 4 status effects
-#define EFFECTS_MAX 4
; draw flags
.se 1
.de effect_dat, 1
.de effect_size, 0
- ; status effect types
-.se 0
-.de EFFECT_NONE, 1
-
- ; damage over time effect
- ; dat NNNN0000: timer
- ; dat 0000NNNN: damage value per tick
-.de EFFECT_DOT, 1
-
; actor type enum
.se 0
; act_def
; act_stat_def1
; act_stat_def2
- ; act_inventory_def or act_inventory_empty
- ; act_equipment_def or act_equipment_empty
- ; act_effects_def or act_effects_empty
; act_st_def
; act_def_meta
.se 0
; 00c00000: c: sub tile enabled
.de act_rt_sub_tile, 1
+ ; inventory/equipment
+ ; if type player use the file-specific inventory/equipment
+ ; for players.
+ ; for any other actor this contains information about the loot table
+ ; that can be generated by the map generator
+ ; loot tables are based on the current floor.
+.de act_rt_loot_table_dat, 2
+
; stats1
.de act_level, 1
.de act_hp, stat_size
.de act_dex, stat_size
.de act_vit, stat_size
-
-
- ; inventory
- ; stores items, for all actors but player
- ; there are 4 inventory slots.
- ; if the actor is type player a special inventory
- ; used instead
- ; call unit_get_inventory to get a ptr and length
-
- ; equipment
- ; stores all items equiped
- ; for all actors there are 6 eqipment slots
-.de act_eq_head, 2
-.de act_eq_body, 2
-.de act_eq_hand1, 2
-.de act_eq_hand2, 2
-.de act_eq_ring, 2
-.de act_eq_amulet, 2
-
- ; status effects
-.de act_effect, EFFECTS_MAX * effect_size
-
; actor states
; used for state switching
; set to 0000 to disable the state
; act_rt_collided_with
dw 0
.db 0 ; act_rt_sub_tile
+ ; act_rt_loot_table_dat
+ dw 0
#endmacro
; defines an actor's stats (1/2)
dw $4
#endmacro
-
- ; defines an actors inventory content
-#macro act_inventory_def
-#endmacro
-
- ; defines an empty inventory
-#macro act_inventory_empty
- act_inventory_def
-#endmacro
-
- ; defines an actor's equipment
- ; inputs:
- ; $1: head
- ; $2: body
- ; $3: hand1
- ; $4: hand2
- ; $5: ring
- ; $6: amulet
-#macro act_equipment_def
- dw $1
- dw $2
- dw $3
- dw $4
- dw $5
- dw $6
-#endmacro
-
- ; defines an empty equipment set
-#macro act_equipment_empty
- act_equipment_def NULL, NULL, NULL, NULL, NULL, NULL
-#endmacro
-
- ; defines an actors current stats effects
-#macro act_effects_def
-#endmacro
-
- ; defines an empty status effect table
-#macro act_effects_empty
- .db 0, 0
- .db 0, 0
- .db 0, 0
- .db 0, 0
-#endmacro
-
; defines an exit table entry
; inputs:
; $1: flags
; 3) places doors
; 4) places between 1-3 actors from a valid actor list
; actor placement may fail if the actor table is full
+ ; If the tile id is not 0 this rotuine will consider the tile invalid
+ ; and will never write to it
; inputs:
- ; a map must be loaded
+ ; hl: writable decompressed tile array (e.g [map])
+ ; of size MAP_H * MAP_W
; returns:
; a == 0: room was unable to be placed
; a == 1: room was placed
mapgen_make_room:
+ ; roll a room size
+
ret
act_def ACT_T_DEMO_1, 0, 2, 2, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 90, 1
- act_inventory_empty
- act_equipment_empty
- act_effects_empty
act_st_def NULL, NULL, st_unit_player_update, st_unit_idle
act_def_meta unit_draw, 0x8C, 0, NULL
act_def ACT_T_DEMO_1, 0, 3, 3, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
- act_inventory_empty
- act_equipment_empty
- act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update_idle, st_unit_idle
act_def_meta unit_draw, 0x88, 0, NULL
act_def ACT_T_DEMO_1, 0, 4, 4, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
- act_inventory_empty
- act_equipment_empty
- act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
act_def_meta unit_draw, 0x88, 0, NULL
act_def ACT_T_DEMO_1, 0, 4, 4, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
- act_inventory_empty
- act_equipment_empty
- act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
act_def_meta unit_draw, 0x8C, 0, NULL
act_def ACT_T_DEMO_1, 0, 4, 4, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
- act_inventory_empty
- act_equipment_empty
- act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
act_def_meta unit_draw, 0x90, 0, NULL
act_def ACT_T_DEMO_1, 0, 4, 4, 0
act_stat_def1 1, 1, 1, 1
act_stat_def2 1, 1, 32, 1
- act_inventory_empty
- act_equipment_empty
- act_effects_empty
act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
act_def_meta unit_draw, 0x94, 0, NULL
; to change its timer
st_unit_delay_to_active: .adv st_size
+ ; scroll location
+scroll_y: .adv 1
+scroll_x: .adv 1
+
+ ; +/-1 for each time the cursor moves
+ ; allows us to move scroll when needed
+scroll_move_y: .adv 1
+scroll_move_x: .adv 1
+
; game state
; this region holds the entire game state
; everything thats needed for a savme game should be
; last d16 result
d16: .adv 1
- ; +/-1 for each time the cursor moves
- ; allows us to move scroll when needed
-scroll_move_y: .adv 1
-scroll_move_x: .adv 1
; the current floor
floor: .adv 1
- ; scroll location
-scroll_y: .adv 1
-scroll_x: .adv 1
+
+
+ ; player speciifc data
+
+ ; player inventory data
+player_inventory:
+ ; TODO: add data here
+
+ ; player equipment
+ ; pointers to items
+ ; stores all items equiped
+ ; for player actors there are 6 eqipment slots
+ ; for all other actors there is no equipment
+player_equipment:
+player_eq_head: .adv 2
+player_eq_body: .adv 2
+player_eq_hand1: .adv 2
+player_eq_hand2: .adv 2
+player_eq_ring: .adv 2
+player_eq_amulet: .adv 2
; units
; player_unit (unit 0) is reserved