From 07a21742993aaaf850c5211aaec0f922be5026b8 Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 20 Sep 2025 16:32:59 -0600 Subject: trash and medical trash hehehehe --- assets/images/medicalTrash.png | Bin 0 -> 18228 bytes assets/images/trash.png | Bin 0 -> 68506 bytes src/assets.c | 4 +++- src/assets.h | 6 ++++-- src/entity.c | 14 ++++++++++++++ src/entity.h | 10 ++++++++-- src/utils.h | 2 +- src/world.c | 27 +++++++++++++++++++++------ src/world.h | 1 + 9 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 assets/images/medicalTrash.png create mode 100644 assets/images/trash.png diff --git a/assets/images/medicalTrash.png b/assets/images/medicalTrash.png new file mode 100644 index 0000000..96e98dc Binary files /dev/null and b/assets/images/medicalTrash.png differ diff --git a/assets/images/trash.png b/assets/images/trash.png new file mode 100644 index 0000000..b1ae103 Binary files /dev/null and b/assets/images/trash.png differ diff --git a/src/assets.c b/src/assets.c index cb58ef1..3721025 100644 --- a/src/assets.c +++ b/src/assets.c @@ -10,7 +10,9 @@ const char textureAssetPaths[TEXTURE_ASSET_COUNT][FT_NAMEMAX] = { "Samantha2.png", "Samantha3.png", "Samantha4.png", - "trashcan.png" + "trashcan.png", + "trash.png", + "medicalTrash.png" }; const char imageAssetPaths[IMAGE_ASSET_COUNT][FT_NAMEMAX] = { diff --git a/src/assets.h b/src/assets.h index 7c0b370..e01c649 100644 --- a/src/assets.h +++ b/src/assets.h @@ -3,7 +3,7 @@ #ifndef ASSETS_H #define ASSETS_H -#define TEXTURE_ASSET_COUNT 10 +#define TEXTURE_ASSET_COUNT 12 #define IMAGE_ASSET_COUNT 1 #define SHADER_ASSET_COUNT 2 #define MODEL_ASSET_COUNT 2 @@ -26,7 +26,9 @@ enum { SAMANTHA_2_TEXTURE, SAMANTHA_3_TEXTURE, SAMANTHA_4_TEXTURE, - TRASHCAN_TEXTURE + TRASHCAN_TEXTURE, + TRASH_TEXTURE, + MEDICAL_TRASH_TEXTURE }; // Image asset ids. diff --git a/src/entity.c b/src/entity.c index 329aed1..3c17f5e 100644 --- a/src/entity.c +++ b/src/entity.c @@ -69,6 +69,12 @@ Entity createEntity(EntityId id, Vector3 position) entity.box = entityBoxFromScale(TRASHCAN_SCALE, TRASHCAN_WIDTH, TRASHCAN_HEIGHT); break; + case TRASH: + entity.box = entityBoxFromScale(TRASH_SCALE, 202.0, 122.0); + break; + case MEDICAL_TRASH: + entity.box = entityBoxFromScale(MEDICAL_TRASH_SCALE, 200.0, 132.0); + break; default: break; } @@ -150,6 +156,14 @@ void updateEntity(Entity* entity, Game* game) case TRASHCAN: updateTrashcan(entity, game); break; + case TRASH: + DrawBillboard(game->player.camera, game->assets.textures[TRASH_TEXTURE], + entity->position, TRASH_SCALE, WHITE); + break; + case MEDICAL_TRASH: + DrawBillboard(game->player.camera, game->assets.textures[MEDICAL_TRASH], + entity->position, MEDICAL_TRASH_SCALE, WHITE); + break; default: break; } diff --git a/src/entity.h b/src/entity.h index 839a847..30b2fcd 100644 --- a/src/entity.h +++ b/src/entity.h @@ -5,7 +5,7 @@ #ifndef ENTITY_H #define ENTITY_H -#define ENTITY_COUNT 10 +#define ENTITY_COUNT 12 #define TREE_SCALE 40.0 #define BUSH_SCALE 3.0 @@ -32,6 +32,10 @@ #define TRASHCAN_WIDTH 45.0 #define TRASHCAN_HEIGHT 60.0 +#define TRASH_SCALE 2.0 + +#define MEDICAL_TRASH_SCALE 2.0 + typedef int8_t EntityId; enum { @@ -45,7 +49,9 @@ enum { UTILITY_POLE, SAMANTHA, SAMANTHAS_SPOT, - TRASHCAN + TRASHCAN, + TRASH, + MEDICAL_TRASH }; typedef struct { diff --git a/src/utils.h b/src/utils.h index 4f09c0d..0353dbe 100644 --- a/src/utils.h +++ b/src/utils.h @@ -14,7 +14,7 @@ #ifndef UTIL_H #define UTIL_H -#define FT_DEBUG_MODE +//#define FT_DEBUG_MODE #define FT_NAMEMAX 256 diff --git a/src/world.c b/src/world.c index 0dde09d..ee465b2 100644 --- a/src/world.c +++ b/src/world.c @@ -515,20 +515,35 @@ void generateWorldSamanthasPlace(World* world, Color* heightmap, world->entities[*placeId] = samantha; *placeId = *placeId + 1; - // Trash yippee! - Vector3 trashcanPosition = (Vector3){-SAMANTHAS_SPOT, - 0.0, - SAMANTHAS_SPOT_SIZE / 1.5}; + // Trashcans yippee! + Vector3 trashPosition = (Vector3){-SAMANTHAS_SPOT, + 0.0, + SAMANTHAS_SPOT_SIZE / 2.0}; for (int index = 0; index < SAMANTHAS_SPOT_TRASHCAN_COUNT; ++index) { Entity trashcan = createEntity(TRASHCAN, - Vector3Add(trashcanPosition, center)); + Vector3Add(trashPosition, center)); world->entities[*placeId] = trashcan; *placeId = *placeId + 1; - trashcanPosition.x += (float)(SAMANTHAS_SPOT_SIZE * 2.0) + trashPosition.x += (float)(SAMANTHAS_SPOT_SIZE * 2.0) / SAMANTHAS_SPOT_TRASHCAN_COUNT; } + + // Trash and medical trash yippee! + trashPosition = (Vector3){-SAMANTHAS_SPOT, + 0.0, + SAMANTHAS_SPOT_SIZE / 1.5}; + + for (int index = 0; index < SAMANTHAS_SPOT_TRASH_COUNT; ++index) + { + Entity trash = createEntity(index % 2 == 0 ? TRASH : MEDICAL_TRASH, + Vector3Add(trashPosition, center)); + world->entities[*placeId] = trash; + *placeId = *placeId + 1; + trashPosition.x += (float)(SAMANTHAS_SPOT_SIZE * 2.0) + / SAMANTHAS_SPOT_TRASH_COUNT; + } } Seed generateWorldPlants(World* world, Seed seed, int start, int end) diff --git a/src/world.h b/src/world.h index 57f6acf..8b12d54 100644 --- a/src/world.h +++ b/src/world.h @@ -36,6 +36,7 @@ #define SAMANTHA_OFFSET (Vector3){0.0, 0.0, 2.0} #define SAMANTHAS_SPOT_TRASHCAN_COUNT 5 +#define SAMANTHAS_SPOT_TRASH_COUNT 4 // UID for anything in the world. typedef int16_t WorldUID; -- cgit v1.2.3