diff options
Diffstat (limited to 'src/entity.c')
| -rw-r--r-- | src/entity.c | 67 |
1 files changed, 18 insertions, 49 deletions
diff --git a/src/entity.c b/src/entity.c index 3f988ad..caba91a 100644 --- a/src/entity.c +++ b/src/entity.c @@ -1,22 +1,15 @@ #include "entity.h" #include "game.h" -BoundingBox entityBoxFromScale(float scale, float width, float height) -{ - Vector2 size = (Vector2){width / height * scale, scale}; - size = Vector2Scale(size, 0.5); - - return (BoundingBox){ - .min = (Vector3){-size.x, -size.y, -size.x}, - .max = (Vector3){size.x, size.y, size.x} - }; -} +const EntityEntry entityEntries[ENTITY_COUNT] = { +}; Entity createEntity(EntityId id, Vector3 position) { Entity entity; entity.id = id; entity.state = ENTITY_DEFAULT_STATE; + entity.data = NULL; // Bounding boxes. switch (id) @@ -84,8 +77,7 @@ Entity createEntity(EntityId id, Vector3 position) .min = (Vector3){-SHOPKEEPER_WIDTH, -SHOPKEEPER_HEIGHT, -SHOPKEEPER_THICKNESS}, .max = (Vector3){SHOPKEEPER_WIDTH, SHOPKEEPER_HEIGHT, - SHOPKEEPER_THICKNESS} - + SHOPKEEPER_THICKNESS} }; break; @@ -98,41 +90,6 @@ Entity createEntity(EntityId id, Vector3 position) return entity; } -void updateSamantha(Entity* entity, Game* game) -{ - // silly tv static effect. - game->assets.models[SAMANTHA_MODEL].materials[0] - .maps[MATERIAL_MAP_DIFFUSE].texture = - game->assets.textures[ - SAMANTHA_1_TEXTURE + ((int)(GetTime() * SAMANTHA_STATIC_SPEED) % - SAMANTHA_STATIC_FRAMES)]; - - DrawModel(game->assets.models[SAMANTHA_MODEL], entity->position, 1.0, - WHITE); -} - -void updateTrashcan(Entity* entity, Game* game) -{ - int frame = (int)(GetTime() * TRASHCAN_ANIMATION_SPEED) % TRASHCAN_FRAMES; - - Rectangle rect = (Rectangle){ - .x = frame * TRASHCAN_WIDTH, - .y = 0.0, - .width = TRASHCAN_WIDTH, - .height = TRASHCAN_HEIGHT - }; - - DrawBillboardRec( - game->player.camera, - game->assets.textures[TRASHCAN_TEXTURE], - rect, - entity->position, - (Vector2){TRASHCAN_SCALE - * (TRASHCAN_WIDTH / TRASHCAN_HEIGHT), - TRASHCAN_SCALE}, - WHITE); -} - void updateEntity(Entity* entity, Game* game) { //DrawBoundingBox(entity->box, RED); @@ -165,7 +122,7 @@ void updateEntity(Entity* entity, Game* game) (Vector2){POND_SIZE * 2.5, POND_SIZE * 2.5}, BLUE); break; case SAMANTHA: - updateSamantha(entity, game); + //updateSamantha(entity, game); break; case SAMANTHAS_SPOT: DrawModel(game->world.samanthasSpotFloor, @@ -174,7 +131,7 @@ void updateEntity(Entity* entity, Game* game) 1.0, WHITE); break; case TRASHCAN: - updateTrashcan(entity, game); + //updateTrashcan(entity, game); break; case TRASH: DrawBillboard(game->player.camera, game->assets.textures[TRASH_TEXTURE], @@ -253,3 +210,15 @@ InteractionCommand interactWithEntity(Entity* entity, Game* game, return INTERACTION_END; } + +BoundingBox entityBoxFromScale(float scale, float width, float height) +{ + Vector2 size = (Vector2){width / height * scale, scale}; + size = Vector2Scale(size, 0.5); + + return (BoundingBox){ + .min = (Vector3){-size.x, -size.y, -size.x}, + .max = (Vector3){size.x, size.y, size.x} + }; +} + |
