feat: World loading that's broken

This commit is contained in:
2025-10-06 16:35:22 +01:00
parent 8a360df98a
commit c4cf8f532b
4 changed files with 169 additions and 81 deletions

View File

@@ -3,6 +3,12 @@
#include "../core/math.h"
#define WORLD_HITBOX_MAX 4096
#define WORLD_PROP_MAX 2048
#define WORLD_PROP_TYPE_MAX 64
#define WORLD_TILE_TYPE_MAX 64
#define WORLD_MAP_MAX 4800
// Areas are which
typedef U32 World_Area;
enum World_Area
@@ -13,14 +19,13 @@ enum World_Area
typedef struct World_Tile World_Tile;
struct World_Tile {
U32 tile;
double rotation;
bool collision;
Str8 tag;
F32 rotation;
};
typedef struct World_PropType World_PropType;
struct World_PropType {
U32 assetHandle;
Str8 tag;
F32 scale;
};
@@ -44,14 +49,15 @@ struct World {
NavMesh *navMesh;
Random random;
V2f mouseProjected;
World_Tile tileTypes[64];
U32 map[4800];
//// Loaded from world file
World_Tile *tileTypes;
World_PropType *propTypes;
World_Prop *props;
AABB *hitboxes;
U32 *map;
World_PropType propTypes[64];
U32 propCount;
World_Prop props[256];
U32 hitboxCount;
AABB hitboxes[4096];
//// Player
Player player;
@@ -75,7 +81,7 @@ function void UpdateNPCs(F32 delta, World *world);
function void UpdateNPC(F32 delta, NPC *npc, World *world);
function void UpdateBandit(F32 delta, Bandit *bandit, World *world);
function World *LoadWorld(M_Arena *arena);
function void LoadWorld(M_Arena *arena, World *world);
function void SaveWorld(M_Arena *arena, World *world);
#endif // LD_GAME_WORLD_H_