area.h (1434B)
1 #ifndef PH_ENGINE_AREA_H 2 #define PH_ENGINE_AREA_H 3 4 #include "engine/world.h" 5 6 typedef struct { 7 int id; 8 const char *path; 9 } PhAreaDef; 10 11 typedef enum { 12 PH_MARKER_ENTITY, 13 PH_MARKER_PLAYER, 14 PH_MARKER_ITEM, 15 PH_MARKER_PORTAL, 16 PH_MARKER_ARRIVAL, 17 } PhMarkerKind; 18 19 typedef struct { 20 int area_id; 21 unsigned char symbol; 22 unsigned char tile_symbol; 23 PhMarkerKind kind; 24 int content_id; 25 int amount; 26 int territory_radius; 27 int destination_area_id; 28 unsigned char destination_symbol; 29 } PhMarkerDef; 30 31 typedef struct { 32 const PhAreaDef *areas; 33 const PhMarkerDef *markers; 34 const PhTileDef *tiles; 35 int area_count; 36 int marker_count; 37 int tile_count; 38 } PhAreaCatalog; 39 40 typedef struct { 41 const PhAreaCatalog *areas; 42 const int *equipment; 43 PhWorldCatalog content; 44 int start_area_id; 45 int equipment_count; 46 } PhWorldSetup; 47 48 const PhAreaDef *ph_area_catalog_area(const PhAreaCatalog *catalog, int area_id); 49 const PhMarkerDef *ph_area_catalog_marker(const PhAreaCatalog *catalog, 50 int area_id, unsigned char symbol); 51 int ph_area_catalog_load(PhArea *area, const PhAreaCatalog *catalog, int area_id); 52 int ph_world_start(PhWorld *world, const PhWorldSetup *setup, 53 float viewport_w, float viewport_h); 54 int ph_world_prepare_area(PhWorld *world, const PhArea *area, 55 const PhAreaCatalog *catalog, int area_id, int *player); 56 int ph_world_capture_area(PhWorld *world); 57 int ph_world_update_portal(PhWorld *world, const PhAreaCatalog *catalog); 58 59 #endif