#ifndef __DEFS_H #define __DEFS_H // MACROS #define MAXOF(a,b) (a > b ? a : b) // save/load #define MAPDIR "data/maps" #define SAVEDIR "data/save" #define DUMMYCELLTYPE 0xabcd // SPECIAL NUMBERS/CONSTANTS #define UNLIMITED (-9876) #define ALL (-9875) #define NA (-9874) // STRINGS #define BUFLENSMALL 64 #define BUFLEN 128 #define HUGEBUFLEN 1024 #define MORESTRING "--More--" // LIMITS #define SCREENW 80 #define SCREENH 24 #define MAXPILEOBS 52 #define MAXRANDOMOBCANDIDATES 100 #define MAXRANDOMLFCANDIDATES 100 #define MAX_MAPW 80 #define MAX_MAPH 50 //#define MAX_MAPROOMS 10 #define MIN_ROOMH 4 #define MIN_ROOMW 4 #define MAX_ROOMW (MAX_MAPW / 5) #define MAX_ROOMH (MAX_MAPH / 5) #define MAXDIR_ORTH 4 #define MAXDIR_COMPASS 8 // MAP BUILDING #define DEF_TURNPCT 40 #define DEF_SPARSENESS 14 //#define DEF_SPARSENESS 0 #define DEF_LOOPPCT 70 //#define DEF_LOOPPCT 0 #define MINROOMS 15 #define MAXROOMS 25 #define DEF_WINDOWPCT 5 // #define ANIMDELAY (1000000 / 100) // 1/100 of a second // askobject options #define AO_NONE 0 #define AO_INCLUDENOTHING 1 #define AO_ONLYEQUIPPED 2 // CONTROLLERS #define C_AI 0 #define C_PLAYER 1 // speed settings (lower is faster) #define SPEED_ATTACK 10 #define SPEED_DEAD 50 #define SPEED_MOVE 10 #define SPEED_DROP 5 #define SPEED_PICKUP 5 #define SPEED_THROW 10 #define SPEED_WAIT 10 #define SPEED_READ 10 #define SPEED_DRINK 5 // DIRECTION TYPES #define DT_ORTH 0 #define DT_COMPASS 1 // DIRECTIONS #define D_NONE -1 #define D_UNKNOWN -2 // Orthogonal directions #define D_N 0 #define D_E 1 #define D_S 2 #define D_W 3 // Compass directions #define DC_N 4 #define DC_NE 5 #define DC_E 6 #define DC_SE 7 #define DC_S 8 #define DC_SW 9 #define DC_W 10 #define DC_NW 11 // Cell types #define CT_WALL 0 #define CT_ROOMWALL 1 #define CT_CORRIDOR 2 #define CT_ROOM 3 #define CT_DOOROPEN 4 #define CT_DOORCLOSED 5 #define CT_LOOPCORRIDOR 6 // damage type enum DAMTYPE { DT_PIERCE, DT_SLASH, DT_CLAW, DT_BASH, DT_BITE, DT_CHOP, DT_PROJECTILE, DT_HOLY, }; // speeds #define SP_GODLIKE 1 #define SP_ULTRAFAST 5 #define SP_VERYFAST 10 #define SP_FAST 15 #define SP_NORMAL 20 #define SP_SLOW 25 #define SP_VERYSLOW 30 #define SP_ULTRASLOW 35 #define SP_SLOWEST 40 // Object Classes enum OBCLASS { OC_MONEY, OC_WEAPON, OC_ARMOUR, OC_SCROLL, OC_POTION, OC_FOOD, OC_ROCK, OC_MISC, OC_SPELL, OC_NULL = -999 }; enum BLESSTYPE { B_UNCURSED = 0, B_BLESSED = 1, B_CURSED = -1 }; enum HABITAT { H_DUNGEON = 1, H_ALL = 999 }; enum RARITY { RR_UNIQUE = 7, RR_NEVER = 6, RR_VERYRARE = 5, RR_RARE = 4, RR_UNCOMMON = 3, RR_COMMON = 2, RR_FREQUENT = 1, }; enum RACE { R_BAT, R_RAT, R_GIANTFLY, R_GIANTBLOWFLY, R_HUMAN, R_GOBLIN, }; // Object Materials enum MATERIAL { MT_NOTHING, MT_BONE, MT_STONE, MT_FIRE, MT_PLASTIC, MT_METAL, MT_GLASS, MT_FLESH, MT_WOOD, MT_GOLD, MT_PAPER, MT_ICE, MT_WATER, MT_LEATHER }; // Object Types enum OBTYPE { // rocks OT_GOLD, OT_STONE, // corpses OT_CORPSEHUMAN, OT_CORPSEGOBLIN, OT_CORPSEBAT, OT_CORPSEFLY, // spells OT_S_RNDTELEPORT, OT_S_MAPPING, // potions OT_POT_HEALING, // scrolls OT_MAP, OT_SCR_RNDTELEPORT, OT_SCR_MAPPING, // misc objects OT_EMPTYFLASK, OT_BROKENGLASS, OT_PUDDLEWATER, // armour - feet OT_BOOTSLEATHER, // armour - hands OT_GLOVESLEATHER, // animal weapons OT_TEETHT, OT_CLAWST, OT_CLAWSS, OT_FISTS, // stabbing weapons OT_STEAKKNIFE, OT_DAGGER, OT_RAPIER, OT_TRIDENT, OT_QUICKBLADE, // slashing weapons OT_SCYTHE, OT_SHORTSWORD, OT_SCIMITAR, OT_LONGSWORD, // polearms OT_SPEAR, OT_QUARTERSTAFF, // bashing weapons OT_CLUB, OT_MACE, OT_MORNINGSTAR, OT_GREATCLUB, OT_SICKLE, // holy OT_HANDOFGOD, }; enum BODYPART { BP_WEAPON, BP_RIGHTHAND, BP_LEFTHAND, BP_HANDS, BP_HEAD, BP_BODY, BP_SHOULDERS, BP_FEET, }; enum FLAG { // object flags F_STACKABLE, // can stack multiple objects togethr F_NO_PLURAL, // this obname doesn't need an 's' for plurals (eg. gold, money) F_NO_A, // this obname doesn't need to start with 'a' for singular (eg. gold) F_EDIBLE, // you can eat this. val2 = nutrition F_EQUIPPED, // val0 = where it is equipped. CLEAR WHEN OB MOVED! F_GOESON, // val0 = where it can be equipped. F_OBATTACKSPEED, // how long weapon takes to attack F_DAMTYPE, // val0 = damage type F_DAM, // val0 = ndice, val1 = nsidesondie, val2 = mod F_ACCURACY, // 100 - val0 = penalty to tohit% (ie. higher is better) F_TWOHANDED, // weapon uses two hands to weild F_UNIQUE, // only one may appear F_GLYPH, // override the glyph with the first char of text F_SHARP, // does damage when you step on it F_NOPICKUP, // cannot pick this up // armour flags F_ARMOURRATING, // val0 * 2 = pct of damage reduced // scroll flags F_LINKSPELL, // val0 = spell this scroll will cast when read // ob identification flags F_HASHIDDENNAME, // whether this object class has a hidden name F_IDENTIFIED, // whether this object is fully identified // lifeform flags F_STARTOB, // val0 = %chance of starting with it, text = ob name F_STARTOBDT, // val0 = %chance of starting with damtype val1 F_CORPSETYPE, // text field specifies what corpse obtype to leave F_LFATTACKDELAY, // how long this race takes to attack F_FLYING, // lf is flying F_HOSTILE, // lf will attack anything the player if in sight F_NODEATHANNOUNCE, // don't say 'the xx dies' if this lf dies F_TARGET, // lf will attack this lf id F_MOVESPEED, // override default move speed F_RARITY, // val[0] = habitat, val[1] = rarity F_NUMAPPEAR, // when randomly appearing, can have > 1. val[0] = min, val[1] = max F_HITDICE, // val0: # d4 to roll for hitdice. val1: +xx // COMBAT F_UNARMEDATTACKOB, // objecttype id to use when attacking unarmed F_EVASION, // % chance of evading an attack // F_NULL = -1 }; // probabilities //#define CH_DEADENDOB 35 //#define CH_EMPTYCELLOB 3 #define CH_PILLAR 5 // Booleans #define B_FALSE (0) #define B_TRUE (-1) #define B_UNKNOWN (0) #define B_KNOWN (-1) #define B_NOBADMOVES (0) #define B_BADMOVESOK (1) #define B_NOSTACK (0) #define B_STACK (-1) #define B_STACKOK (-1) #define NOOWNER (NULL) #define NOLOC (NULL) #define B_NOTSOLID (0) #define B_EMPTY (0) #define B_SOLID (-1) #define B_OPAQUE (0) #define B_TRANSPARENT (-1) #define B_TRANS (-1) // errors enum ERROR { E_OK = 0, E_WALLINWAY = 1, E_LFINWAY = 2, E_NOSPACE = 3, E_SELNOTHING = 4, E_ALREADYUSING = 5, E_WEARINGSOMETHINGELSE = 6, E_NOUNARMEDATTACK = 7, E_NOTEQUIPPED = 8, E_NOPICKUP = 9 }; typedef struct map_s { int id; char *name; // name of this map enum HABITAT habitat; // eg. dungeon, forest, etc unsigned int seed; int w,h; // width/height of this map struct cell_s *cell[MAX_MAPW*MAX_MAPH]; // list of cells in this map int nextmap[MAXDIR_ORTH]; // which map is in each direction long nextlfid; struct lifeform_s *lf,*lastlf; struct map_s *next, *prev; } map_t; //////////////// remember to modify save/load for new props!! typedef struct cell_s { map_t *map; // pointer back to map int x,y; // map coords int roomid; struct celltype_s *type; struct obpile_s *obpile; // lifeform pile struct lifeform_s *lf; // known to player? int known; // FOR CONSTRUCTION int visited; } cell_t; typedef struct celltype_s { int id; // eg. dungeonfloor, wall, door char glyph; // how to display it int solid; // can you walk through it? int transparent; // can you see through it? struct celltype_s *next, *prev; } celltype_t; typedef struct race_s { enum RACE id; char *name; char glyph; struct flagpile_s *flags; // speed modifiers // hit dice struct race_s *next, *prev; } race_t; typedef struct lifeform_s { int id; int controller; struct race_s *race; int level; int hp,maxhp; int alive; char *lastdam; int timespent; int sorted; float forgettimer; struct obpile_s *pack; struct flagpile_s *flags; // for loading long oblist[MAXPILEOBS]; int x,y; struct cell_s *cell; struct lifeform_s *next, *prev; } lifeform_t; typedef struct obpile_s { lifeform_t *owner;// } Only one of these cell_t *where; // } should be filled in struct object_s *first,*last; // for loading long oblist[MAXPILEOBS]; } obpile_t; typedef struct flagpile_s { struct flag_s *first,*last; } flagpile_t; typedef struct flag_s { enum FLAG id; int nvals; int val[3]; char *text; struct flagpile_s *pile; struct flag_s *next, *prev; } flag_t; typedef struct material_s { enum MATERIAL id; char *name; struct material_s *next,*prev; } material_t; typedef struct knowledge_s { enum OBTYPE id; char *hiddenname; int known; struct knowledge_s *next, *prev; } knowledge_t; typedef struct objectclass_s { enum OBCLASS id; char *name; char *desc; char glyph; struct flagpile_s *flags; struct objectclass_s *next, *prev; } objectclass_t; typedef struct objecttype_s { enum OBTYPE id; char *name; char *desc; struct objectclass_s *obclass; material_t *material; float weight; // in kilograms struct flagpile_s *flags; struct objecttype_s *next, *prev; } objecttype_t; typedef struct object_s { long id; // unique for every ob in the game! struct objecttype_s *type; struct obpile_s *pile; // reverse pointer back to pile // these variables are initially // inherited from objecttype: material_t *material; float weight; // in kilograms // flags // these variables are NOT inherited char *inscription; char letter; enum BLESSTYPE blessed; int blessknown; int amt; // for stackable objects flagpile_t *flags; struct object_s *next, *prev; } object_t; #endif