#ifndef COMMON_H #define COMMON_H #include "settings.h" // Tile types typedef enum { TILE_WALL, TILE_FLOOR, TILE_STAIRS } TileType; // Room typedef struct { int x, y, w, h; } Room; // Map typedef struct { TileType tiles[MAP_HEIGHT][MAP_WIDTH]; Room rooms[MAX_ROOMS]; int room_count; } Map; // Dungeon typedef struct { int current_floor; Room rooms[MAX_ROOMS]; int room_count; } Dungeon; // Item types typedef enum { ITEM_POTION, ITEM_WEAPON, ITEM_ARMOR } ItemType; // Item typedef struct { int x, y; ItemType type; int power; int floor; int picked_up; } Item; // Player typedef struct { int x, y; int hp, max_hp; int attack; int defense; int floor; int step_count; int speed; // actions per 100 ticks (100 = 1 action per turn) int cooldown; // countdown to next action (0 = can act) Item equipped_weapon; int has_weapon; Item equipped_armor; int has_armor; Item inventory[MAX_INVENTORY]; int inventory_count; // damage variance range (0.8 to 1.2 = 80 to 120) int dmg_variance_min; // minimum damage multiplier (80 = 0.8x) int dmg_variance_max; // maximum damage multiplier (120 = 1.2x) } Player; // Enemy types typedef enum { ENEMY_GOBLIN, ENEMY_SKELETON, ENEMY_ORC } EnemyType; // Enemy typedef struct { int x, y; int hp; int max_hp; int attack; int alive; EnemyType type; int speed; // actions per 100 ticks int cooldown; // countdown to next action } Enemy; // Floating damage text typedef struct { int x, y; int value; int lifetime; // frames remaining int is_critical; } FloatingText; // GameState - encapsulates all game state for testability and save/load typedef struct { Player player; Map map; Dungeon dungeon; Enemy enemies[MAX_ENEMIES]; int enemy_count; Item items[MAX_ITEMS]; int item_count; int game_over; int game_won; const char *last_message; int message_timer; int turn_count; int awaiting_descend; // 0 = normal, 1 = waiting for Y/N int show_inventory; // 0 = hidden, 1 = show overlay int inv_selected; // currently selected inventory index // action log char action_log[5][128]; int log_count; int log_head; // visual effects FloatingText floating_texts[8]; int floating_count; int screen_shake; // frames of screen shake remaining int shake_x; int shake_y; } GameState; #endif // COMMON_H