forked from NotAShelf/rogged
Every 15 steps the player will regain 1 HP, unless they are at max HP. Also added commented code for later hunger if this is to be implemented. Played around with step # and 15 seems okay until hunger is implemented
64 lines
982 B
C
64 lines
982 B
C
#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;
|
|
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
|