map: expand tile system with doors
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I5704e8f954f6f935954c46ef8af40b836a6a6964
This commit is contained in:
parent
ceb657add8
commit
2f5c959500
3 changed files with 176 additions and 11 deletions
114
src/common.h
114
src/common.h
|
|
@ -9,7 +9,7 @@ typedef struct {
|
|||
} Vec2;
|
||||
|
||||
// Tile types
|
||||
typedef enum { TILE_WALL, TILE_FLOOR, TILE_STAIRS } TileType;
|
||||
typedef enum { TILE_WALL, TILE_FLOOR, TILE_STAIRS, TILE_DOOR_CLOSED, TILE_DOOR_OPEN, TILE_DOOR_RUINED } TileType;
|
||||
|
||||
// Status effect types
|
||||
typedef enum { EFFECT_NONE, EFFECT_POISON, EFFECT_STUN, EFFECT_BLEED, EFFECT_WEAKEN, EFFECT_BURN } StatusEffectType;
|
||||
|
|
@ -49,69 +49,165 @@ typedef struct {
|
|||
typedef enum { ITEM_POTION, ITEM_WEAPON, ITEM_ARMOR } ItemType;
|
||||
|
||||
// Item
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
|
||||
ItemType type;
|
||||
|
||||
int power;
|
||||
|
||||
int floor;
|
||||
|
||||
int picked_up;
|
||||
|
||||
DamageClass dmg_class;
|
||||
|
||||
int crit_chance;
|
||||
|
||||
int crit_multiplier;
|
||||
|
||||
int status_chance;
|
||||
|
||||
// rendering
|
||||
|
||||
int sprite_tile_id; // tile ID for rendering
|
||||
|
||||
} Item;
|
||||
|
||||
// Player animation states
|
||||
typedef enum { PLAYER_ANIM_IDLE, PLAYER_ANIM_WALK, PLAYER_ANIM_ATTACK } PlayerAnimState;
|
||||
|
||||
// Player
|
||||
|
||||
typedef struct {
|
||||
Vec2 position;
|
||||
|
||||
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 speed; // actions per 100 ticks (100 = 1 action per turn)
|
||||
|
||||
int cooldown; // countdown to next action (0 = can act)
|
||||
int dodge; // dodge chance percentage
|
||||
int block; // flat damage reduction on successful block roll
|
||||
|
||||
int dodge; // dodge chance percentage
|
||||
|
||||
int block; // flat damage reduction on successful block roll
|
||||
|
||||
Item equipped_weapon;
|
||||
|
||||
int has_weapon;
|
||||
|
||||
Item equipped_armor;
|
||||
|
||||
int has_armor;
|
||||
|
||||
Item inventory[MAX_INVENTORY];
|
||||
|
||||
int inventory_count;
|
||||
|
||||
// status effects
|
||||
|
||||
StatusEffect effects[MAX_EFFECTS];
|
||||
|
||||
int effect_count;
|
||||
|
||||
// animation
|
||||
|
||||
PlayerAnimState anim_state;
|
||||
|
||||
int anim_frame; // current animation frame
|
||||
|
||||
int anim_timer; // frames until next frame
|
||||
|
||||
int facing_right; // 1 = facing right, 0 = facing left
|
||||
|
||||
// rendering
|
||||
|
||||
int sprite_tile_id; // tile ID for rendering
|
||||
|
||||
// visual effects
|
||||
|
||||
int flash_timer; // damage flash frames remaining
|
||||
|
||||
} Player;
|
||||
|
||||
// Enemy types
|
||||
typedef enum { ENEMY_GOBLIN, ENEMY_SKELETON, ENEMY_ORC } EnemyType;
|
||||
|
||||
// Enemy animation states
|
||||
typedef enum { ENEMY_ANIM_IDLE, ENEMY_ANIM_WALK, ENEMY_ANIM_ATTACK } EnemyAnimState;
|
||||
|
||||
// Enemy
|
||||
|
||||
typedef struct {
|
||||
Vec2 position;
|
||||
|
||||
int hp;
|
||||
|
||||
int max_hp;
|
||||
|
||||
int attack;
|
||||
|
||||
int alive;
|
||||
|
||||
EnemyType type;
|
||||
int speed; // actions per 100 ticks
|
||||
|
||||
int speed; // actions per 100 ticks
|
||||
|
||||
int cooldown; // countdown to next action
|
||||
int dodge; // dodge chance percentage
|
||||
int block; // flat damage reduction
|
||||
|
||||
int dodge; // dodge chance percentage
|
||||
|
||||
int block; // flat damage reduction
|
||||
|
||||
int resistance[NUM_DMG_CLASSES];
|
||||
|
||||
DamageClass dmg_class;
|
||||
|
||||
int status_chance;
|
||||
|
||||
int crit_chance; // crit chance percentage (0-100)
|
||||
int crit_mult; // crit damage multiplier percentage (e.g. 150 = 1.5x)
|
||||
|
||||
int crit_mult; // crit damage multiplier percentage (e.g. 150 = 1.5x)
|
||||
|
||||
// vision
|
||||
|
||||
int vision_range;
|
||||
int alert; // 1 = aware of player, searching
|
||||
|
||||
int alert; // 1 = aware of player, searching
|
||||
|
||||
int last_known_x; // last position where enemy saw player
|
||||
|
||||
int last_known_y;
|
||||
|
||||
// status effects
|
||||
|
||||
StatusEffect effects[MAX_EFFECTS];
|
||||
|
||||
int effect_count;
|
||||
|
||||
// animation
|
||||
|
||||
EnemyAnimState anim_state;
|
||||
|
||||
int anim_frame; // current animation frame
|
||||
|
||||
int anim_timer; // frames until next frame
|
||||
|
||||
int facing_right; // 1 = facing right, 0 = facing left
|
||||
|
||||
// rendering
|
||||
|
||||
int sprite_tile_id; // tile ID for rendering
|
||||
|
||||
} Enemy;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue