aboutsummaryrefslogtreecommitdiff
path: root/src/entityGrouping.c
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-12-03 01:09:04 -0700
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-12-03 01:09:04 -0700
commit8bd37d4fe75a43deab8d6f24b481c23d7f965c5a (patch)
tree3a606dae6993778919e2ce94c6216d2f8f74d1b2 /src/entityGrouping.c
parenta8e21e0ac702fc7bcdcaf144f384cbce8aae03d0 (diff)
More and more level stuff
Diffstat (limited to 'src/entityGrouping.c')
-rw-r--r--src/entityGrouping.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/entityGrouping.c b/src/entityGrouping.c
new file mode 100644
index 0000000..1fa8a81
--- /dev/null
+++ b/src/entityGrouping.c
@@ -0,0 +1,37 @@
+#include "entityGrouping.h"
+#include "entitiesInclude.h"
+#include "game.h"
+#include "world.h"
+
+void addEntityGroupToWorld(Game * game, EntityId id, int groupSize, Vector3 position, Vector3 spacing) {
+ int i;
+ WorldEntry entries[groupSize];
+
+ for (i = 0; i < groupSize; ++i)
+ entries[i] = (WorldEntry){
+ id,
+ Vector3Add(position, Vector3Multiply((Vector3){i, i, i}, spacing)),
+ QuaternionIdentity()
+ };
+
+ addEntriesToWorld(
+ &game->world,
+ game,
+ entries,
+ sizeof(entries) / sizeof(WorldEntry)
+ );
+}
+
+void addSoldatoGroupWithLeader(Game * game, EntityId leader, int groupSize, Vector3 position, Vector3 spacing) {
+ // Add leader.
+ addEntryToWorld(&game->world, game, (WorldEntry){leader, position, QuaternionIdentity()});
+
+ // Add soldato
+ addEntityGroupToWorld(
+ game,
+ ENTITY_SOLDATO,
+ groupSize,
+ Vector3Add(position, spacing),
+ spacing
+ );
+}