forked from NotAShelf/rogged
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1802469f3baff4576f61accfb5a197d86a6a6964
70 lines
1.6 KiB
C
70 lines
1.6 KiB
C
#ifndef GAME_STATE_H
|
|
#define GAME_STATE_H
|
|
|
|
#include "common.h"
|
|
#include <raylib.h>
|
|
|
|
// Floating damage text
|
|
typedef enum { LABEL_NONE = 0, LABEL_DODGE, LABEL_BLOCK, LABEL_CRIT, LABEL_SLAIN, LABEL_PROC } FloatingLabel;
|
|
|
|
typedef struct {
|
|
int x, y;
|
|
int value;
|
|
int lifetime; // frames remaining
|
|
int is_critical;
|
|
FloatingLabel label; // label type instead of string
|
|
StatusEffectType effect_type; // used to pick color for proc labels
|
|
} FloatingText;
|
|
|
|
// AudioAssets
|
|
typedef struct {
|
|
Sound attack1, attack2, attack3;
|
|
Sound pickup;
|
|
Sound staircase;
|
|
Sound dodge1, dodge2, dodge3;
|
|
Sound crit;
|
|
} AudioAssets;
|
|
|
|
// 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;
|
|
AudioAssets sounds;
|
|
// Statistics
|
|
int total_kills;
|
|
int items_collected;
|
|
int damage_dealt;
|
|
int damage_taken;
|
|
int crits_landed;
|
|
int times_hit;
|
|
int potions_used;
|
|
int floors_reached;
|
|
int final_score;
|
|
// Seed for this run
|
|
unsigned int run_seed;
|
|
} GameState;
|
|
|
|
#endif // GAME_STATE_H
|