29 lines
673 B
C
29 lines
673 B
C
#include "entity.h"
|
|
|
|
DEFINE_NIL_STRUCT(struct entity, entity_nil) = { 0 };
|
|
|
|
/* ========================== *
|
|
* Prop
|
|
* ========================== */
|
|
|
|
void entity_enable_prop(struct entity *entity, enum entity_prop prop)
|
|
{
|
|
u64 index = prop / 64;
|
|
u64 bit = prop % 64;
|
|
entity->props[index] |= ((u64)1 << bit);
|
|
}
|
|
|
|
void entity_disable_prop(struct entity *entity, enum entity_prop prop)
|
|
{
|
|
u64 index = prop / 64;
|
|
u64 bit = prop % 64;
|
|
entity->props[index] &= ~((u64)1 << bit);
|
|
}
|
|
|
|
b32 entity_has_prop(struct entity *entity, enum entity_prop prop)
|
|
{
|
|
u64 index = prop / 64;
|
|
u64 bit = prop % 64;
|
|
return !!(entity->props[index] & ((u64)1 << bit));
|
|
}
|