1
0
Fork 0
forked from NotAShelf/rogged

initial commit

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ie3b66d17f6f660c9b9a719210bd86f9f6a6a6964
This commit is contained in:
raf 2026-03-17 23:34:37 +03:00
commit b381e2efbd
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
29 changed files with 1633 additions and 0 deletions

63
src/common.h Normal file
View file

@ -0,0 +1,63 @@
#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;
Item inventory[MAX_INVENTORY];
int inventory_count;
} Player;
// Enemy types
typedef enum { ENEMY_GOBLIN, ENEMY_SKELETON, ENEMY_ORC } EnemyType;
// Enemy
typedef struct {
int x, y;
int hp;
int attack;
int alive;
EnemyType type;
} Enemy;
#endif // COMMON_H