aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-10-25 23:18:08 +0000
committernathan <nathansmith@disroot.org>2025-10-25 23:18:08 +0000
commit32e795acb0c60a320b8449a3b7b6ee5fb5779c12 (patch)
tree62ea2eb3ccac8adba7fcdada36a63f25541913f5 /src/entities
parent233d6994bea031c0d22a77f5a8b7427a2b566e12 (diff)
downloadFindThings-32e795acb0c60a320b8449a3b7b6ee5fb5779c12.tar.gz
FindThings-32e795acb0c60a320b8449a3b7b6ee5fb5779c12.tar.bz2
FindThings-32e795acb0c60a320b8449a3b7b6ee5fb5779c12.zip
Switching to better entity system
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/bush.c12
-rw-r--r--src/entities/bush.h13
-rw-r--r--src/entities/flower.c12
-rw-r--r--src/entities/flower.h13
-rw-r--r--src/entities/john.c16
-rw-r--r--src/entities/john.h12
-rw-r--r--src/entities/medicalTrash.c14
-rw-r--r--src/entities/medicalTrash.h14
-rw-r--r--src/entities/oldMint.c12
-rw-r--r--src/entities/oldMint.h13
-rw-r--r--src/entities/pond.c15
-rw-r--r--src/entities/pond.h13
-rw-r--r--src/entities/ron.c16
-rw-r--r--src/entities/ron.h12
-rw-r--r--src/entities/samantha.c21
-rw-r--r--src/entities/samantha.h16
-rw-r--r--src/entities/samanthasSpot.c19
-rw-r--r--src/entities/samanthasSpot.h13
-rw-r--r--src/entities/shopKeeper.h8
-rw-r--r--src/entities/stickyNickel.c13
-rw-r--r--src/entities/stickyNickel.h13
-rw-r--r--src/entities/trash.c12
-rw-r--r--src/entities/trash.h14
-rw-r--r--src/entities/trashcan.c28
-rw-r--r--src/entities/trashcan.h16
-rw-r--r--src/entities/tree.c12
-rw-r--r--src/entities/tree.h13
-rw-r--r--src/entities/utilityPole.c11
-rw-r--r--src/entities/utilityPole.h12
29 files changed, 408 insertions, 0 deletions
diff --git a/src/entities/bush.c b/src/entities/bush.c
new file mode 100644
index 0000000..884ffef
--- /dev/null
+++ b/src/entities/bush.c
@@ -0,0 +1,12 @@
+#include "bush.h"
+
+void initBush(Entity* entity)
+{
+ entity->box = entityBoxFromScale(1.0, BUSH_WIDTH, BUSH_HEIGHT);
+}
+
+void updateBush(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera, game->assets.textures[BUSH_TEXTURE],
+ entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/bush.h b/src/entities/bush.h
new file mode 100644
index 0000000..70ac282
--- /dev/null
+++ b/src/entities/bush.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef BUSH_H
+#define BUSH_H
+
+#define BUSH_WIDTH 87.0
+#define BUSH_HEIGHT 62.0
+
+void initBush(Entity* entity);
+void updateBush(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/flower.c b/src/entities/flower.c
new file mode 100644
index 0000000..00f27fc
--- /dev/null
+++ b/src/entities/flower.c
@@ -0,0 +1,12 @@
+#include "flower.h"
+
+void initFlower(Entity* entity)
+{
+ entity->box = entityBoxFromScale(1.0, FLOWER_WIDTH, FLOWER_HEIGHT);
+}
+
+void updateFlower(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera, game->assets.textures[FLOWER_TEXTURE],
+ entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/flower.h b/src/entities/flower.h
new file mode 100644
index 0000000..de33197
--- /dev/null
+++ b/src/entities/flower.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef FLOWER_H
+#define FLOWER_H
+
+#define FLOWER_WIDTH 32.0
+#define FLOWER_HEIGHT 54.0
+
+void initFlower(Entity* entity);
+void updateFlower(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/john.c b/src/entities/john.c
new file mode 100644
index 0000000..94f2cae
--- /dev/null
+++ b/src/entities/john.c
@@ -0,0 +1,16 @@
+#include "john.h"
+
+void initJohn(Entity* entity)
+{
+ entity->box = (BoundingBox){
+ .min = (Vector3){-SHOPKEEPER_WIDTH, -SHOPKEEPER_HEIGHT,
+ -SHOPKEEPER_THICKNESS},
+ .max = (Vector3){SHOPKEEPER_WIDTH, SHOPKEEPER_HEIGHT,
+ SHOPKEEPER_THICKNESS}
+ };
+}
+
+void updateJohn(Entity* entity, Game* game)
+{
+ DrawModel(game->assets.models[JOHN_MODEL], entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/john.h b/src/entities/john.h
new file mode 100644
index 0000000..e2c1b11
--- /dev/null
+++ b/src/entities/john.h
@@ -0,0 +1,12 @@
+#include "game.h"
+#include "entity.h"
+#include "shopKeeper.h"
+
+#ifndef JOHN_H
+#define JOHN_H
+
+void initJohn(Entity* entity);
+void updateJohn(Entity* entity, Game* game);
+
+#endif
+
diff --git a/src/entities/medicalTrash.c b/src/entities/medicalTrash.c
new file mode 100644
index 0000000..4c4f9f3
--- /dev/null
+++ b/src/entities/medicalTrash.c
@@ -0,0 +1,14 @@
+#include "medicalTrash.h"
+
+void initMedicalTrash(Entity* entity)
+{
+ entity->box = entityBoxFromScale(MEDICAL_TRASH_SCALE, MEDICAL_TRASH_WIDTH,
+ MEDICAL_TRASH_HEIGHT);
+}
+
+void updateMedicalTrash(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera,
+ game->assets.textures[MEDICAL_TRASH_TEXTURE],
+ entity->position, MEDICAL_TRASH_SCALE, WHITE);
+}
diff --git a/src/entities/medicalTrash.h b/src/entities/medicalTrash.h
new file mode 100644
index 0000000..92c5df8
--- /dev/null
+++ b/src/entities/medicalTrash.h
@@ -0,0 +1,14 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef MEDICAL_TRASH_H
+#define MEDICAL_TRASH_H
+
+#define MEDICAL_TRASH_SCALE 2.0
+#define MEDICAL_TRASH_WIDTH 200.0
+#define MEDICAL_TRASH_HEIGHT 132.0
+
+void initMedicalTrash(Entity* entity);
+void updateMedicalTrash(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/oldMint.c b/src/entities/oldMint.c
new file mode 100644
index 0000000..17c751e
--- /dev/null
+++ b/src/entities/oldMint.c
@@ -0,0 +1,12 @@
+#include "oldMint.h"
+
+void initOldMint(Entity* entity)
+{
+ entity->box = entityBoxFromScale(1.0, OLD_MINT_WIDTH, OLD_MINT_HEIGHT);
+}
+
+void updateOldMint(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera, game->assets.textures[MINT_TEXTURE],
+ entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/oldMint.h b/src/entities/oldMint.h
new file mode 100644
index 0000000..433b4a6
--- /dev/null
+++ b/src/entities/oldMint.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef OLD_MINT_H
+#define OLD_MINT_H
+
+#define OLD_MINT_WIDTH 32.0
+#define OLD_MINT_HEIGHT 32.0
+
+void initOldMint(Entity* entity);
+void updateOldMint(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/pond.c b/src/entities/pond.c
new file mode 100644
index 0000000..a1cda5d
--- /dev/null
+++ b/src/entities/pond.c
@@ -0,0 +1,15 @@
+#include "pond.h"
+
+void initPond(Entity* entity)
+{
+ entity->box = (BoundingBox){
+ .min = (Vector3){-POND_SIZE, -POND_HEIGHT, -POND_SIZE},
+ .max = (Vector3){POND_SIZE, POND_HEIGHT, POND_SIZE}
+ };
+}
+
+void updatePond(Entity* entity, Game* game)
+{
+ DrawPlane(Vector3Add(entity->position, (Vector3){0.0, POND_HEIGHT, 0.0}),
+ (Vector2){POND_SIZE * 2.5, POND_SIZE * 2.5}, BLUE);
+}
diff --git a/src/entities/pond.h b/src/entities/pond.h
new file mode 100644
index 0000000..c041eb1
--- /dev/null
+++ b/src/entities/pond.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef POND_H
+#define POND_H
+
+#define POND_SIZE 250.0
+#define POND_HEIGHT 15.0
+
+void initPond(Entity* entity);
+void updatePond(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/ron.c b/src/entities/ron.c
new file mode 100644
index 0000000..bd32e6a
--- /dev/null
+++ b/src/entities/ron.c
@@ -0,0 +1,16 @@
+#include "ron.h"
+
+void initRon(Entity* entity)
+{
+ entity->box = (BoundingBox){
+ .min = (Vector3){-SHOPKEEPER_WIDTH, -SHOPKEEPER_HEIGHT,
+ -SHOPKEEPER_THICKNESS},
+ .max = (Vector3){SHOPKEEPER_WIDTH, SHOPKEEPER_HEIGHT,
+ SHOPKEEPER_THICKNESS}
+ };
+}
+
+void updateRon(Entity* entity, Game* game)
+{
+ DrawModel(game->assets.models[RON_MODEL], entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/ron.h b/src/entities/ron.h
new file mode 100644
index 0000000..10858c1
--- /dev/null
+++ b/src/entities/ron.h
@@ -0,0 +1,12 @@
+#include "game.h"
+#include "entity.h"
+#include "shopKeeper.h"
+
+#ifndef RON_H
+#define RON_H
+
+void initRon(Entity* entity);
+void updateRon(Entity* entity, Game* game);
+
+#endif
+
diff --git a/src/entities/samantha.c b/src/entities/samantha.c
new file mode 100644
index 0000000..a78b075
--- /dev/null
+++ b/src/entities/samantha.c
@@ -0,0 +1,21 @@
+#include "samantha.h"
+
+void initSamantha(Entity* entity)
+{
+ entity->box = (BoundingBox){
+ .min = (Vector3){-SAMANTHA_WIDTH, -SAMANTHA_HEIGHT, -SAMANTHA_THICKNESS},
+ .max = (Vector3){SAMANTHA_WIDTH, SAMANTHA_HEIGHT, SAMANTHA_THICKNESS}
+ };
+}
+
+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);
+}
diff --git a/src/entities/samantha.h b/src/entities/samantha.h
new file mode 100644
index 0000000..360c9f0
--- /dev/null
+++ b/src/entities/samantha.h
@@ -0,0 +1,16 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef SAMANTHA_H
+#define SAMANTHA_H
+
+#define SAMANTHA_WIDTH (2.65966 / 2.0)
+#define SAMANTHA_HEIGHT (3.21054 / 2.0)
+#define SAMANTHA_THICKNESS (1.46845 / 2.0)
+#define SAMANTHA_STATIC_SPEED 24
+#define SAMANTHA_STATIC_FRAMES 4
+
+void initSamantha(Entity* entity);
+void updateSamantha(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/samanthasSpot.c b/src/entities/samanthasSpot.c
new file mode 100644
index 0000000..0205e46
--- /dev/null
+++ b/src/entities/samanthasSpot.c
@@ -0,0 +1,19 @@
+#include "samanthasSpot.h"
+
+void initSamanthasSpot(Entity* entity)
+{
+ 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},
+ };
+}
+
+void updateSamanthasSpot(Entity* entity, Game* game)
+{
+ DrawModel(game->world.samanthasSpotFloor,
+ Vector3Add(entity->position,
+ (Vector3){0.0, -SAMANTHAS_SPOT_HEIGHT + 0.01, 0.0}),
+ 1.0, WHITE);
+}
diff --git a/src/entities/samanthasSpot.h b/src/entities/samanthasSpot.h
new file mode 100644
index 0000000..21413ac
--- /dev/null
+++ b/src/entities/samanthasSpot.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef SAMANTHAS_SPOT_H
+#define SAMANTHAS_SPOT_H
+
+#define SAMANTHAS_SPOT_SIZE 10
+#define SAMANTHAS_SPOT_HEIGHT 5
+
+void initSamanthasSpot(Entity* entity);
+void updateSamanthasSpot(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/shopKeeper.h b/src/entities/shopKeeper.h
new file mode 100644
index 0000000..6441bed
--- /dev/null
+++ b/src/entities/shopKeeper.h
@@ -0,0 +1,8 @@
+#ifndef SHOP_KEEPER_H
+#define SHOP_KEEPER_H
+
+#define SHOPKEEPER_WIDTH (2.04211 / 2.0)
+#define SHOPKEEPER_HEIGHT (2.59521 / 2.0)
+#define SHOPKEEPER_THICKNESS (0.493349 / 2.0)
+
+#endif
diff --git a/src/entities/stickyNickel.c b/src/entities/stickyNickel.c
new file mode 100644
index 0000000..94755c5
--- /dev/null
+++ b/src/entities/stickyNickel.c
@@ -0,0 +1,13 @@
+#include "stickyNickel.h"
+
+void initStickyNickel(Entity* entity)
+{
+ entity->box = entityBoxFromScale(1.0, STICKY_NICKEL_WIDTH,
+ STICKY_NICKEL_HEIGHT);
+}
+
+void updateStickyNickel(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera, game->assets.textures[NICKEL_TEXTURE],
+ entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/stickyNickel.h b/src/entities/stickyNickel.h
new file mode 100644
index 0000000..b7c938e
--- /dev/null
+++ b/src/entities/stickyNickel.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef STICKY_NICKEL_H
+#define STICKY_NICKEL_H
+
+#define STICKY_NICKEL_WIDTH 32.0
+#define STICKY_NICKEL_HEIGHT 32.0
+
+void initStickyNickel(Entity* entity);
+void updateStickyNickel(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/trash.c b/src/entities/trash.c
new file mode 100644
index 0000000..627276f
--- /dev/null
+++ b/src/entities/trash.c
@@ -0,0 +1,12 @@
+#include "trash.h"
+
+void initTrash(Entity* entity)
+{
+ entity->box = entityBoxFromScale(TRASH_SCALE, TRASH_WIDTH, TRASH_HEIGHT);
+}
+
+void updateTrash(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera, game->assets.textures[TRASH_TEXTURE],
+ entity->position, TRASH_SCALE, WHITE);
+}
diff --git a/src/entities/trash.h b/src/entities/trash.h
new file mode 100644
index 0000000..1505073
--- /dev/null
+++ b/src/entities/trash.h
@@ -0,0 +1,14 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef TRASH_H
+#define TRASH_H
+
+#define TRASH_SCALE 2.0
+#define TRASH_WIDTH 202.0
+#define TRASH_HEIGHT 122.0
+
+void initTrash(Entity* entity);
+void updateTrash(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/trashcan.c b/src/entities/trashcan.c
new file mode 100644
index 0000000..880bc4c
--- /dev/null
+++ b/src/entities/trashcan.c
@@ -0,0 +1,28 @@
+#include "trashcan.h"
+
+void initTrashcan(Entity* entity)
+{
+ entity->box = entityBoxFromScale(TRASHCAN_SCALE, TRASHCAN_WIDTH,
+ TRASHCAN_HEIGHT);
+}
+
+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);
+}
diff --git a/src/entities/trashcan.h b/src/entities/trashcan.h
new file mode 100644
index 0000000..62d9ae0
--- /dev/null
+++ b/src/entities/trashcan.h
@@ -0,0 +1,16 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef TRASHCAN_H
+#define TRASHCAN_H
+
+#define TRASHCAN_SCALE 2.0
+#define TRASHCAN_FRAMES 4
+#define TRASHCAN_ANIMATION_SPEED 6
+#define TRASHCAN_WIDTH 45.0
+#define TRASHCAN_HEIGHT 60.0
+
+void initTrashcan(Entity* entity);
+void updateTrashcan(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/tree.c b/src/entities/tree.c
new file mode 100644
index 0000000..7db5842
--- /dev/null
+++ b/src/entities/tree.c
@@ -0,0 +1,12 @@
+#include "tree.h"
+
+void initTree(Entity* entity)
+{
+ entity->box = entityBoxFromScale(1.0, TREE_WIDTH, TREE_HEIGHT);
+}
+
+void updateTree(Entity* entity, Game* game)
+{
+ DrawBillboard(game->player.camera, game->assets.textures[TREE_TEXTURE],
+ entity->position, 1.0, WHITE);
+}
diff --git a/src/entities/tree.h b/src/entities/tree.h
new file mode 100644
index 0000000..59b32ba
--- /dev/null
+++ b/src/entities/tree.h
@@ -0,0 +1,13 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef TREE_H
+#define TREE_H
+
+#define TREE_WIDTH 113.0
+#define TREE_HEIGHT 250.0
+
+void initTree(Entity* entity);
+void updateTree(Entity* entity, Game* game);
+
+#endif
diff --git a/src/entities/utilityPole.c b/src/entities/utilityPole.c
new file mode 100644
index 0000000..7f98d52
--- /dev/null
+++ b/src/entities/utilityPole.c
@@ -0,0 +1,11 @@
+#include "utilityPole.h"
+
+void initUtilityPole(Entity* entity)
+{
+ entity->box = (BoundingBox){
+ .min = (Vector3){-UTILITY_POLE_RADIUS, -UTILITY_POLE_HEIGHT,
+ -UTILITY_POLE_RADIUS},
+ .max = (Vector3){UTILITY_POLE_RADIUS, UTILITY_POLE_HEIGHT,
+ UTILITY_POLE_RADIUS},
+ };
+}
diff --git a/src/entities/utilityPole.h b/src/entities/utilityPole.h
new file mode 100644
index 0000000..0c107db
--- /dev/null
+++ b/src/entities/utilityPole.h
@@ -0,0 +1,12 @@
+#include "game.h"
+#include "entity.h"
+
+#ifndef UTILITY_POLE_H
+#define UTILITY_POLE_H
+
+#define UTILITY_POLE_HEIGHT 100.0
+#define UTILITY_POLE_RADIUS 3.0
+
+void initUtilityPole(Entity* entity);
+
+#endif