aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-09-20 18:44:28 +0000
committernathan <nathansmith@disroot.org>2025-09-20 18:44:28 +0000
commit382c97573213414ebdfee30743ba516e4feb7602 (patch)
tree8246203253a9d8ddbdc0e51bfcbfaa613738d18c
parentfa12453c89df76baa2294373a7a5b8e20801157c (diff)
downloadFindThings-382c97573213414ebdfee30743ba516e4feb7602.tar.gz
FindThings-382c97573213414ebdfee30743ba516e4feb7602.tar.bz2
FindThings-382c97573213414ebdfee30743ba516e4feb7602.zip
Brain dead
-rw-r--r--assets/images/trashcan.pngbin0 -> 5300 bytes
-rw-r--r--src/assets.c3
-rw-r--r--src/assets.h5
-rw-r--r--src/entity.c20
-rw-r--r--src/entity.h11
-rw-r--r--src/world.c45
-rw-r--r--src/world.h8
7 files changed, 65 insertions, 27 deletions
diff --git a/assets/images/trashcan.png b/assets/images/trashcan.png
new file mode 100644
index 0000000..96e0d1c
--- /dev/null
+++ b/assets/images/trashcan.png
Binary files differ
diff --git a/src/assets.c b/src/assets.c
index 68f59f8..cb58ef1 100644
--- a/src/assets.c
+++ b/src/assets.c
@@ -9,7 +9,8 @@ const char textureAssetPaths[TEXTURE_ASSET_COUNT][FT_NAMEMAX] = {
"Samantha1.png",
"Samantha2.png",
"Samantha3.png",
- "Samantha4.png"
+ "Samantha4.png",
+ "trashcan.png"
};
const char imageAssetPaths[IMAGE_ASSET_COUNT][FT_NAMEMAX] = {
diff --git a/src/assets.h b/src/assets.h
index 0b7db82..7c0b370 100644
--- a/src/assets.h
+++ b/src/assets.h
@@ -3,7 +3,7 @@
#ifndef ASSETS_H
#define ASSETS_H
-#define TEXTURE_ASSET_COUNT 9
+#define TEXTURE_ASSET_COUNT 10
#define IMAGE_ASSET_COUNT 1
#define SHADER_ASSET_COUNT 2
#define MODEL_ASSET_COUNT 2
@@ -25,7 +25,8 @@ enum {
SAMANTHA_1_TEXTURE,
SAMANTHA_2_TEXTURE,
SAMANTHA_3_TEXTURE,
- SAMANTHA_4_TEXTURE
+ SAMANTHA_4_TEXTURE,
+ TRASHCAN_TEXTURE
};
// Image asset ids.
diff --git a/src/entity.c b/src/entity.c
index 18e44aa..bc6bb99 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -17,6 +17,7 @@ Entity createEntity(EntityId id, Vector3 position)
Entity entity;
entity.id = id;
+ // Bounding boxes.
switch (id)
{
case OLD_MINT:
@@ -55,6 +56,18 @@ Entity createEntity(EntityId id, Vector3 position)
};
break;
+ case SAMANTHAS_SPOT:
+ entity.box = (BoundingBox){
+ .min = (Vector3){-SAMANTHAS_SPOT_SIZE, -SAMANTHAS_SPOT_HEIGHT,
+ -SAMANTHAS_SPOT_SIZE},
+ .max = (Vector3){SAMANTHAS_SPOT_SIZE, SAMANTHAS_SPOT_HEIGHT,
+ SAMANTHAS_SPOT_SIZE},
+ };
+
+ break;
+ case TRASHCAN:
+ entity.box = entityBoxFromScale(TRASHCAN_SCALE, 45.0, 60.0);
+ break;
default:
break;
}
@@ -66,7 +79,7 @@ Entity createEntity(EntityId id, Vector3 position)
void updateEntity(Entity* entity, Game* game)
{
- //DrawBoundingBox(entity->box, RED);
+ DrawBoundingBox(entity->box, RED);
switch (entity->id)
{
@@ -106,6 +119,11 @@ void updateEntity(Entity* entity, Game* game)
DrawModel(game->assets.models[SAMANTHA_MODEL], entity->position, 1.0,
WHITE);
break;
+ case TRASHCAN:
+ DrawBillboard(game->player.camera,
+ game->assets.textures[TRASHCAN_TEXTURE],
+ entity->position, FLOWER_SCALE, WHITE);
+ break;
default:
break;
}
diff --git a/src/entity.h b/src/entity.h
index a8488f8..8078cfc 100644
--- a/src/entity.h
+++ b/src/entity.h
@@ -5,7 +5,7 @@
#ifndef ENTITY_H
#define ENTITY_H
-#define ENTITY_COUNT 8
+#define ENTITY_COUNT 10
#define TREE_SCALE 40.0
#define BUSH_SCALE 3.0
@@ -23,6 +23,11 @@
#define SAMANTHA_STATIC_SPEED 24
#define SAMANTHA_STATIC_FRAMES 4
+#define SAMANTHAS_SPOT_SIZE 10
+#define SAMANTHAS_SPOT_HEIGHT 5
+
+#define TRASHCAN_SCALE 2.0
+
typedef int8_t EntityId;
enum {
@@ -34,7 +39,9 @@ enum {
FLOWER,
POND,
UTILITY_POLE,
- SAMANTHA
+ SAMANTHA,
+ SAMANTHAS_SPOT,
+ TRASHCAN
};
typedef struct {
diff --git a/src/world.c b/src/world.c
index c7c34d5..a32bec2 100644
--- a/src/world.c
+++ b/src/world.c
@@ -485,16 +485,33 @@ Seed generatePond(World* world, Color* heightmap, WorldUID id, Seed seed)
return seed;
}
-void generateWorldSamanthasPlace(World* world, Color* heightmap)
+void generateWorldSamanthasPlace(World* world, Color* heightmap,
+ WorldUID* placeId)
{
+ // Make area flat.
+ float width = WORLD_IMAGE_WIDTH / world->size.x * SAMANTHAS_SPOT_SIZE;
+ float height = WORLD_IMAGE_HEIGHT / world->size.z * SAMANTHAS_SPOT_SIZE;
+
Rectangle area = (Rectangle){
- .x = WORLD_IMAGE_WIDTH / 2.0 - PLACE_SAMANTHAS_SPOT_SIZE / 2.0,
- .y = WORLD_IMAGE_HEIGHT / 2.0 - PLACE_SAMANTHAS_SPOT_SIZE / 2.0,
- .width = PLACE_SAMANTHAS_SPOT_SIZE,
- .height = PLACE_SAMANTHAS_SPOT_SIZE
+ .x = WORLD_IMAGE_WIDTH / 2.0 - width,
+ .y = WORLD_IMAGE_HEIGHT / 2.0 - height,
+ .width = width,
+ .height = height
};
averageOutAreaWorld(world, heightmap, area);
+
+ // Samanthas spot.
+ Vector3 center = Vector3Scale(world->size, 0.5);
+ Entity spot = createEntity(SAMANTHAS_SPOT, center);
+ world->entities[*placeId] = spot;
+ *placeId = *placeId + 1;
+
+ // Samantha.
+ Entity samantha = createEntity(SAMANTHA, Vector3Add(center,
+ SAMANTHA_OFFSET));
+ world->entities[*placeId] = samantha;
+ *placeId = *placeId + 1;
}
Seed generateWorldPlants(World* world, Seed seed, int start, int end)
@@ -661,13 +678,6 @@ Texture generateGroundTexture()
Seed generateWorldCharacters(World* world, Seed seed, int index)
{
- // Create samantha.
- Entity samantha = createEntity(
- SAMANTHA,
- Vector3Add(Vector3Scale(world->size, 0.5), SAMANTHA_OFFSET));
- placeEntityOnGround(&samantha, world);
- world->entities[index] = samantha;
-
return seed;
}
@@ -691,7 +701,8 @@ World createWorld(Seed seed, const Assets* assets)
seed = generatePond(&world, colors, placeId, seed);
world.places[0] = placeId;
- generateWorldSamanthasPlace(&world, colors);
+ ++placeId;
+ generateWorldSamanthasPlace(&world, colors, &placeId);
// Heightmap model.
image = (Image){
@@ -708,7 +719,7 @@ World createWorld(Seed seed, const Assets* assets)
UnloadImage(image);
// Put places on ground.
- for (int index = 0; index < WORLD_PLACE_COUNT; ++index)
+ for (int index = 0; index < placeId; ++index)
{
placeEntityOnGround(&world.entities[index], &world);
}
@@ -728,9 +739,9 @@ World createWorld(Seed seed, const Assets* assets)
seed = generateWorldUtilityPoles(&world, assets, seed, start, end);
// Characters.
- start = end;
- end = WORLD_CHARACTER_COUNT + start;
- seed = generateWorldCharacters(&world, seed, start);
+ /* start = end; */
+ /* end = WORLD_CHARACTER_COUNT + start; */
+ /* seed = generateWorldCharacters(&world, seed, start); */
// Items.
start = end;
diff --git a/src/world.h b/src/world.h
index 338f935..79bb98e 100644
--- a/src/world.h
+++ b/src/world.h
@@ -8,7 +8,7 @@
#define WORLD_ENTITY_MAX 5001
#define WORLD_PLANT_COUNT 2500
#define WORLD_UTILITY_POLE_COUNT 25
-#define WORLD_PLACE_COUNT 1
+#define WORLD_PLACE_COUNT 2
#define WORLD_SIZE (Vector3){4096.0, 256.0, 4096.0}
#define WORLD_IMAGE_WIDTH 512
@@ -32,9 +32,8 @@
#define PLACE_POND_WALKING_AREA 7
// Characters.
-#define WORLD_CHARACTER_COUNT 1
+#define WORLD_CHARACTER_COUNT 0
-#define PLACE_SAMANTHAS_SPOT_SIZE 10
#define SAMANTHA_OFFSET (Vector3){0.0, 0.0, 2.0}
// UID for anything in the world.
@@ -43,7 +42,8 @@ typedef int Seed;
// Places.
enum {
- PLACE_POND
+ PLACE_POND,
+ PLACE_SAMANTHAS_PLACE
};
typedef struct BVHNode {