aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-12-27 00:23:28 +0000
committernathan <nathansmith@disroot.org>2025-12-27 00:23:28 +0000
commitfee3654661e1411232a302d951b10cbd44d3fa91 (patch)
tree34e043b87d33eb686f6b962ecf256405936f1c74
parentc9ae1941816183553c8c4313eac27cc831cbefba (diff)
downloadFindThings-fee3654661e1411232a302d951b10cbd44d3fa91.tar.gz
FindThings-fee3654661e1411232a302d951b10cbd44d3fa91.tar.bz2
FindThings-fee3654661e1411232a302d951b10cbd44d3fa91.zip
i have a headache so i make bad code
-rw-r--r--src/entities/johnsStore.c20
-rw-r--r--src/entities/johnsStore.h1
-rw-r--r--src/utils.c2
-rw-r--r--src/utils.h2
4 files changed, 23 insertions, 2 deletions
diff --git a/src/entities/johnsStore.c b/src/entities/johnsStore.c
index 85f6303..8655c7d 100644
--- a/src/entities/johnsStore.c
+++ b/src/entities/johnsStore.c
@@ -2,12 +2,32 @@
void initJohnsStore(Entity* entity)
{
+ bool cubemap[8][8] = {
+ {true, true, true, true, true, true, true, true},
+ {true, false, false, false, false, false, false, true},
+ {true, false, false, false, false, false, false, true},
+ {true, false, false, false, false, false, false, true},
+ {true, false, false, false, false, false, false, true},
+ {true, false, false, false, false, false, false, true},
+ {true, false, false, false, false, false, false, true},
+ {true, true, true, false, false, true, true, true}
+ };
+
+ Image heightmap = generateCubemapImage((const bool**)cubemap, 8, 8);
+ entity->data = (void*)createEntityBuilding(heightmap);
+ UnloadImage(heightmap);
}
void updateJohnsStore(Entity* entity, Game* game)
{
+ EntityBuilding* building = (EntityBuilding*)entity->data;
+ DrawModel(building->model, entity->position, 1.0, WHITE);
}
void closeJohnsStore(Entity* entity)
{
+ if (entity->data != NULL)
+ {
+ freeEntityBuilding((EntityBuilding*)entity->data);
+ }
}
diff --git a/src/entities/johnsStore.h b/src/entities/johnsStore.h
index d70e99f..fd84214 100644
--- a/src/entities/johnsStore.h
+++ b/src/entities/johnsStore.h
@@ -1,5 +1,6 @@
#include "game.h"
#include "entity.h"
+#include "utils.h"
#ifndef JOHNS_STORE_H
#define JOHNS_STORE_H
diff --git a/src/utils.c b/src/utils.c
index 6d09293..063fe47 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -34,7 +34,7 @@ Vector3 randomDirection3(int seed, int* nextSeed)
return Vector3Normalize(direction);
}
-Image generateCubemapImage(bool** cubemap, int width, int height)
+Image generateCubemapImage(const bool** cubemap, int width, int height)
{
// Allocate pixel data.
Image image = (Image){
diff --git a/src/utils.h b/src/utils.h
index 4fd2ab8..bbce120 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -70,6 +70,6 @@ typedef enum FTError {
Vector2 randomDirection2(int seed, int* nextSeed);
Vector3 randomDirection3(int seed, int* nextSeed);
-Image generateCubemapImage(bool** cubemap, int width, int height);
+Image generateCubemapImage(const bool** cubemap, int width, int height);
#endif