| 1 | /* header.h Larn is copyrighted 1986 by Noah Morgan. */ |
| 2 | |
| 3 | #include <fcntl.h> |
| 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <string.h> |
| 7 | #include <termcap.h> |
| 8 | #include <time.h> |
| 9 | #include <unistd.h> |
| 10 | |
| 11 | #define MAXLEVEL 11 |
| 12 | /* max # levels in the dungeon */ |
| 13 | #define MAXVLEVEL 3 |
| 14 | /* max # of levels in the temple of the luran */ |
| 15 | #define MAXX 67 |
| 16 | #define MAXY 17 |
| 17 | |
| 18 | #define SCORESIZE 10 |
| 19 | /* this is the number of people on a scoreboard max */ |
| 20 | #define MAXPLEVEL 100 |
| 21 | /* maximum player level allowed */ |
| 22 | #define MAXMONST 56 |
| 23 | /* maximum # monsters in the dungeon */ |
| 24 | #define SPNUM 38 |
| 25 | /* maximum number of spells in existence */ |
| 26 | #define MAXSCROLL 28 |
| 27 | /* maximum number of scrolls that are possible */ |
| 28 | #define MAXPOTION 35 |
| 29 | /* maximum number of potions that are possible */ |
| 30 | #define TIMELIMIT 30000 |
| 31 | /* the maximum number of moves before the game is called */ |
| 32 | #define TAXRATE 1/20 |
| 33 | /* the tax rate for the LRS */ |
| 34 | #define MAXOBJ 93 |
| 35 | /* the maximum number of objects n < MAXOBJ */ |
| 36 | |
| 37 | /* this is the structure definition of the monster data */ |
| 38 | struct monst { |
| 39 | const char *name; |
| 40 | char level; |
| 41 | short armorclass; |
| 42 | char damage; |
| 43 | char attack; |
| 44 | char defense; |
| 45 | char genocided; |
| 46 | char intelligence; /* monsters intelligence -- used to choose movement */ |
| 47 | short gold; |
| 48 | short hitpoints; |
| 49 | unsigned long experience; |
| 50 | }; |
| 51 | |
| 52 | /* this is the structure definition for the items in the dnd store */ |
| 53 | struct _itm { |
| 54 | short price; |
| 55 | short obj; |
| 56 | short arg; |
| 57 | short qty; |
| 58 | }; |
| 59 | |
| 60 | /* this is the structure that holds the entire dungeon specifications */ |
| 61 | struct cel { |
| 62 | short hitp; /* monster's hit points */ |
| 63 | char mitem; /* the monster ID */ |
| 64 | char item; /* the object's ID */ |
| 65 | short iarg; /* the object's argument */ |
| 66 | char know; /* have we been here before */ |
| 67 | }; |
| 68 | |
| 69 | /* this is the structure for maintaining & moving the spheres of annihilation */ |
| 70 | struct sphere { |
| 71 | struct sphere *p; /* pointer to next structure */ |
| 72 | char x,y,lev; /* location of the sphere */ |
| 73 | char dir; /* direction sphere is going in */ |
| 74 | char lifetime; /* duration of the sphere */ |
| 75 | }; |
| 76 | |
| 77 | /* defines for the character attribute array c[] */ |
| 78 | #define STRENGTH 0 /* characters physical strength not due to objects */ |
| 79 | #define INTELLIGENCE 1 |
| 80 | #define WISDOM 2 |
| 81 | #define CONSTITUTION 3 |
| 82 | #define DEXTERITY 4 |
| 83 | #define CHARISMA 5 |
| 84 | #define HPMAX 6 |
| 85 | #define HP 7 |
| 86 | #define GOLD 8 |
| 87 | #define EXPERIENCE 9 |
| 88 | #define LEVEL 10 |
| 89 | #define REGEN 11 |
| 90 | #define WCLASS 12 |
| 91 | #define AC 13 |
| 92 | #define BANKACCOUNT 14 |
| 93 | #define SPELLMAX 15 |
| 94 | #define SPELLS 16 |
| 95 | #define ENERGY 17 |
| 96 | #define ECOUNTER 18 |
| 97 | #define MOREDEFENSES 19 |
| 98 | #define WEAR 20 |
| 99 | #define PROTECTIONTIME 21 |
| 100 | #define WIELD 22 |
| 101 | #define AMULET 23 |
| 102 | #define REGENCOUNTER 24 |
| 103 | #define MOREDAM 25 |
| 104 | #define DEXCOUNT 26 |
| 105 | #define STRCOUNT 27 |
| 106 | #define BLINDCOUNT 28 |
| 107 | #define CAVELEVEL 29 |
| 108 | #define CONFUSE 30 |
| 109 | #define ALTPRO 31 |
| 110 | #define HERO 32 |
| 111 | #define CHARMCOUNT 33 |
| 112 | #define INVISIBILITY 34 |
| 113 | #define CANCELLATION 35 |
| 114 | #define HASTESELF 36 |
| 115 | #define EYEOFLARN 37 |
| 116 | #define AGGRAVATE 38 |
| 117 | #define GLOBE 39 |
| 118 | #define TELEFLAG 40 |
| 119 | #define SLAYING 41 |
| 120 | #define NEGATESPIRIT 42 |
| 121 | #define SCAREMONST 43 |
| 122 | #define AWARENESS 44 |
| 123 | #define HOLDMONST 45 |
| 124 | #define TIMESTOP 46 |
| 125 | #define HASTEMONST 47 |
| 126 | #define CUBEofUNDEAD 48 |
| 127 | #define GIANTSTR 49 |
| 128 | #define FIRERESISTANCE 50 |
| 129 | #define BESSMANN 51 |
| 130 | #define NOTHEFT 52 |
| 131 | #define HARDGAME 53 |
| 132 | #define CPUTIME 54 |
| 133 | #define BYTESIN 55 |
| 134 | #define BYTESOUT 56 |
| 135 | #define MOVESMADE 57 |
| 136 | #define MONSTKILLED 58 |
| 137 | #define SPELLSCAST 59 |
| 138 | #define LANCEDEATH 60 |
| 139 | #define SPIRITPRO 61 |
| 140 | #define UNDEADPRO 62 |
| 141 | #define SHIELD 63 |
| 142 | #define STEALTH 64 |
| 143 | #define ITCHING 65 |
| 144 | #define LAUGHING 66 |
| 145 | #define DRAINSTRENGTH 67 |
| 146 | #define CLUMSINESS 68 |
| 147 | #define INFEEBLEMENT 69 |
| 148 | #define HALFDAM 70 |
| 149 | #define SEEINVISIBLE 71 |
| 150 | #define FILLROOM 72 |
| 151 | #define RANDOMWALK 73 |
| 152 | #define SPHCAST 74 /* nz if an active sphere of annihilation */ |
| 153 | #define WTW 75 /* walk through walls */ |
| 154 | #define STREXTRA 76 /* character strength due to objects or enchantments */ |
| 155 | #define TMP 77 /* misc scratch space */ |
| 156 | #define LIFEPROT 78 /* life protection counter */ |
| 157 | |
| 158 | /* defines for the objects in the game */ |
| 159 | |
| 160 | #define OALTAR 1 |
| 161 | #define OTHRONE 2 |
| 162 | #define OORB 3 |
| 163 | #define OPIT 4 |
| 164 | #define OSTAIRSUP 5 |
| 165 | #define OELEVATORUP 6 |
| 166 | #define OFOUNTAIN 7 |
| 167 | #define OSTATUE 8 |
| 168 | #define OTELEPORTER 9 |
| 169 | #define OSCHOOL 10 |
| 170 | #define OMIRROR 11 |
| 171 | #define ODNDSTORE 12 |
| 172 | #define OSTAIRSDOWN 13 |
| 173 | #define OELEVATORDOWN 14 |
| 174 | #define OBANK2 15 |
| 175 | #define OBANK 16 |
| 176 | #define ODEADFOUNTAIN 17 |
| 177 | #define OMAXGOLD 70 |
| 178 | #define OGOLDPILE 18 |
| 179 | #define OOPENDOOR 19 |
| 180 | #define OCLOSEDDOOR 20 |
| 181 | #define OWALL 21 |
| 182 | #define OTRAPARROW 66 |
| 183 | #define OTRAPARROWIV 67 |
| 184 | |
| 185 | #define OLARNEYE 22 |
| 186 | |
| 187 | #define OPLATE 23 |
| 188 | #define OCHAIN 24 |
| 189 | #define OLEATHER 25 |
| 190 | #define ORING 60 |
| 191 | #define OSTUDLEATHER 61 |
| 192 | #define OSPLINT 62 |
| 193 | #define OPLATEARMOR 63 |
| 194 | #define OSSPLATE 64 |
| 195 | #define OSHIELD 68 |
| 196 | #define OELVENCHAIN 92 |
| 197 | |
| 198 | #define OSWORDofSLASHING 26 |
| 199 | #define OHAMMER 27 |
| 200 | #define OSWORD 28 |
| 201 | #define O2SWORD 29 |
| 202 | #define OSPEAR 30 |
| 203 | #define ODAGGER 31 |
| 204 | #define OBATTLEAXE 57 |
| 205 | #define OLONGSWORD 58 |
| 206 | #define OFLAIL 59 |
| 207 | #define OLANCE 65 |
| 208 | #define OVORPAL 90 |
| 209 | #define OSLAYER 91 |
| 210 | |
| 211 | #define ORINGOFEXTRA 32 |
| 212 | #define OREGENRING 33 |
| 213 | #define OPROTRING 34 |
| 214 | #define OENERGYRING 35 |
| 215 | #define ODEXRING 36 |
| 216 | #define OSTRRING 37 |
| 217 | #define OCLEVERRING 38 |
| 218 | #define ODAMRING 39 |
| 219 | |
| 220 | #define OBELT 40 |
| 221 | |
| 222 | #define OSCROLL 41 |
| 223 | #define OPOTION 42 |
| 224 | #define OBOOK 43 |
| 225 | #define OCHEST 44 |
| 226 | #define OAMULET 45 |
| 227 | |
| 228 | #define OORBOFDRAGON 46 |
| 229 | #define OSPIRITSCARAB 47 |
| 230 | #define OCUBEofUNDEAD 48 |
| 231 | #define ONOTHEFT 49 |
| 232 | |
| 233 | #define ODIAMOND 50 |
| 234 | #define ORUBY 51 |
| 235 | #define OEMERALD 52 |
| 236 | #define OSAPPHIRE 53 |
| 237 | |
| 238 | #define OENTRANCE 54 |
| 239 | #define OVOLDOWN 55 |
| 240 | #define OVOLUP 56 |
| 241 | #define OHOME 69 |
| 242 | |
| 243 | #define OKGOLD 71 |
| 244 | #define ODGOLD 72 |
| 245 | #define OIVDARTRAP 73 |
| 246 | #define ODARTRAP 74 |
| 247 | #define OTRAPDOOR 75 |
| 248 | #define OIVTRAPDOOR 76 |
| 249 | #define OTRADEPOST 77 |
| 250 | #define OIVTELETRAP 78 |
| 251 | #define ODEADTHRONE 79 |
| 252 | #define OANNIHILATION 80 /* sphere of annihilation */ |
| 253 | #define OTHRONE2 81 |
| 254 | #define OLRS 82 /* Larn Revenue Service */ |
| 255 | #define OCOOKIE 83 |
| 256 | #define OURN 84 |
| 257 | #define OBRASSLAMP 85 |
| 258 | #define OHANDofFEAR 86 /* hand of fear */ |
| 259 | #define OSPHTAILSMAN 87 /* tailsman of the sphere */ |
| 260 | #define OWWAND 88 /* wand of wonder */ |
| 261 | #define OPSTAFF 89 /* staff of power */ |
| 262 | /* used up to 92 */ |
| 263 | |
| 264 | /* defines for the monsters as objects */ |
| 265 | |
| 266 | #define BAT 1 |
| 267 | #define GNOME 2 |
| 268 | #define HOBGOBLIN 3 |
| 269 | #define JACKAL 4 |
| 270 | #define KOBOLD 5 |
| 271 | #define ORC 6 |
| 272 | #define SNAKE 7 |
| 273 | #define CENTIPEDE 8 |
| 274 | #define JACULI 9 |
| 275 | #define TROGLODYTE 10 |
| 276 | #define ANT 11 |
| 277 | #define EYE 12 |
| 278 | #define LEPRECHAUN 13 |
| 279 | #define NYMPH 14 |
| 280 | #define QUASIT 15 |
| 281 | #define RUSTMONSTER 16 |
| 282 | #define ZOMBIE 17 |
| 283 | #define ASSASSINBUG 18 |
| 284 | #define BUGBEAR 19 |
| 285 | #define HELLHOUND 20 |
| 286 | #define ICELIZARD 21 |
| 287 | #define CENTAUR 22 |
| 288 | #define TROLL 23 |
| 289 | #define YETI 24 |
| 290 | #define WHITEDRAGON 25 |
| 291 | #define ELF 26 |
| 292 | #define CUBE 27 |
| 293 | #define METAMORPH 28 |
| 294 | #define VORTEX 29 |
| 295 | #define ZILLER 30 |
| 296 | #define VIOLETFUNGI 31 |
| 297 | #define WRAITH 32 |
| 298 | #define FORVALAKA 33 |
| 299 | #define LAMANOBE 34 |
| 300 | #define OSEQUIP 35 |
| 301 | #define ROTHE 36 |
| 302 | #define XORN 37 |
| 303 | #define VAMPIRE 38 |
| 304 | #define INVISIBLESTALKER 39 |
| 305 | #define POLTERGEIST 40 |
| 306 | #define DISENCHANTRESS 41 |
| 307 | #define SHAMBLINGMOUND 42 |
| 308 | #define YELLOWMOLD 43 |
| 309 | #define UMBERHULK 44 |
| 310 | #define GNOMEKING 45 |
| 311 | #define MIMIC 46 |
| 312 | #define WATERLORD 47 |
| 313 | #define BRONZEDRAGON 48 |
| 314 | #define GREENDRAGON 49 |
| 315 | #define PURPLEWORM 50 |
| 316 | #define XVART 51 |
| 317 | #define SPIRITNAGA 52 |
| 318 | #define SILVERDRAGON 53 |
| 319 | #define PLATINUMDRAGON 54 |
| 320 | #define GREENURCHIN 55 |
| 321 | #define REDDRAGON 56 |
| 322 | #define DEMONLORD 57 |
| 323 | #define DEMONPRINCE 64 |
| 324 | |
| 325 | #define BUFBIG 4096 /* size of the output buffer */ |
| 326 | #define MAXIBUF 4096 /* size of the input buffer */ |
| 327 | #define LOGNAMESIZE 40 /* max size of the players name */ |
| 328 | #define PSNAMESIZE 40 /* max size of the process name */ |
| 329 | |
| 330 | #ifndef NODEFS |
| 331 | extern char VERSION, SUBVERSION; |
| 332 | extern char aborted[], alpha[], beenhere[], boldon, cheat, ckpfile[], ckpflag; |
| 333 | extern char *class[], course[], diagfile[], fortfile[], helpfile[]; |
| 334 | extern char *inbuffer, is_alpha[], is_digit[]; |
| 335 | extern char item[MAXX][MAXY], iven[], know[MAXX][MAXY], larnlevels[], lastmonst[]; |
| 336 | extern char level, *levelname[], logfile[], loginname[], logname[], *lpbuf, *lpend; |
| 337 | extern char *lpnt, moved[MAXX][MAXY], mitem[MAXX][MAXY], monstlevel[]; |
| 338 | extern char monstnamelist[], nch[], ndgg[], nlpts[], nomove, nosignal, nowelcome; |
| 339 | extern char nplt[], nsw[], *objectname[]; |
| 340 | extern char objnamelist[], optsfile[], playerids[], potprob[]; |
| 341 | extern char predostuff, psname[], restorflag, savefilename[], scorefile[], scprob[]; |
| 342 | extern char screen[MAXX][MAXY], sex, *spelcode[], *speldescript[]; |
| 343 | extern char spelknow[], *spelname[], *spelmes[], spelweird[MAXMONST + 8][SPNUM]; |
| 344 | extern char splev[], stealth[MAXX][MAXY], to_lower[], to_upper[], wizard; |
| 345 | extern short diroffx[], diroffy[], hitflag, hit2flag, hit3flag, hitp[MAXX][MAXY]; |
| 346 | extern short iarg[MAXX][MAXY], ivenarg[], lasthx, lasthy, lastnum, lastpx, lastpy; |
| 347 | extern short nobeep, oldx, oldy, playerx, playery; |
| 348 | extern int dayplay, enable_scroll, srcount, yrepcount, userid, wisid, |
| 349 | io_outfd, io_infd; |
| 350 | extern time_t initialtime; |
| 351 | extern long outstanding_taxes, skill[], gtime, c[], cbak[]; |
| 352 | extern struct cel *cell; |
| 353 | extern struct monst monster[]; |
| 354 | extern struct sphere *spheres; |
| 355 | extern struct _itm itm_[]; |
| 356 | extern const char *potionhide[], *potionname[], *scrollhide[], *scrollname[]; |
| 357 | |
| 358 | /* bill.c */ |
| 359 | void mailbill(void) __dead2; |
| 360 | |
| 361 | /* create.c */ |
| 362 | void makeplayer(void); |
| 363 | void newcavelevel(int); |
| 364 | void eat(int, int); |
| 365 | int fillmonst(char); |
| 366 | |
| 367 | /* diag.c */ |
| 368 | #ifdef EXTRA |
| 369 | int diag(void); |
| 370 | #endif |
| 371 | int savegame(char *); |
| 372 | void restoregame(char *); |
| 373 | |
| 374 | /* display.c */ |
| 375 | void bottomline(void); |
| 376 | void bottomhp(void); |
| 377 | void bottomspell(void); |
| 378 | void bottomdo(void); |
| 379 | void bot_linex(void); |
| 380 | void bottomgold(void); |
| 381 | void draws(int, int, int, int); |
| 382 | void drawscreen(void); |
| 383 | void showcell(int, int); |
| 384 | void show1cell(int, int); |
| 385 | void showplayer(void); |
| 386 | int moveplayer(int); |
| 387 | void seemagic(int); |
| 388 | |
| 389 | /* fortune.c */ |
| 390 | const char *fortune(void); |
| 391 | |
| 392 | /* global.c */ |
| 393 | void raiselevel(void); |
| 394 | void loselevel(void); |
| 395 | void raiseexperience(long); |
| 396 | void loseexperience(long); |
| 397 | void losehp(int); |
| 398 | void losemhp(int); |
| 399 | void raisehp(int); |
| 400 | void raisemhp(int); |
| 401 | void raisemspells(int); |
| 402 | void losemspells(int); |
| 403 | int makemonst(int); |
| 404 | void positionplayer(void); |
| 405 | void recalc(void); |
| 406 | void quit(void); |
| 407 | void more(void); |
| 408 | int take(int, int); |
| 409 | int drop_object(int); |
| 410 | void enchantarmor(void); |
| 411 | void enchweapon(void); |
| 412 | int pocketfull(void); |
| 413 | int nearbymonst(void); |
| 414 | int stealsomething(void); |
| 415 | int emptyhanded(void); |
| 416 | void creategem(void); |
| 417 | void adjustcvalues(int, int); |
| 418 | int getpassword(void); |
| 419 | int getyn(void); |
| 420 | int packweight(void); |
| 421 | #ifndef MACRORND |
| 422 | int rnd(int); |
| 423 | int rund(int); |
| 424 | #endif |
| 425 | |
| 426 | /* help.c */ |
| 427 | void help(void); |
| 428 | void welcome(void); |
| 429 | |
| 430 | /* io.c */ |
| 431 | void setupvt100(void); |
| 432 | void clearvt100(void); |
| 433 | char getchr(void); |
| 434 | void scbr(void); |
| 435 | void sncbr(void); |
| 436 | void newgame(void); |
| 437 | void lprintf(const char *, ...); |
| 438 | void lprint(long); |
| 439 | void lwrite(char *, int); |
| 440 | long lgetc(void); |
| 441 | long lrint_x(void); |
| 442 | void lrfill(char *, int); |
| 443 | char *lgetw(void); |
| 444 | char *lgetl(void); |
| 445 | int lcreat(char *); |
| 446 | int lopen(char *); |
| 447 | int lappend(char *); |
| 448 | void lrclose(void); |
| 449 | void lwclose(void); |
| 450 | void lprcat(const char *); |
| 451 | void cursor(int, int); |
| 452 | void cursors(void); |
| 453 | #ifndef VT100 |
| 454 | void init_term(void); |
| 455 | #endif |
| 456 | void cl_line(int, int); |
| 457 | void cl_up(int, int); |
| 458 | void cl_dn(int, int); |
| 459 | void standout(const char *); |
| 460 | void set_score_output(void); |
| 461 | void lflush(void); |
| 462 | #ifndef VT100 |
| 463 | char *tmcapcnv(char *, char *); |
| 464 | #endif |
| 465 | void beep(void); |
| 466 | |
| 467 | /* main.c */ |
| 468 | void qshowstr(void); |
| 469 | void show3(int); |
| 470 | void parse2(void); |
| 471 | unsigned long readnum(long); |
| 472 | |
| 473 | /* monster.c */ |
| 474 | void createmonster(int); |
| 475 | void createitem(int, int); |
| 476 | void cast(void); |
| 477 | void godirect(int, int, const char *, int, char); |
| 478 | int vxy(int *, int *); |
| 479 | void hitmonster(int, int); |
| 480 | int hitm(int, int, int); |
| 481 | void hitplayer(int, int); |
| 482 | void dropgold(int); |
| 483 | void something(int); |
| 484 | int newobject(int, int *); |
| 485 | void checkloss(int); |
| 486 | long annihilate(void); |
| 487 | long newsphere(int, int, int, int); |
| 488 | long rmsphere(int, int); |
| 489 | |
| 490 | /* moreobj.c */ |
| 491 | void oaltar(void); |
| 492 | void othrone(int); |
| 493 | void odeadthrone(void); |
| 494 | void ochest(void); |
| 495 | void ofountain(void); |
| 496 | |
| 497 | /* movem.c */ |
| 498 | void movemonst(void); |
| 499 | |
| 500 | /* nap.c */ |
| 501 | void nap(int); |
| 502 | |
| 503 | /* object.c */ |
| 504 | void lookforobject(void); |
| 505 | void oteleport(int); |
| 506 | void quaffpotion(int); |
| 507 | void larn_adjtime(long); |
| 508 | void read_scroll(int); |
| 509 | void readbook(int); |
| 510 | void iopts(void); |
| 511 | void ignore(void); |
| 512 | |
| 513 | /* regen.c */ |
| 514 | void regen(void); |
| 515 | |
| 516 | /* savelev.c */ |
| 517 | void savelevel(void); |
| 518 | void getlevel(void); |
| 519 | |
| 520 | /* scores.c */ |
| 521 | int makeboard(void); |
| 522 | int hashewon(void); |
| 523 | long paytaxes(long); |
| 524 | void showscores(void); |
| 525 | void showallscores(void); |
| 526 | void died(int); |
| 527 | void diedlog(void); |
| 528 | #ifndef UIDSCORE |
| 529 | int getplid(char *); |
| 530 | #endif |
| 531 | |
| 532 | /* signal.c */ |
| 533 | void sigsetup(void); |
| 534 | |
| 535 | /* store.c */ |
| 536 | void dndstore(void); |
| 537 | void oschool(void); |
| 538 | void obank(void); |
| 539 | void obank2(void); |
| 540 | void ointerest(void); |
| 541 | void otradepost(void); |
| 542 | void olrs(void); |
| 543 | |
| 544 | /* tok.c */ |
| 545 | int yylex(void); |
| 546 | void flushall(void); |
| 547 | void sethard(int); |
| 548 | void readopts(void); |
| 549 | |
| 550 | /* macro to create scroll #'s with probability of occurrence */ |
| 551 | #define newscroll() (scprob[rund(81)]) |
| 552 | /* macro to return a potion # created with probability of occurrence */ |
| 553 | #define newpotion() (potprob[rund(41)]) |
| 554 | /* macro to return the + points on created leather armor */ |
| 555 | #define newleather() (nlpts[rund(c[HARDGAME]?13:15)]) |
| 556 | /* macro to return the + points on chain armor */ |
| 557 | #define newchain() (nch[rund(10)]) |
| 558 | /* macro to return + points on plate armor */ |
| 559 | #define newplate() (nplt[rund(c[HARDGAME]?4:12)]) |
| 560 | /* macro to return + points on new daggers */ |
| 561 | #define newdagger() (ndgg[rund(13)]) |
| 562 | /* macro to return + points on new swords */ |
| 563 | #define newsword() (nsw[rund(c[HARDGAME]?6:13)]) |
| 564 | /* macro to destroy object at present location */ |
| 565 | #define forget() (item[playerx][playery]=know[playerx][playery]=0) |
| 566 | /* macro to wipe out a monster at a location */ |
| 567 | #define disappear(x,y) (mitem[x][y]=know[x][y]=0) |
| 568 | |
| 569 | #ifdef VT100 |
| 570 | /* macro to turn on bold display for the terminal */ |
| 571 | #define setbold() (lprcat(boldon?"\33[1m":"\33[7m")) |
| 572 | /* macro to turn off bold display for the terminal */ |
| 573 | #define resetbold() (lprcat("\33[m")) |
| 574 | /* macro to setup the scrolling region for the terminal */ |
| 575 | #define setscroll() (lprcat("\33[20;24r")) |
| 576 | /* macro to clear the scrolling region for the terminal */ |
| 577 | #define resetscroll() (lprcat("\33[;24r")) |
| 578 | /* macro to clear the screen and home the cursor */ |
| 579 | #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50) |
| 580 | #define cltoeoln() lprcat("\33[K") |
| 581 | #else /* VT100 */ |
| 582 | /* defines below are for use in the termcap mode only */ |
| 583 | #define ST_START 1 |
| 584 | #define ST_END 2 |
| 585 | #define BOLD 3 |
| 586 | #define END_BOLD 4 |
| 587 | #define CLEAR 5 |
| 588 | #define CL_LINE 6 |
| 589 | #define CL_DOWN 14 |
| 590 | #define CURSOR 15 |
| 591 | /* macro to turn on bold display for the terminal */ |
| 592 | #define setbold() (*lpnt++ = ST_START) |
| 593 | /* macro to turn off bold display for the terminal */ |
| 594 | #define resetbold() (*lpnt++ = ST_END) |
| 595 | /* macro to setup the scrolling region for the terminal */ |
| 596 | #define setscroll() enable_scroll=1 |
| 597 | /* macro to clear the scrolling region for the terminal */ |
| 598 | #define resetscroll() enable_scroll=0 |
| 599 | /* macro to clear the screen and home the cursor */ |
| 600 | #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50) |
| 601 | /* macro to clear to end of line */ |
| 602 | #define cltoeoln() (*lpnt++ = CL_LINE) |
| 603 | #endif /* VT100 */ |
| 604 | |
| 605 | /* macro to output one byte to the output buffer */ |
| 606 | #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ = (ch))) |
| 607 | |
| 608 | #ifdef MACRORND |
| 609 | extern unsigned long randx; |
| 610 | /* macro to seed the random number generator */ |
| 611 | #define srand(x) (randx=x) |
| 612 | /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */ |
| 613 | #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1) |
| 614 | #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) ) |
| 615 | #endif /* MACRORND */ |
| 616 | /* macros for miscellaneous data conversion */ |
| 617 | #define min(x,y) (((x)>(y))?(y):(x)) |
| 618 | #define max(x,y) (((x)>(y))?(x):(y)) |
| 619 | #define isalpha(x) (is_alpha[x]) |
| 620 | #define isdigit(x) (is_digit[x]) |
| 621 | #define tolower(x) (to_lower[x]) |
| 622 | #define toupper(x) (to_upper[x]) |
| 623 | #define lcc(x) (to_lower[x]) |
| 624 | #define ucc(x) (to_upper[x]) |
| 625 | #endif /* NODEFS */ |