#ifndef ALL_H #define ALL_H #include "raylib.h" #include "raymath.h" #include "rlgl.h" #include "config.h" // Resolve conflicts between Raylib and nonstd.h #define Color NS_Color #include "libraries/nonstd.h" #undef Color #include "libraries/vfs.h" #include #include #ifndef PLAYER_FOV #define PLAYER_FOV 90.0f #endif typedef struct { Vector3 p[3]; char texture[64]; float shift[2]; float rotate; float scale[2]; } MapPlane; typedef struct { MapPlane *planes; int plane_count; } MapBrush; typedef struct { char key[64]; char value[256]; } MapProperty; typedef struct { MapProperty *properties; int property_count; MapBrush *brushes; int brush_count; } MapEntity; typedef struct { MapEntity *entities; int entity_count; } Map; typedef struct { const char *data; size_t length; size_t pos; } MapParser; typedef struct { Vector3 normal; float dist; } Plane; typedef struct { Vector3 *verts; int count; } Polygon; typedef struct { char texture[64]; array(float) vertices; array(float) texcoords; array(float) normals; } TextureGroup; typedef struct { char name[64]; Texture2D tex; } CachedTexture; // Asset Module Texture2D get_texture(const char *name); void unload_assets(void); Font load_font_vfs(const char *path, int fontSize); // Map Module typedef struct { Model *models; int count; } MapState; bool load_map(const char *filename); void unload_map(void); bool check_map_collision(Vector3 start, Vector3 end, RayCollision *outCollision); Map parse_map(const char *filename); void free_map(Map map); // Menu Module void update_menu(void); void draw_menu(void); // Player Module typedef enum { MOVE_NORMAL, MOVE_FLY } MovementMode; typedef struct { MovementMode move_mode; Vector3 pos; Vector3 velocity; bool is_grounded; float yaw; float pitch; float lean_amount; float crouch_amount; float horizontal_speed; float camera_offset_y; // Vertical offset for stair smoothing } PlayerState; void update_player(void); // Game State Module typedef enum { STATE_MENU, STATE_PLAYING } GameStateMode; typedef struct { GameStateMode mode; char map_path[256]; Camera camera; bool cursor_captured; bool vsync; int target_fps; int screen_width; int screen_height; Font font_ui; PlayerState player; MapState map; } GameState; extern GameState game; void init_game(void); void set_map(const char *path); void update_game(void); void draw_game(void); // Geometry Helpers Plane plane_from_points(Vector3 p1, Vector3 p2, Vector3 p3); void poly_free(Polygon p); Polygon poly_clip(Polygon poly, Plane plane); Polygon create_large_quad(Plane plane); Vector2 get_uv(Vector3 p, MapPlane *mp, Plane plane, int texWidth, int texHeight); // Interface void draw_crosshair(void); void draw_debug_info(void); #endif