]> git.lizzy.rs Git - shadowclad.git/blobdiff - level.c
Render the level's grid of blocks
[shadowclad.git] / level.c
diff --git a/level.c b/level.c
index 8c3b59dff4a67f9ac76aea1b862b3b9142c36806..7e7f02971cace81624029e786861e42c96c1505a 100644 (file)
--- a/level.c
+++ b/level.c
@@ -5,8 +5,6 @@
 #include "level.h"
 #include "logger.h"
 
-BlockGrid levelGrid;
-
 static Block blockEmpty = { .type = BLOCKTYPE_SPACE,
                             .sceneData = NULL,
                             .textureIds = NULL };
@@ -14,6 +12,14 @@ static Block blockWall01 = { .type = BLOCKTYPE_OBSTACLE,
                              .sceneData = NULL,
                              .textureIds = NULL };
 
+static Block* testBlocks[9] = { &blockWall01, &blockWall01, &blockWall01,
+                                &blockEmpty, &blockEmpty, &blockEmpty,
+                                &blockWall01, &blockEmpty, &blockWall01 };
+
+BlockGrid levelGrid = { .width = 3,
+                        .depth = 3,
+                        .blocks = testBlocks };
+
 //static TgaImage* levelImage = NULL;
 
 static const char* replaceFileExtension(const AiString path, const char* ext);
@@ -78,6 +84,8 @@ const AiScene* importScene(const char* path) {
        }
        else if ((scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE) == AI_SCENE_FLAGS_INCOMPLETE) {
                logError("Incomplete scene imported from %s", path);
+               aiReleaseImport(scene);
+               scene = NULL;
        }
        return scene;
        // TODO aiReleaseImport(scene);