DungeonCrawl
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1
5#ifndef COMMON_H
6#define COMMON_H
7
8#include "logging/logger.h"
9
10// change this to select color scheme
11#define PYXEL
12// I know this looks dumb af but this is the easiest way I have found
13#ifdef PYXEL
14 // AAP12 Palette
15 // define Text color
16 #define FG_R 253
17 #define FG_G 253
18 #define FG_B 253
19 // define background color
20 #define BG_R 0
21 #define BG_G 0
22 #define BG_B 0
23 // define grey
24 #define GREY_R 144
25 #define GREY_G 144
26 #define GREY_B 144
27 // define red
28 #define RED_R 180
29 #define RED_G 33
30 #define RED_B 44
31 // define yellow
32 #define YELLOW_R 244
33 #define YELLOW_G 220
34 #define YELLOW_B 95
35 // define green
36 #define GREEN_R 151
37 #define GREEN_G 197
38 #define GREEN_B 34
39 // define blue
40 #define BLUE_R 43
41 #define BLUE_G 152
42 #define BLUE_B 240
43 // define brown
44 #define BROWN_R 152
45 #define BROWN_G 88
46 #define BROWN_B 30
47#endif// PYXEL
48#ifdef AAP12
49 // AAP12 Palette
50 // define Text color
51 #define FG_R 248
52 #define FG_G 244
53 #define FG_B 236
54 // define background color
55 #define BG_R 5
56 #define BG_G 4
57 #define BG_B 4
58 // define grey
59 #define GREY_R 26
60 #define GREY_G 22
61 #define GREY_B 23
62 // define red
63 #define RED_R 151
64 #define RED_G 53
65 #define RED_B 52
66 // define yellow
67 #define YELLOW_R 238
68 #define YELLOW_G 206
69 #define YELLOW_B 103
70 // define green
71 #define GREEN_R 97
72 #define GREEN_G 129
73 #define GREEN_B 70
74 // define blue
75 #define BLUE_R 62
76 #define BLUE_G 57
77 #define BLUE_B 96
78 // define brown
79 #define BROWN_R 69
80 #define BROWN_G 36
81 #define BROWN_B 41
82#endif// AAP12
83#ifdef PICO8
84 // Pico8 Palette
85 // define Text color
86 #define FG_R 255
87 #define FG_G 238
88 #define FG_B 227
89 // define background color
90 #define BG_R 0
91 #define BG_G 0
92 #define BG_B 0
93 // define grey
94 #define GREY_R 184
95 #define GREY_G 185
96 #define GREY_B 189
97 // define red
98 #define RED_R 255
99 #define RED_G 9
100 #define RED_B 69
101 // define yellow
102 #define YELLOW_R 254
103 #define YELLOW_G 232
104 #define YELLOW_B 39
105 // define green
106 #define GREEN_R 0
107 #define GREEN_G 223
108 #define GREEN_B 50
109 // define blue
110 #define BLUE_R 39
111 #define BLUE_G 161
112 #define BLUE_B 254
113 // define brown
114 #define BROWN_R 159
115 #define BROWN_G 72
116 #define BROWN_B 49
117#endif// PICO8
118
119// defining notcurses channels
120#define DEFAULT_COLORS NCCHANNELS_INITIALIZER(FG_R, FG_G, FG_B, BG_R, BG_G, BG_B)
121#define INVERTED_COLORS NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, FG_R, FG_G, FG_B)
122#define RED_TEXT_COLORS NCCHANNELS_INITIALIZER(RED_R, RED_G, RED_B, BG_R, BG_G, BG_B)
123
124// Colors for drawing the map
125#define WALL_COLORS NCCHANNELS_INITIALIZER(BLUE_R, BLUE_G, BLUE_B, BROWN_R, BROWN_G, BROWN_B)
126#define EXIT_DOOR_COLORS NCCHANNELS_INITIALIZER(YELLOW_R, YELLOW_G, YELLOW_B, BG_R, BG_G, BG_B)
127#define KEY_COLORS NCCHANNELS_INITIALIZER(YELLOW_R, YELLOW_G, YELLOW_B, BG_R, BG_G, BG_B)
128#define GOBLIN_COLORS NCCHANNELS_INITIALIZER(RED_R, RED_G, RED_B, BG_R, BG_G, BG_B)
129#define HIDDEN_COLORS NCCHANNELS_INITIALIZER(GREY_R, GREY_G, GREY_B, GREY_R, GREY_G, GREY_B)
130#define START_DOOR_COLORS NCCHANNELS_INITIALIZER(GREEN_R, GREEN_G, GREEN_B, BG_R, BG_G, BG_B)
131#define FLOOR_COLORS NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, BG_R, BG_G, BG_B)
132#define LIFE_FOUNTAIN_COLORS NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, GREEN_R, GREEN_G, GREEN_B)
133#define MANA_FOUNTAIN_COLORS NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, BLUE_R, BLUE_G, BLUE_B)
134
136
137#define MAX_STRING_LENGTH 256
138#define MAX_NAME_LENGTH 64
139
146#define COMMON_SUCCESS 0
147
148
149#define NULL_PTR_HANDLER_RETURN(ptr, return_value, modul, format, ...) \
150 if (ptr == NULL) { \
151 log_msg(ERROR, modul, format, ##__VA_ARGS__); \
152 return return_value; \
153 }
154
155#define CHECK_ARG_RETURN(bool_expr, return_value, modul, format, ...) \
156 if (bool_expr) { \
157 log_msg(ERROR, modul, format, ##__VA_ARGS__); \
158 return return_value; \
159 }
160
164typedef struct vector2d_t {
165 int dx;
166 int dy;
168
172typedef struct string_max_t {
173 char characters[MAX_STRING_LENGTH];
175
184
185#endif//COMMON_H
memory_pool_t * main_memory_pool
Global memory pool for the application.
Definition common.c:7
Header file for logging functionality of the game.
Exposes functions for working with the memory management.
String struct with a fixed maximum length, it is directly linked to the macro MAX_STRING_LENGTH.
Definition common.h:172
2-dimensional vector struct
Definition common.h:164