Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
defs.h
1 
23 //Let the record show, that Alan, Jack, and I think that Google runs thepiratebay.se
24 //6/7/2014
25 
26 #ifndef DEFS_H
27 #define DEFS_H
28 #include <color_def.h>
29 #include <string>
30 #include <ctime>
31 #include <stdlib.h>
32 #include <vector>
33 #define DEBUG 1
34 
43 enum STATS
44 {
45  HEALTH,
46  ATTACK,
47  ENDURANCE,
48  STRENGTH,
49  DEXTERITY,
50  INTELLIGENCE
51 };
52 
53 const int NUM_STATS = 6;
54 
55 extern std::string STAT_NAMES[NUM_STATS];
56 
57 /*--------------------------
58  * TERRAIN DEFS
59  -------------------------*/
60 
66 struct Tile {
73 
77  int tile_id;
78 
85  int color;
86 
91 
97  bool visible;
98 
104  bool opaque;
105 
112  bool seen;
113 
117  bool operator==(const Tile& rhs) const {
118  return this->tile_id == rhs.tile_id;
119  }
120 
121  bool operator!=(const Tile& rhs) const{
122  return this->tile_id != rhs.tile_id;
123  }
124 };
125 
126 namespace tiledef {
127  static const int TILE_TYPE_COUNT = 32;
128  extern Tile TILE_INDEX[TILE_TYPE_COUNT]; //CHANGE THIS WHEN YOU ADD TILES!
129  extern Tile OVERWORLD_DIRT; //YOU'RE NOT MY MOM!
130  extern Tile DIRT;
131  extern Tile DUNGEON_BORDER;
132  extern Tile ROOM_WALL;
133  extern Tile EMPTY;
134  //static const Tile PATH = {88, 'X', true};
135  //static const Tile PATH = {111, 'o', true};
136  extern Tile PATH;
137  extern Tile MAIN_CHAR;
138  extern Tile MAIN_CHAR2;
139  extern Tile MAIN_CHAR3;
140  extern Tile MAIN_CHAR4;
141  extern Tile TREE;
142  extern Tile BLOCK_WALL;
143  extern Tile DOWN_STAIR;
144  extern Tile UP_STAIR;
145  extern Tile KOBOLD;
146  extern Tile KOBOLD_SPAWNER;
147  extern Tile WATER;
148  extern Tile LIGHT_WATER;
149  extern Tile SAND1;
150  extern Tile SAND2;
151  extern Tile BIG_TREE;
152  extern Tile GRASS_DIRT;
153  extern Tile KOBOLD_CORPSE;
154  extern Tile BOOTS;
155  extern Tile RABBIT;
156  extern Tile RABBIT_CORPSE;
157  extern Tile SWORD;
158  extern Tile POTATO;
159  extern Tile PLANT;
160  extern Tile WOOD_WALL;
161  extern Tile WOOD_FLOOR;
162  extern Tile DOOR;
163 }
164 
168 struct MapTile {
175 
182  int color;
183 
187  int id;
188 
194 
198  bool operator==(const MapTile& rhs) const {
199  return this->id == rhs.id;
200  }
201 
205  bool operator!=(const MapTile& rhs) const {
206  return !(this->id == rhs.id);
207  }
208 };
209 
210 namespace map_tile {
211  extern MapTile MAP_TILE_INDEX[5];
212  extern MapTile MAP_DEFAULT;
213  extern MapTile MAP_WATER;
214  extern MapTile CURSOR;
215  extern MapTile MAP_FOREST;
216  extern MapTile MAP_BEACH;
217 }
218 
219 /*--------------------------
220  - ITEM DEFS
221  -------------------------*/
229 struct EquipType
230 {
234  float weight;
235 
240 
244  std::string name;
245 
249  std::string description;
250 
254  int rarity;
255 
269 
280  int type;
281 
290  int hit[3];
291 
297  float dam[3];
298 
302  bool use;
303 
307  int size;
308 
312  bool operator==(const EquipType& rhs) const
313  {
314  return this->name==rhs.name;
315  }
316 };
317 
325 {
329  float weight;
330 
335 
339  std::string name;
340 
344  std::string description;
345 
349  int rarity;
350 
354  int damage;
355 
366  int type;
367 
368 
369 
374  int range;
375 
379  bool use;
380 
384  int size;
385 
389  bool operator==(const WeaponType& rhs) const
390  {
391  return this->name==rhs.name;
392  }
393 };
394 
402 {
406  float weight;
407 
412 
416  std::string name;
417 
421  std::string description;
422 
426  bool use;
427 
431  int rarity;
432 
440  int stat;
441 
445  int value;
446 
453  int type;
454 
458  int size;
459 
463  bool operator==(const ConsumableType& rhs) const
464  {
465  return this->name==rhs.name;
466  }
467 };
468 
475 struct MiscType
476 {
480  float weight;
481 
486 
490  std::string name;
491 
495  std::string description;
496 
500  bool use;
501 
505  int rarity;
506 
510  int size;
511 
515  bool operator==(const MiscType& rhs) const
516  {
517  return this->name==rhs.name;
518  }
519 };
520 
521 
522 namespace equipment
523 {
524  extern EquipType boots;
525 }
526 
527 namespace weapons
528 {
529  extern WeaponType dagger;
530 }
531 
532 namespace consumables
533 {
534  extern ConsumableType potato;
535  static const int NUM_CONSUMABLES = 1;
536  extern ConsumableType CONSUMABLE_LIST[NUM_CONSUMABLES];
537  enum ConsumableTypes
538  {
539  RESTORE,
540  FORTIFY,
541  DROP,
542  INCREASE
543  };
544 }
545 
546 namespace misc
547 {
548  extern MiscType kobold_corpse;
549  extern MiscType rabbit_corpse;
550  extern MiscType player_corpse;
551 }
552 
553 
554 
555 /*--------------------------
556  * ENEMY DEFS
557  -------------------------*/
558 
565 struct EnemyType
566 {
570  int moral;
571 
575  std::vector<int> stats;
576 
580  int id;
581 
585  int sight;
586 
590  int view;
591 
595  int speed;
596 
600  std::string name;
601 
606 
611 
616  std::vector<EquipType> eq;
617 
622  std::vector<WeaponType> wep;
623 
627  bool operator==(const EnemyType& rhs) const
628  {
629  return this->id==rhs.id;
630  }
631 };
632 
633 namespace enemies
634 {
635  extern EnemyType kobold;
636  extern EnemyType rabbit;
637  extern EnemyType ENEMY_LIST[2];
638  extern int NUM_ENEMIES;
639 }
640 
641 #endif
bool operator!=(const MapTile &rhs) const
Definition: defs.h:205
std::vector< int > stats
Definition: defs.h:575
bool operator==(const EnemyType &rhs) const
Definition: defs.h:627
int char_count
Definition: defs.h:72
Tile sprite
Definition: defs.h:605
int rarity
Definition: defs.h:349
std::string description
Definition: defs.h:421
int moral
Definition: defs.h:570
Definition: defs.h:168
bool use
Definition: defs.h:302
int value
Definition: defs.h:445
bool operator==(const MiscType &rhs) const
Definition: defs.h:515
Definition: defs.h:475
int color
Definition: defs.h:182
Definition: defs.h:565
Tile sprite
Definition: defs.h:485
Definition: defs.cpp:100
int view
Definition: defs.h:590
bool operator==(const MapTile &rhs) const
Definition: defs.h:198
int rarity
Definition: defs.h:505
Definition: defs.h:324
Definition: defs.cpp:135
int size
Definition: defs.h:384
int rarity
Definition: defs.h:254
Definition: defs.cpp:146
int size
Definition: defs.h:510
std::string description
Definition: defs.h:249
bool visible
Definition: defs.h:97
int damage
Definition: defs.h:354
bool use
Definition: defs.h:426
bool seen
Definition: defs.h:112
std::vector< EquipType > eq
Definition: defs.h:616
Tile sprite
Definition: defs.h:334
Definition: defs.cpp:130
float dam[3]
Definition: defs.h:297
bool does_spawn
Definition: defs.h:193
bool use
Definition: defs.h:500
bool opaque
Definition: defs.h:104
std::string name
Definition: defs.h:244
int type
Definition: defs.h:366
std::string name
Definition: defs.h:490
bool operator==(const Tile &rhs) const
Definition: defs.h:117
int id
Definition: defs.h:580
Definition: defs.h:66
int char_count
Definition: defs.h:174
std::string name
Definition: defs.h:416
int type
Definition: defs.h:280
int rarity
Definition: defs.h:431
bool operator==(const ConsumableType &rhs) const
Definition: defs.h:463
int id
Definition: defs.h:187
int tile_id
Definition: defs.h:77
bool can_be_moved_through
Definition: defs.h:90
std::string description
Definition: defs.h:495
int stat
Definition: defs.h:440
int body_part
Definition: defs.h:268
int speed
Definition: defs.h:595
int size
Definition: defs.h:458
Tile sprite
Definition: defs.h:239
int range
Definition: defs.h:374
float weight
Definition: defs.h:329
int size
Definition: defs.h:307
float weight
Definition: defs.h:480
Definition: defs.h:229
std::string name
Definition: defs.h:600
Tile sprite
Definition: defs.h:411
int type
Definition: defs.h:453
float weight
Definition: defs.h:234
MiscType corpse
Definition: defs.h:610
bool operator==(const WeaponType &rhs) const
Definition: defs.h:389
Definition: defs.cpp:140
Definition: defs.h:401
Definition: defs.cpp:30
int sight
Definition: defs.h:585
std::string name
Definition: defs.h:339
std::vector< WeaponType > wep
Definition: defs.h:622
bool use
Definition: defs.h:379
float weight
Definition: defs.h:406
int hit[3]
Definition: defs.h:290
std::string description
Definition: defs.h:344
bool operator==(const EquipType &rhs) const
Definition: defs.h:312
int color
Definition: defs.h:85
Definition: defs.cpp:173