build: move map & rng logic to their own libraries
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1802469f3baff4576f61accfb5a197d86a6a6964
This commit is contained in:
parent
702b4258e0
commit
26aa295f82
17 changed files with 136 additions and 93 deletions
65
src/common.h
65
src/common.h
|
|
@ -2,7 +2,7 @@
|
|||
#define COMMON_H
|
||||
|
||||
#include "settings.h"
|
||||
#include <raylib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
|
|
@ -114,68 +114,5 @@ typedef struct {
|
|||
int effect_count;
|
||||
} Enemy;
|
||||
|
||||
// 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 // COMMON_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue