From c9ae1941816183553c8c4313eac27cc831cbefba Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 26 Dec 2025 07:14:54 -0700 Subject: Working on buildings --- src/entity.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/entity.h') diff --git a/src/entity.h b/src/entity.h index 2391762..66e1973 100644 --- a/src/entity.h +++ b/src/entity.h @@ -5,7 +5,7 @@ #ifndef ENTITY_H #define ENTITY_H -#define ENTITY_COUNT 14 +#define ENTITY_COUNT 15 #define ENTITY_NAME_MAX 16 @@ -13,6 +13,8 @@ #define INTERACTION_LABEL_MAX 32 #define INTERACTION_CHAT_MAX 256 +#define ENTITY_BUILDING_CUBE_SIZE (Vector3){2.0, 2.0, 2.0} + typedef int8_t EntityId; typedef enum InteractionCommand InteractionCommand; typedef enum Selection Selection; @@ -40,6 +42,7 @@ enum { TRASH, MEDICAL_TRASH, JOHN, + JOHNS_STORE, RON }; @@ -66,6 +69,12 @@ struct Entity { void* data; }; +// Cubemap based building. +typedef struct { + Model model; + Color* pixelMap; +} EntityBuilding; + typedef struct { char name[ENTITY_NAME_MAX]; InitEntityCallback initCallback; @@ -73,6 +82,7 @@ typedef struct { CloseEntityCallback closeCallback; InteractionCallback interactionCallback; bool isPlace; + bool isBuilding; bool canBeSelected; } EntityEntry; @@ -90,6 +100,7 @@ void setEntityPosition(Entity* entity, Vector3 position); void placeEntityOnGround(Entity* entity, const World* world); bool entityIsPlace(EntityId id); +bool entityIsBuilding(EntityId id); bool entityCanBeSelected(EntityId id); float getEntityDistance(Entity entity, Vector3 position); @@ -100,4 +111,7 @@ int getInteractionMenuIndex(Selection selection); BoundingBox entityBoxFromScale(float scale, float width, float height); +EntityBuilding* createEntityBuilding(Image heightmap); +void freeEntityBuilding(EntityBuilding* entityBuilding); + #endif -- cgit v1.2.3