Mercurial > hg > early-roguelike
comparison urogue/rogue.h @ 256:c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
| author | John "Elwin" Edwards |
|---|---|
| date | Tue, 31 Jan 2017 19:56:04 -0500 |
| parents | |
| children | c4b12d2d1dcd |
comparison
equal
deleted
inserted
replaced
| 253:d9badb9c0179 | 256:c495a4f288c6 |
|---|---|
| 1 /* | |
| 2 rogue.h - A very large header file | |
| 3 | |
| 4 UltraRogue: The Ultimate Adventure in the Dungeons of Doom | |
| 5 Copyright (C) 1984, 1991, 1997 Herb Chong | |
| 6 All rights reserved. | |
| 7 | |
| 8 Based on "Advanced Rogue" | |
| 9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka | |
| 10 All rights reserved. | |
| 11 | |
| 12 Based on "Rogue: Exploring the Dungeons of Doom" | |
| 13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
| 14 All rights reserved. | |
| 15 | |
| 16 See the file LICENSE.TXT for full copyright and licensing information. | |
| 17 */ | |
| 18 | |
| 19 #include <signal.h> | |
| 20 #include <stdio.h> | |
| 21 #include <stdarg.h> | |
| 22 | |
| 23 #ifndef LINT | |
| 24 #include <curses.h> | |
| 25 #else | |
| 26 #include "lint-curses.h" | |
| 27 #endif | |
| 28 | |
| 29 #define SHOTPENALTY 2 /* In line of sight of missile */ | |
| 30 #define DOORPENALTY 1 /* Moving out of current room */ | |
| 31 | |
| 32 /* Maximum number of different things */ | |
| 33 #define MAXROOMS 9 /* max rooms per normal level */ | |
| 34 #define MAXDOORS 4 /* max doors to a room */ | |
| 35 #define MAXOBJ 6 /* max number of items to find on a level */ | |
| 36 #define MAXTREAS 30 /* max number monsters/treasure in treasure room */ | |
| 37 #define MAXTRAPS 80 /* max traps per level */ | |
| 38 #define MAXTRPTRY 16 /* max attempts/level allowed for setting traps */ | |
| 39 #define MAXPURCH 8 /* max purchases per trading post visit */ | |
| 40 #define NUMMONST (sizeof(monsters) / sizeof(struct monster) - 2) | |
| 41 #define NUMSUMMON 48 /* number of creatures that can summon hero */ | |
| 42 #define NLEVMONS 8 /* number of new monsters per level */ | |
| 43 #define LINELEN 512 /* characters in a buffer */ | |
| 44 | |
| 45 /* The character types */ | |
| 46 #define C_FIGHTER 0 | |
| 47 #define C_PALADIN 1 | |
| 48 #define C_RANGER 2 | |
| 49 #define C_CLERIC 3 | |
| 50 #define C_DRUID 4 | |
| 51 #define C_MAGICIAN 5 | |
| 52 #define C_ILLUSION 6 | |
| 53 #define C_THIEF 7 | |
| 54 #define C_ASSASIN 8 | |
| 55 #define C_NINJA 9 | |
| 56 #define C_MONSTER 10 | |
| 57 #define C_NOTSET 11 /* Must not be a value from above */ | |
| 58 | |
| 59 /* used for ring stuff */ | |
| 60 #define LEFT_1 0 | |
| 61 #define LEFT_2 1 | |
| 62 #define LEFT_3 2 | |
| 63 #define LEFT_4 3 | |
| 64 #define LEFT_5 4 | |
| 65 #define RIGHT_1 5 | |
| 66 #define RIGHT_2 6 | |
| 67 #define RIGHT_3 7 | |
| 68 #define RIGHT_4 8 | |
| 69 #define RIGHT_5 9 | |
| 70 | |
| 71 /* All the fun defines */ | |
| 72 #define next(ptr) ((ptr)?(ptr->l_next):NULL) | |
| 73 #define prev(ptr) ((ptr)?(ptr->l_prev):NULL) | |
| 74 #define identifier(ptr) (ptr->o_ident) | |
| 75 #define winat(y,x) ( (char) \ | |
| 76 ((mvwinch(mw,y,x) == ' ') ? mvwinch(stdscr,y,x) : winch(mw)) ) | |
| 77 | |
| 78 #define debug if (wizard && wiz_verbose) msg | |
| 79 #define verify(b) if (b) verify_function(__FILE__, __LINE__); | |
| 80 #define DISTANCE(c1, c2) ( ((c2).x - (c1).x)*((c2).x - (c1).x) + \ | |
| 81 ((c2).y - (c1).y)*((c2).y - (c1).y) ) | |
| 82 | |
| 83 #define xyDISTANCE(y1, x1, y2, x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)) | |
| 84 #define OBJPTR(what) ((*what).data.obj) | |
| 85 #define THINGPTR(what) ((*what).data.th) | |
| 86 #define ce(a, b) ((a).x == (b).x && (a).y == (b).y) | |
| 87 #define hero player.t_pos | |
| 88 #define pstats player.t_stats | |
| 89 #define max_stats player.maxstats | |
| 90 #define pack player.t_pack | |
| 91 #define attach(a, b) _attach(&a, b) | |
| 92 #define detach(a, b) _detach(&a, b) | |
| 93 #define free_list(a) _free_list(&a) | |
| 94 #ifndef max | |
| 95 #define max(a, b) ((a) > (b) ? (a) : (b)) | |
| 96 #define min(a, b) ((a) < (b) ? (a) : (b)) | |
| 97 #endif | |
| 98 #define GOLDCALC (rnd(50 + 30 * level) + 2) | |
| 99 #define o_charges o_ac | |
| 100 #define mi_wght mi_worth | |
| 101 | |
| 102 /* Things that appear on the screens */ | |
| 103 #define WALL ' ' | |
| 104 #define PASSAGE '#' | |
| 105 #define DOOR '+' | |
| 106 #define FLOOR '.' | |
| 107 #define VPLAYER '@' | |
| 108 #define IPLAYER '_' | |
| 109 #define POST '^' | |
| 110 #define LAIR '(' | |
| 111 #define RUSTTRAP ';' | |
| 112 #define TRAPDOOR '>' | |
| 113 #define ARROWTRAP '{' | |
| 114 #define SLEEPTRAP '$' | |
| 115 #define BEARTRAP '}' | |
| 116 #define TELTRAP '~' | |
| 117 #define DARTTRAP '`' | |
| 118 #define POOL '"' | |
| 119 #define MAZETRAP '\\' | |
| 120 #define FIRETRAP '<' | |
| 121 #define POISONTRAP '[' | |
| 122 #define ARTIFACT ',' | |
| 123 #define SECRETDOOR '&' | |
| 124 #define STAIRS '%' | |
| 125 #define GOLD '*' | |
| 126 #define POTION '!' | |
| 127 #define SCROLL '?' | |
| 128 #define MAGIC '$' | |
| 129 #define BMAGIC '>' /* Blessed magic */ | |
| 130 #define CMAGIC '<' /* Cursed magic */ | |
| 131 #define FOOD ':' | |
| 132 #define WEAPON ')' | |
| 133 #define ARMOR ']' | |
| 134 #define RING '=' | |
| 135 #define STICK '/' | |
| 136 | |
| 137 /* Various constants */ | |
| 138 #define HOLDTIME 2 | |
| 139 #define BEARTIME 3 | |
| 140 #define SLEEPTIME 4 | |
| 141 #define FREEZETIME 6 | |
| 142 #define STINKTIME 6 | |
| 143 #define CHILLTIME (roll(2, 4)) | |
| 144 #define STONETIME 8 | |
| 145 #define SICKTIME 10 | |
| 146 #define CLRDURATION 15 | |
| 147 #define HUHDURATION 20 | |
| 148 #define SMELLTIME 20 | |
| 149 #define HEROTIME 20 | |
| 150 #define HEALTIME 30 | |
| 151 #define WANDERTIME 140 | |
| 152 #define GONETIME 200 | |
| 153 #define PHASEDURATION 300 | |
| 154 #define SEEDURATION 850 | |
| 155 | |
| 156 #define STPOS 0 | |
| 157 #define BEFORE 1 | |
| 158 #define AFTER 2 | |
| 159 | |
| 160 #define MORETIME 150 | |
| 161 #define HUNGERTIME 1300 | |
| 162 #define STOMACHSIZE 2000 | |
| 163 | |
| 164 #define BOLT_LENGTH 10 | |
| 165 #define MARKLEN 20 | |
| 166 | |
| 167 #define LINEFEED 10 | |
| 168 #define CARRIAGE_RETURN 13 | |
| 169 #define ESCAPE 27 | |
| 170 | |
| 171 /* Adjustments for save against things */ | |
| 172 #define VS_POISON 0 | |
| 173 #define VS_PARALYZATION 0 | |
| 174 #define VS_DEATH 0 | |
| 175 #define VS_PETRIFICATION 1 | |
| 176 #define VS_WAND 2 | |
| 177 #define VS_BREATH 3 | |
| 178 #define VS_MAGIC 4 | |
| 179 | |
| 180 /*attributes for treasures in dungeon */ | |
| 181 #define ISNORMAL 0x00000000UL /* Neither blessed nor cursed */ | |
| 182 #define ISCURSED 0x00000001UL /* cursed */ | |
| 183 #define ISKNOW 0x00000002UL /* has been identified */ | |
| 184 #define ISPOST 0x00000004UL /* object is in a trading post */ | |
| 185 #define ISMETAL 0x00000008UL /* is metallic */ | |
| 186 #define ISPROT 0x00000010UL /* object is protected */ | |
| 187 #define ISBLESSED 0x00000020UL /* blessed */ | |
| 188 #define ISZAPPED 0x00000040UL /* weapon has been charged by dragon */ | |
| 189 #define ISVORPED 0x00000080UL /* vorpalized weapon */ | |
| 190 #define ISSILVER 0x00000100UL /* silver weapon */ | |
| 191 #define ISPOISON 0x00000200UL /* poisoned weapon */ | |
| 192 #define CANRETURN 0x00000400UL /* weapon returns if misses */ | |
| 193 #define ISOWNED 0x00000800UL /* weapon returns always */ | |
| 194 #define ISLOST 0x00001000UL /* weapon always disappears */ | |
| 195 #define ISMISL 0x00002000UL /* missile weapon */ | |
| 196 #define ISMANY 0x00004000UL /* show up in a group */ | |
| 197 #define CANBURN 0x00008000UL /* burns monsters */ | |
| 198 #define ISSHARP 0x00010000UL /* cutting edge */ | |
| 199 #define ISTWOH 0x00020000UL /* needs two hands to wield */ | |
| 200 #define ISLITTLE 0x00040000UL /* small weapon */ | |
| 201 #define ISLAUNCHER 0x00080000UL /* used to throw other weapons */ | |
| 202 #define TYP_MAGIC_MASK 0x0f000000UL | |
| 203 #define POT_MAGIC 0x01000000UL | |
| 204 #define SCR_MAGIC 0x02000000UL | |
| 205 #define ZAP_MAGIC 0x04000000UL | |
| 206 #define SP_WIZARD 0x10000000UL /* only wizards */ | |
| 207 #define SP_ILLUSION 0x20000000UL /* only illusionists */ | |
| 208 #define SP_CLERIC 0x40000000UL /* only clerics/paladins */ | |
| 209 #define SP_DRUID 0x80000000UL /* only druids/rangers */ | |
| 210 #define SP_MAGIC 0x30000000UL /* wizard or illusionist */ | |
| 211 #define SP_PRAYER 0xc0000000UL /* cleric or druid */ | |
| 212 #define SP_ALL 0xf0000000UL /* all special classes */ | |
| 213 #define _TWO_ ISBLESSED /* more powerful spell */ | |
| 214 | |
| 215 /* Various flag bits */ | |
| 216 #define ISDARK 0x00000001UL | |
| 217 #define ISGONE 0x00000002UL | |
| 218 #define ISTREAS 0x00000004UL | |
| 219 #define ISFOUND 0x00000008UL | |
| 220 #define ISTHIEFSET 0x00000010UL | |
| 221 #define WASDARK 0x00000020UL | |
| 222 | |
| 223 /* struct thing t_flags (might include player) for monster attributes */ | |
| 224 #define ISBLIND 0x00000001UL | |
| 225 #define ISINWALL 0x00000002UL | |
| 226 #define ISRUN 0x00000004UL | |
| 227 #define ISFLEE 0x00000008UL | |
| 228 #define ISINVIS 0x00000010UL | |
| 229 #define ISMEAN 0x00000020UL | |
| 230 #define ISGREED 0x00000040UL | |
| 231 #define CANSHOOT 0x00000080UL | |
| 232 #define ISHELD 0x00000100UL | |
| 233 #define ISHUH 0x00000200UL | |
| 234 #define ISREGEN 0x00000400UL | |
| 235 #define CANHUH 0x00000800UL | |
| 236 #define CANSEE 0x00001000UL | |
| 237 #define HASFIRE 0x00002000UL | |
| 238 #define ISSLOW 0x00004000UL | |
| 239 #define ISHASTE 0x00008000UL | |
| 240 #define ISCLEAR 0x00010000UL | |
| 241 #define CANINWALL 0x00020000UL | |
| 242 #define ISDISGUISE 0x00040000UL | |
| 243 #define CANBLINK 0x00080000UL | |
| 244 #define CANSNORE 0x00100000UL | |
| 245 #define HALFDAMAGE 0x00200000UL | |
| 246 #define CANSUCK 0x00400000UL | |
| 247 #define CANRUST 0x00800000UL | |
| 248 #define CANPOISON 0x01000000UL | |
| 249 #define CANDRAIN 0x02000000UL | |
| 250 #define ISUNIQUE 0x04000000UL | |
| 251 #define STEALGOLD 0x08000000UL | |
| 252 #define STEALMAGIC 0x10000001UL | |
| 253 #define CANDISEASE 0x10000002UL | |
| 254 #define HASDISEASE 0x10000004UL | |
| 255 #define CANSUFFOCATE 0x10000008UL | |
| 256 #define DIDSUFFOCATE 0x10000010UL | |
| 257 #define BOLTDIVIDE 0x10000020UL | |
| 258 #define BLOWDIVIDE 0x10000040UL | |
| 259 #define NOCOLD 0x10000080UL | |
| 260 #define TOUCHFEAR 0x10000100UL | |
| 261 #define BMAGICHIT 0x10000200UL | |
| 262 #define NOFIRE 0x10000400UL | |
| 263 #define NOBOLT 0x10000800UL | |
| 264 #define CARRYGOLD 0x10001000UL | |
| 265 #define CANITCH 0x10002000UL | |
| 266 #define HASITCH 0x10004000UL | |
| 267 #define DIDDRAIN 0x10008000UL | |
| 268 #define WASTURNED 0x10010000UL | |
| 269 #define CANSELL 0x10020000UL | |
| 270 #define CANBLIND 0x10040000UL | |
| 271 #define CANBBURN 0x10080000UL | |
| 272 #define ISCHARMED 0x10100000UL | |
| 273 #define CANSPEAK 0x10200000UL | |
| 274 #define CANFLY 0x10400000UL | |
| 275 #define ISFRIENDLY 0x10800000UL | |
| 276 #define CANHEAR 0x11000000UL | |
| 277 #define ISDEAF 0x12000000UL | |
| 278 #define CANSCENT 0x14000000UL | |
| 279 #define ISUNSMELL 0x18000000UL | |
| 280 #define WILLRUST 0x20000001UL | |
| 281 #define WILLROT 0x20000002UL | |
| 282 #define SUPEREAT 0x20000004UL | |
| 283 #define PERMBLIND 0x20000008UL | |
| 284 #define MAGICHIT 0x20000010UL | |
| 285 #define CANINFEST 0x20000020UL | |
| 286 #define HASINFEST 0x20000040UL | |
| 287 #define NOMOVE 0x20000080UL | |
| 288 #define CANSHRIEK 0x20000100UL | |
| 289 #define CANDRAW 0x20000200UL | |
| 290 #define CANSMELL 0x20000400UL | |
| 291 #define CANPARALYZE 0x20000800UL | |
| 292 #define CANROT 0x20001000UL | |
| 293 #define ISSCAVENGE 0x20002000UL | |
| 294 #define DOROT 0x20004000UL | |
| 295 #define CANSTINK 0x20008000UL | |
| 296 #define HASSTINK 0x20010000UL | |
| 297 #define ISSHADOW 0x20020000UL | |
| 298 #define CANCHILL 0x20040000UL | |
| 299 #define CANHUG 0x20080000UL | |
| 300 #define CANSURPRISE 0x20100000UL | |
| 301 #define CANFRIGHTEN 0x20200000UL | |
| 302 #define CANSUMMON 0x20400000UL | |
| 303 #define TOUCHSTONE 0x20800000UL | |
| 304 #define LOOKSTONE 0x21000000UL | |
| 305 #define CANHOLD 0x22000000UL | |
| 306 #define DIDHOLD 0x24000000UL | |
| 307 #define DOUBLEDRAIN 0x28000000UL | |
| 308 #define ISUNDEAD 0x30000001UL | |
| 309 #define BLESSMAP 0x30000002UL | |
| 310 #define BLESSGOLD 0x30000004UL | |
| 311 #define BLESSMONS 0x30000008UL | |
| 312 #define BLESSMAGIC 0x30000010UL | |
| 313 #define BLESSFOOD 0x30000020UL | |
| 314 #define CANBRANDOM 0x30000040UL /* Types of breath */ | |
| 315 #define CANBACID 0x30000080UL | |
| 316 #define CANBFIRE 0x30000100UL | |
| 317 #define CANBBOLT 0x30000200UL | |
| 318 #define CANBGAS 0x30000400UL | |
| 319 #define CANBICE 0x30000800UL | |
| 320 #define CANBPGAS 0x30001000UL /* Paralyze gas */ | |
| 321 #define CANBSGAS 0x30002000UL /* Sleeping gas */ | |
| 322 #define CANBSLGAS 0x30004000UL /* Slow gas */ | |
| 323 #define CANBFGAS 0x30008000UL /* Fear gas */ | |
| 324 #define CANBREATHE 0x3000ffc0UL /* Can it breathe at all? */ | |
| 325 #define STUMBLER 0x30010000UL | |
| 326 #define POWEREAT 0x30020000UL | |
| 327 #define ISELECTRIC 0x30040000UL | |
| 328 #define HASOXYGEN 0x30080000UL /* Doesn't need to breath air */ | |
| 329 #define POWERDEXT 0x30100000UL | |
| 330 #define POWERSTR 0x30200000UL | |
| 331 #define POWERWISDOM 0x30400000UL | |
| 332 #define POWERINTEL 0x30800000UL | |
| 333 #define POWERCONST 0x31000000UL | |
| 334 #define SUPERHERO 0x32000000UL | |
| 335 #define ISUNHERO 0x34000000UL | |
| 336 #define CANCAST 0x38000000UL | |
| 337 #define CANTRAMPLE 0x40000001UL | |
| 338 #define CANSWIM 0x40000002UL | |
| 339 #define LOOKSLOW 0x40000004UL | |
| 340 #define CANWIELD 0x40000008UL | |
| 341 #define CANDARKEN 0x40000010UL | |
| 342 #define ISFAST 0x40000020UL | |
| 343 #define CANBARGAIN 0x40000040UL | |
| 344 #define NOMETAL 0x40000080UL | |
| 345 #define CANSPORE 0x40000100UL | |
| 346 #define NOSHARP 0x40000200UL | |
| 347 #define DRAINWISDOM 0x40000400UL | |
| 348 #define DRAINBRAIN 0x40000800UL | |
| 349 #define ISLARGE 0x40001000UL | |
| 350 #define ISSMALL 0x40002000UL | |
| 351 #define CANSTAB 0x40004000UL | |
| 352 #define ISFLOCK 0x40008000UL | |
| 353 #define ISSWARM 0x40010000UL | |
| 354 #define CANSTICK 0x40020000UL | |
| 355 #define CANTANGLE 0x40040000UL | |
| 356 #define DRAINMAGIC 0x40080000UL | |
| 357 #define SHOOTNEEDLE 0x40100000UL | |
| 358 #define CANZAP 0x40200000UL | |
| 359 #define HASARMOR 0x40400000UL | |
| 360 #define CANTELEPORT 0x40800000UL | |
