Mercurial > hg > early-roguelike
view arogue5/rogue.c @ 158:2515e03b2f09
arogue7, xrogue: add 'install' targets to Makefiles.
'make install' and 'make uninstall' should now work as expected.
| author | John "Elwin" Edwards |
|---|---|
| date | Thu, 04 Jun 2015 17:08:40 -0400 |
| parents | aac28331e71d |
| children | d3968e9cb98d |
line wrap: on
line source
/* * global variable declaration * * Advanced Rogue * Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T * All rights reserved. * * Based on "Rogue: Exploring the Dungeons of Doom" * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman * All rights reserved. * * See the file LICENSE.TXT for full copyright and licensing information. */ #include <ctype.h> #include "curses.h" #include "rogue.h" /* * Now all the global variables */ struct trap traps[MAXTRAPS]; struct room rooms[MAXROOMS]; /* One for each room -- A level */ struct room *oldrp; /* Roomin(&player.t_oldpos) */ struct thing player; /* The rogue */ struct object *cur_armor; /* What a well dresssed rogue wears */ struct object *cur_ring[NUM_FINGERS]; /* Which rings are being worn */ struct object *cur_misc[NUM_MM]; /* which MM's are in use */ int cur_relic[MAXRELIC]; /* Currently used relics */ struct linked_list *lvl_obj = NULL; struct linked_list *mlist = NULL; struct linked_list *tlist = NULL; /* list of monsters fallen down traps */ struct linked_list *monst_dead = NULL; /* monster killed by monster */ struct object *cur_weapon = NULL; int char_type = -1; /* what type of character is player */ int foodlev = 1; /* how fast he eats food */ int ntraps; /* Number of traps on this level */ int trader = 0; /* no. of purchases */ int curprice = -1; /* current price of item */ int no_move; /* Number of turns held in place */ int seed; /* Random number seed */ int dnum; /* Dungeon number */ int max_level; /* Deepest player has gone ever */ int cur_max; /* Deepest player has gone currently */ int lost_dext; /* amount of lost dexterity */ int mpos = 0; int no_command = 0; int level = 1; int purse = 0; int inpack = 0; int total = 0; int no_food = 0; /* how long has he gone with no food */ int foods_this_level = 0; /* foods made per level */ int count = 0; int food_left = HUNGERTIME; int group = 1; int hungry_state = F_OKAY; int infest_dam=0; int lost_str=0; int lastscore = -1; int hold_count = 0; int trap_tries = 0; int pray_time = 0; int spell_power = 0; int turns = 0; /* Number of turns player has taken */ int quest_item = 0; /* Item player is looking for */ int scorefd = -1; /* File descriptor for the scorefile */ char nfloors = -1; /* Number of floors in this dungeon */ char curpurch[LINELEN*2]; /* name of item ready to buy */ char PLAYER = VPLAYER; /* what the player looks like */ char take; /* Thing the rogue is taking */ char prbuf[LINELEN*2]; /* Buffer for sprintfs */ char outbuf[BUFSIZ]; /* Output buffer for stdout */ char runch; /* Direction player is running */ char *s_names[MAXSCROLLS]; /* Names of the scrolls */ char *p_colors[MAXPOTIONS]; /* Colors of the potions */ char *r_stones[MAXRINGS]; /* Stone settings of the rings */ char *ws_made[MAXSTICKS]; /* What sticks are made of */ char whoami[LINELEN]; /* Name of player */ char fruit[LINELEN]; /* Favorite fruit */ char huh[LINELEN]; /* The last message printed */ char *s_guess[MAXSCROLLS]; /* Players guess at what scroll is */ char *p_guess[MAXPOTIONS]; /* Players guess at what potion is */ char *r_guess[MAXRINGS]; /* Players guess at what ring is */ char *ws_guess[MAXSTICKS]; /* Players guess at what wand is */ char *m_guess[MAXMM]; /* Players guess at what MM is */ char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */ char file_name[256]; /* Save file name */ char score_file[LINELEN]; /* Score file name */ char home[LINELEN]; /* User's home directory */ WINDOW *cw; /* Window that the player sees */ WINDOW *hw; /* Used for the help command */ WINDOW *mw; /* Used to store mosnters */ WINDOW *msgw; /* Used to display messages */ bool pool_teleport = FALSE; /* just teleported from a pool */ bool inwhgt = FALSE; /* true if from wghtchk() */ bool after; /* True if we want after daemons */ bool waswizard; /* Was a wizard sometime */ bool s_know[MAXSCROLLS]; /* Does he know what a scroll does */ bool p_know[MAXPOTIONS]; /* Does he know what a potion does */ bool r_know[MAXRINGS]; /* Does he know what a ring does */ bool ws_know[MAXSTICKS]; /* Does he know what a stick does */ bool m_know[MAXMM]; /* Does he know what a MM does */ bool playing = TRUE; bool running = FALSE; bool wizard = FALSE; bool notify = TRUE; bool fight_flush = FALSE; bool terse = FALSE; bool auto_pickup = TRUE; bool door_stop = FALSE; bool jump = FALSE; bool slow_invent = FALSE; bool firstmove = FALSE; bool askme = TRUE; bool in_shell = FALSE; bool daytime = TRUE; bool use_savedir = FALSE; coord delta; /* Change indicated to get_dir() */ LEVTYPE levtype; /* type of level i'm on */ char *nothing = "Nothing seems to happen."; char *spacemsg = "--Press space to continue--"; char *morestr = "-- More --"; char *retstr = "[Press return to continue]"; FILE *logfile = NULL; /* * NOTE: the ordering of the points in this array is critical. They MUST * be listed in the following sequence: * * 7 4 6 * 1 0 2 * 5 3 8 */ coord grid[9] = {{0,0}, { 0,-1}, { 0, 1}, {-1, 0}, { 1, 0}, {-1,-1}, { 1, 1}, { 1,-1}, {-1, 1} }; struct death_type deaths[DEATHNUM] = { { D_ARROW, "an arrow"}, { D_DART, "a dart"}, { D_BOLT, "a bolt"}, { D_POISON, "poison"}, { D_POTION, "a cursed potion"}, { D_PETRIFY, "petrification"}, { D_SUFFOCATION, "suffocation"}, { D_INFESTATION, "a parasite"}, { D_DROWN, "drowning"}, { D_ROT, "body rot"}, { D_CONSTITUTION, "poor health"}, { D_STRENGTH, "being too weak"}, { D_SIGNAL, "a bug"}, { D_CHOKE, "dust of choking"}, { D_STRANGLE, "strangulation"}, { D_FALL, "a fall"}, { D_RELIC, "an artifact's wrath"}, }; /* * weapons and their attributes */ struct init_weps weaps[MAXWEAPONS] = { { "mace", "2d4", "1d3", NONE, ISMETAL, 100, 8 }, { "long sword", "1d12", "1d2", NONE, ISMETAL, 60, 18 }, { "short bow", "1d1", "1d1", NONE, 0, 40, 15 }, { "arrow", "1d1", "1d6", BOW, ISMANY|ISMISL, 5, 1 }, { "dagger", "1d6", "1d4", NONE, ISMETAL|ISMISL|ISMANY, 10, 2 }, { "rock", "1d2", "1d4", SLING, ISMANY|ISMISL, 5, 1 }, { "two-handed sword","3d6", "1d2", NONE, ISMETAL, 250, 40 }, { "sling", "0d0", "0d0", NONE, 0, 5, 1 }, { "dart", "1d1", "1d3", NONE, ISMANY|ISMISL, 5, 1 }, { "crossbow", "1d1", "1d1", NONE, 0, 100, 15 }, { "crossbow bolt", "1d2", "1d12", CROSSBOW, ISMANY|ISMISL, 7, 1 }, { "spear", "1d6", "1d8", NONE, ISMETAL|ISMISL, 50, 8 }, { "trident", "3d4", "1d4", NONE, ISMETAL, 50, 20 }, { "spetum", "2d6", "1d3", NONE, ISMETAL, 50, 20 }, { "bardiche", "3d4", "1d2", NONE, ISMETAL, 125, 20 }, { "pike", "1d12", "1d8", NONE, ISMETAL, 80, 18 }, { "bastard sword", "2d8", "1d2", NONE, ISMETAL, 100, 30 }, { "halberd", "2d6", "1d3", NONE, ISMETAL, 175, 10 }, { "battle axe", "1d8", "1d3", NONE, ISMETAL, 80, 10 }, }; struct init_armor armors[MAXARMORS] = { { "leather armor", 11, 8, 70, 100 }, { "ring mail", 22, 7, 50, 250 }, { "studded leather armor", 33, 7, 50, 200 }, { "scale mail", 45, 6, 70, 250 }, { "padded armor", 57, 6, 150, 150 }, { "chain mail", 69, 5, 100, 300 }, { "splint mail", 80, 4, 150, 350 }, { "banded mail", 90, 4, 150, 350 }, { "plate mail", 96, 3, 400, 400 }, { "plate armor", 100, 2, 650, 450 }, }; struct magic_item things[NUMTHINGS] = { { "potion", 260, 10 }, /* potion */ { "scroll", 260, 30 }, /* scroll */ { "food", 180, 20 }, /* food */ { "weapon", 80, 0 }, /* weapon */ { "armor", 80, 0 }, /* armor */ { "ring", 50, 5 }, /* ring */ { "stick", 60, 0 }, /* stick */ { "miscellaneous magic", 30, 50 }, /* miscellaneous magic */ { "artifact", 0, 10 }, /* artifact */ }; struct magic_item s_magic[MAXSCROLLS] = { { "monster confusion", 60, 125, 0, 0 }, { "magic mapping", 50, 150, 0, 0 }, { "light", 80, 100, 21, 15 }, { "hold monster", 30, 200, 33, 20 }, { "sleep", 30, 150, 20, 0 }, { "enchantment", 180, 200, 9, 9 }, { "identify", 200, 100, 0, 25 }, { "scare monster", 40, 250, 27, 21 }, { "gold detection", 30, 110, 0, 0 }, { "teleportation", 60, 165, 10, 20 }, { "create monster", 30, 75, 0, 0 }, { "remove curse", 70, 120, 9, 15 }, { "petrification", 10, 185, 0, 0 }, { "genocide", 10, 300, 0, 0 }, { "cure disease", 80, 160, 0, 0 }, { "acquirement", 10, 400, 0, 0 }, { "protection", 30, 190, 20, 0 }, }; struct magic_item p_magic[MAXPOTIONS] = { { "clear thought", 60, 180, 27, 10 }, { "gain ability", 160, 210, 15, 15 }, { "see invisible", 60, 150, 25, 15 }, { "healing", 170, 130, 27, 27 }, { "monster detection", 60, 120, 0, 0 }, { "magic detection", 60, 105, 0, 0 }, { "raise level", 20, 350, 11, 10 }, { "haste self", 100, 180, 30, 5 }, { "restore abilities", 160, 140, 0, 0 }, { "phasing", 50, 210, 21, 20 }, { "invisibility", 50, 230, 0, 15 }, { "flying", 50, 130, 0, 20 }, }; struct magic_item r_magic[MAXRINGS] = { { "protection", 50, 200, 33, 25 }, { "add strength", 60, 200, 33, 25 }, { "sustain ability", 50, 500, 0, 0 }, { "searching", 60, 400, 0, 0 }, { "extra sight", 40, 350, 0, 0 }, { "alertness", 40, 380, 0, 0 }, { "aggravate monster", 30, 100, 100, 0 }, { "dexterity", 60, 220, 33, 25 }, { "increase damage", 60, 220, 33, 25 }, { "regeneration", 40, 600, 0, 0 }, { "slow digestion", 40, 240, 15, 15 }, { "teleportation", 20, 100, 100, 0 }, { "stealth", 40, 300, 0, 0 }, { "add intelligence", 60, 240, 33, 25 }, { "increase wisdom", 60, 220, 33, 25 }, { "sustain health", 80, 500, 0, 0 }, { "burden", 20, 100, 100, 0 }, { "illumination", 30, 520, 0, 0 }, { "delusion", 20, 100, 75, 0 }, { "fear", 20, 100, 100, 0}, { "heroism", 30, 390, 0, 0 }, { "fire resistance", 40, 400, 0, 0 }, { "warmth", 40, 400, 0, 0 }, { "vampiric regeneration", 10,1000, 0, 0}, }; struct magic_item ws_magic[MAXSTICKS] = { { "light", 90, 120, 20, 20 }, { "striking", 60, 115, 0, 0 }, { "lightning", 35, 200, 0, 0 }, { "fire", 35, 200, 0, 0 }, { "cold", 35, 200, 0, 0 }, { "polymorph", 80, 150, 0, 0 }, { "magic missile", 80, 170, 0, 0 }, { "slow monster", 80, 220, 25, 20 }, { "drain life", 90, 210, 20, 0 }, { "charging", 80, 400, 0, 0 }, { "teleport monster", 90, 140, 25, 20 }, { "cancellation", 40, 130, 0, 0 }, { "confuse monster", 35, 100, 15, 0}, { "disintegration", 10, 300, 33, 0}, { "petrification", 10, 300, 0, 0}, { "paralyze monster", 30, 180, 15, 0}, { "degenerate monster", 30, 250, 30, 0}, { "curing", 10, 250, 25, 0}, { "wonder", 50, 110, 0, 0}, { "fear", 30, 180, 0, 0}, }; /* * WARNING: unique miscellaneous magic items must be put at the end * of this list. They MUST be the last items. The function * create_obj() in wizard.c depends on it. */ struct magic_item m_magic[MAXMM] = { { "alchemy jug", 40, 240, 0, 0}, { "beaker of potions", 60, 300, 0, 0}, { "book of spells", 60, 300, 0, 0}, { "boots of elvenkind", 50, 500, 0, 0}, { "bracers of defense", 140, 100, 15, 0}, { "chime of opening", 50, 250, 0, 0}, { "chime of hunger", 50, 100,100, 0}, { "cloak of displacement", 60, 500, 0, 0}, { "cloak of protection", 70, 200, 15, 0}, { "drums of panic", 40, 350, 0, 0}, { "dust of disappearance", 40, 300, 0, 0}, { "dust of choking", 30, 100,100, 0}, { "gauntlets of dexterity", 30, 600, 25, 0}, { "gauntlets of ogre power", 30, 600, 25, 0}, { "jewel of attacks", 40, 150,100, 0}, { "keoghtoms ointment", 50, 200, 0, 0}, { "robe of powerlessness", 30, 100,100, 0}, { "gauntlets of fumbling", 30, 100,100, 0}, { "necklace of adaptation", 20, 500, 0, 0}, { "necklace of strangulation",30, 110,100, 0}, { "boots of dancing", 30, 120,100, 0}, { "book of skills", 20, 650, 0, 0}, };
