$PART76: $ CALL UNPACK TYPES.H;1 862642583 $ create 'f' X/* vms/uexit.c: special exit command, to exit cleanly from VMS program. X X Copyright (c) 1990-92 Joshua Delahunty, James E. Wilson X X This software may be copied and distributed for educational, research, an Vd X not for profit purposes provided that this copyright and statement are X included in all such copies. */ X X/*`09Unix programs usually return 0 for "good execution", X`09and 1 for "some problem occured." In VMS, we WANT the X`09program to return a 1, or else we get an ugly X`09"%NONAME-W-NOMSG, Message number 00000000" X`09message upon image exit (yeech!). X X`09So, we convert 0 exit codes to 1's, leaving all others alone. */ X Xvoid uexit(exitcode) Xint exitcode; X`7B X`09if (exitcode == 0)`09/* On Unix, clean, on VMS, yeech! */ X`09`09exit(1);`09/* converted... */ X`09else X`09`09exit(exitcode); /* returned unscathed... */ X`7D $ CALL UNPACK UEXIT.C;1 1510492784 $ create 'f' X/* source/variable.c: Global variables */ X Xchar *copyright`5B5`5D = `7B X"Copyright (c) 1989-92 James E. Wilson, Robert A. Keoneke", X"", X"This software may be copied and distributed for educational, research, and" V, X"not for profit purposes provided that this copyright and statement are", X"included in all such copies."`7D; X X#include X X#include "config.h" X#include "constant.h" X#include "types.h" X X/* Save the store's last increment value. */ Xint16 last_store_inc; X X/* a horrible hack: needed because compact_monster() can be called from X creatures() via summon_monster() and place_monster() */ Xint hack_monptr = -1; X Xint weapon_heavy = FALSE; Xint pack_heavy = FALSE; Xvtype died_from; Xint32 birth_date; X Xvtype savefile;`09`09`09/* The savefile to use. */ X Xint16 total_winner = FALSE; Xint32 max_score = 0; Xint character_generated = 0;`09/* don't save score until char gen finished * V/ Xint character_saved = 0;`09/* prevents save on kill after save_char() */ XFILE *highscore_fp;`09`09/* File pointer to high score file */ Xint32u randes_seed;`09`09/* for restarting randes_state */ Xint32u town_seed;`09`09/* for restarting town_seed */ Xint16 cur_height,cur_width;`09/* Cur dungeon size */ Xint16 dun_level = 0;`09`09/* Cur dungeon level */ Xint16 missile_ctr = 0;`09`09/* Counter for missiles */ Xint msg_flag;`09`09`09/* Set with first msg */ Xvtype old_msg`5BMAX_SAVE_MSG`5D;`09/* Last message`09 */ Xint16 last_msg = 0;`09`09/* Where last is held */ Xint death = FALSE;`09`09/* True if died`09 */ Xint find_flag;`09`09`09/* Used in MORIA for .(dir) */ Xint free_turn_flag;`09`09/* Used in MORIA, do not move creatures */ Xint command_count;`09`09/* Gives repetition of commands. -CJS- */ Xint default_dir = FALSE;`09/* Use last direction for repeated command */ Xint32 turn = -1;`09`09/* Cur turn of game */ Xint wizard = FALSE;`09`09/* Wizard flag`09 */ Xint to_be_wizard = FALSE;`09/* used during startup, when -w option used */ Xint16 panic_save = FALSE;`09/* this is true if playing from a panic save */ Xint16 noscore = FALSE;`09`09/* Don't log the game. -CJS- */ X Xint rogue_like_commands;`09/* set in config.h/main.c */ X X/* options set via the '=' command */ Xint find_cut = TRUE; Xint find_examine = TRUE; Xint find_bound = FALSE; Xint find_prself = FALSE; Xint prompt_carry_flag = FALSE; Xint show_weight_flag = FALSE; Xint highlight_seams = FALSE; Xint find_ignore_doors = FALSE; Xint sound_beep_flag = TRUE; Xint display_counts = TRUE; X Xchar doing_inven = FALSE;`09/* Track inventory commands. -CJS- */ Xint screen_change = FALSE;`09/* Track screen updates for inven_commands. */ Xchar last_command = ' '; `09/* Memory of previous command. */ X X/* these used to be in dungeon.c */ Xint new_level_flag;`09`09/* Next level when true`09 */ Xint teleport_flag;`09`09/* Handle teleport traps */ Xint player_light;`09`09/* Player carrying light */ Xint eof_flag = FALSE;`09`09/* Used to signal EOF/HANGUP condition */ Xint light_flag = FALSE;`09`09/* Track if temporary light about player. */ X Xint wait_for_more = FALSE;`09/* used when `5EC hit during -more- prompt */ Xint closing_flag = FALSE;`09/* Used for closing */ X X/* Following are calculated from max dungeon sizes`09`09*/ Xint16 max_panel_rows,max_panel_cols; Xint panel_row,panel_col; Xint panel_row_min,panel_row_max; Xint panel_col_min,panel_col_max; Xint panel_col_prt,panel_row_prt; X X#ifdef MAC Xcave_type (*cave)`5BMAX_WIDTH`5D; X#else Xcave_type cave`5BMAX_HEIGHT`5D`5BMAX_WIDTH`5D; X#endif X X#ifdef MAC Xrecall_type *c_recall; X#else Xrecall_type c_recall`5BMAX_CREATURES`5D;`09/* Monster memories */ X#endif X X/* See atarist/st-stuff.c */ X#if defined(atarist) && defined(__GNUC__) Xchar extended_file_name`5B80`5D; X#endif $ CALL UNPACK VARIABLE.C;1 302013379 $ create 'f' X VMS Moria Version 4.8 XVersion 0.1 : 03/25/83 XVersion 1.0 : 05/01/84 XVersion 2.0 : 07/10/84 XVersion 3.0 : 11/20/84 XVersion 4.0 : 01/20/85 X XModules : X V1.0 Dungeon Generator - RAK X Character Generator - RAK & JWT X Moria Module - RAK X Miscellaneous - RAK & JWT X V2.0 Town Level & Misc - RAK X V3.0 Internal Help & Misc - RAK X V4.0 Source Release Version - RAK X XRobert Alan Koeneke Jimmey Wayne Todd Jr. XStudent/University of Oklahoma Student/University of Oklahoma X X X X X X Umoria Version 5.5 (formerly UNIX Moria) XVersion 4.83 : 5/14/87 XVersion 4.85 : 10/26/87 XVersion 4.87 : 5/27/88 XVersion 5.0 : 11/2/89 XVersion 5.2 : 5/9/90 XVersion 5.3 : 3/25/91 XVersion 5.4 : 10/12/91 XVersion 5.5 : 8/12/92 X XDavid J. Grabiner, Harvard University X`09`09 grabiner@math.harvard.edu XJames E. Wilson, Cygnus Support X`09`09 wilson@kithrup.com X XOther contributors: XD. G. Kneller - MSDOS Moria port, reduced map display, 16 bit intege Vrs XChristopher J. Stuart - recall, options, inventory, running code, etc. XCurtis McCauley - Macintosh Moria port for MPW C XStephen A. Jacobs - Atari ST Moria port for MW C X X X XOther contributors: XWilliam Setzer - object naming code XDavid J. Grabiner - numerous bug reports, consistency checks, etc XDan Bernstein - UNIX hangup signal fix, many bug fixes XCorey Gehman - Amiga Moria port XRalph Waters - VMS support code, IBM-PC Turbo C bug fixes XJohsua Delahunty - VMS support code XTodd Pierzina - VMS support code XJoseph Hall - line of sight code, monster compiler XEric Vaitl - PC-Curses replacement for Turbo C XScott Kolodzieski - Atari ST port for Gnu C XHildo Biersma - Atari ST port for Turbo C XBen Schreiber - Macintosh port for Think C X X X X X XCopyright (c) 1989-92 James E. Wilson, Robert A. Keoneke X This software may be copied and distributed for educational, research, and X not for profit purposes provided that this copyright and statement are X included in all such copies. X XUmoria Version 5.5, patch level 0 $ CALL UNPACK VERSION.HLP;1 1897136397 $ create 'f' X/* source/wands.c: wand code X X Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke X X This software may be copied and distributed for educational, research, an Vd X not for profit purposes provided that this copyright and statement are X included in all such copies. */ X X#include "config.h" X#include "constant.h" X#include "types.h" X#include "externs.h" X X#ifdef USG X#ifndef ATARIST_MWC X#include X#endif X#else X#include X#endif X X/* Wands for the aiming.`09`09`09`09*/ Xvoid aim() X`7B X int32u i; X register int l, ident; X int item_val, j, k, chance, dir; X register inven_type *i_ptr; X register struct misc *m_ptr; X X free_turn_flag = TRUE; X if (inven_ctr == 0) X msg_print("But you are not carrying anything."); X else if (!find_range(TV_WAND, TV_NEVER, &j, &k)) X msg_print("You are not carrying any wands."); X else if (get_item(&item_val, "Aim which wand?", j, k, CNIL, CNIL)) X `7B X i_ptr = &inventory`5Bitem_val`5D; X free_turn_flag = FALSE; X if (get_dir(CNIL, &dir)) X`09`7B X`09 if (py.flags.confused > 0) X`09 `7B X`09 msg_print("You are confused."); X`09 do X`09`09`7B X`09`09 dir = randint(9); X`09`09`7D X`09 while (dir == 5); X`09 `7D X`09 ident = FALSE; X`09 m_ptr = &py.misc; X`09 chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level X`09 + (class_level_adj`5Bm_ptr->pclass`5D`5BCLA_DEVICE`5D * m_ptr->lev / V 3); X`09 if (py.flags.confused > 0) X`09 chance = chance / 2; X`09 if ((chance < USE_DEVICE) && (randint(USE_DEVICE - chance + 1) == 1)) X`09 chance = USE_DEVICE; /* Give everyone a slight chance */ X`09 if (chance <= 0) chance = 1; X`09 if (randint(chance) < USE_DEVICE) X`09 msg_print("You failed to use the wand properly."); X`09 else if (i_ptr->p1 > 0) X`09 `7B X`09 i = i_ptr->flags; X`09 (i_ptr->p1)--; X`09 while (i != 0) X`09`09`7B X`09`09 j = bit_pos(&i) + 1; X`09`09 k = char_row; X`09`09 l = char_col; X`09`09 /* Wands`09`09`09 */ X`09`09 switch(j) X`09`09 `7B X`09`09 case 1: X`09`09 msg_print("A line of blue shimmering light appears."); X`09`09 light_line(dir, char_row, char_col); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 2: X`09`09 fire_bolt(GF_LIGHTNING, dir, k, l, damroll(4, 8), X`09`09`09`09spell_names`5B8`5D); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 3: X`09`09 fire_bolt(GF_FROST, dir, k, l, damroll(6, 8), X`09`09`09`09spell_names`5B14`5D); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 4: X`09`09 fire_bolt(GF_FIRE, dir, k, l, damroll(9, 8), X`09`09`09`09spell_names`5B22`5D); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 5: X`09`09 ident = wall_to_mud(dir, k, l); X`09`09 break; X`09`09 case 6: X`09`09 ident = poly_monster(dir, k, l); X`09`09 break; X`09`09 case 7: X`09`09 ident = hp_monster(dir, k, l, -damroll(4, 6)); X`09`09 break; X`09`09 case 8: X`09`09 ident = speed_monster(dir, k, l, 1); X`09`09 break; X`09`09 case 9: X`09`09 ident = speed_monster(dir, k, l, -1); X`09`09 break; X`09`09 case 10: X`09`09 ident = confuse_monster(dir, k, l); X`09`09 break; X`09`09 case 11: X`09`09 ident = sleep_monster(dir, k, l); X`09`09 break; X`09`09 case 12: X`09`09 ident = drain_life(dir, k, l); X`09`09 break; X`09`09 case 13: X`09`09 ident = td_destroy2(dir, k, l); X`09`09 break; X`09`09 case 14: X`09`09 fire_bolt(GF_MAGIC_MISSILE, dir, k, l, damroll(2, 6), X`09`09`09`09spell_names`5B0`5D); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 15: X`09`09 ident = build_wall(dir, k, l); X`09`09 break; X`09`09 case 16: X`09`09 ident = clone_monster(dir, k, l); X`09`09 break; X`09`09 case 17: X`09`09 ident = teleport_monster(dir, k, l); X`09`09 break; X`09`09 case 18: X`09`09 ident = disarm_all(dir, k, l); X`09`09 break; X`09`09 case 19: X`09`09 fire_ball(GF_LIGHTNING, dir, k, l, 32, "Lightning Ball"); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 20: X`09`09 fire_ball(GF_FROST, dir, k, l, 48, "Cold Ball"); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 21: X`09`09 fire_ball(GF_FIRE, dir, k, l, 72, spell_names`5B28`5D); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 22: X`09`09 fire_ball(GF_POISON_GAS, dir, k, l, 12, spell_names`5B6`5D); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 23: X`09`09 fire_ball(GF_ACID, dir, k, l, 60, "Acid Ball"); X`09`09 ident = TRUE; X`09`09 break; X`09`09 case 24: X`09`09 i = 1L << (randint(23) - 1); X`09`09 break; X`09`09 default: X`09`09 msg_print("Internal error in wands()"); X`09`09 break; X`09`09 `7D X`09`09 /* End of Wands.`09`09 */ X`09`09`7D X`09 if (ident) X`09`09`7B X`09`09 if (!known1_p(i_ptr)) X`09`09 `7B X`09`09 m_ptr = &py.misc; X`09`09 /* round half-way case up */ X`09`09 m_ptr->exp += (i_ptr->level +(m_ptr->lev >> 1)) / X`09`09`09m_ptr->lev; X`09`09 prt_experience(); X X`09`09 identify(&item_val); X`09`09 i_ptr = &inventory`5Bitem_val`5D; X`09`09 `7D X`09`09`7D X`09 else if (!known1_p(i_ptr)) X`09`09sample (i_ptr); X`09 desc_charges(item_val); X`09 `7D X`09 else X`09 `7B X`09 msg_print("The wand has no charges left."); X`09 if (!known2_p(i_ptr)) X`09`09add_inscribe(i_ptr, ID_EMPTY); X`09 `7D X`09`7D X `7D X`7D $ CALL UNPACK WANDS.C;1 741481534 $ create 'f' X Welcome to Moria! X XYour first task is to generate a character. You must specify a sex, Xa race and a class. Anytime before you have made these specifications, Xyou can interrupt with control-C. You can also specify the race as Xoften as you like by entering '%' to the class request. This will also Xregenerate your attributes. X XIf this is your first time playing, you may want to read the manual first. $ CALL UNPACK WELCOME.HLP;1 1514761176 $ create 'f' X/* source/wizard.c: Version history and info, and wizard mode debugging aids V. X X Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke X X This software may be copied and distributed for educational, research, an Vd X not for profit purposes provided that this copyright and statement are X included in all such copies. */ X X#ifdef __TURBOC__ X#include`09 X#include`09 X#endif /* __TURBOC__ */ X`20 X#include "config.h" X#include "constant.h" X#include "types.h" X#include "externs.h" X X#ifdef USG X#ifndef ATARIST_MWC X#include X#endif X#else X#include X#endif X X#ifdef ATARIST_TC X/* Include this to get prototypes for standard library functions. */ X#include X#endif X Xlong atol(); X X/* Light up the dungeon`09`09`09`09`09-RAK-`09*/ Xvoid wizard_light() X`7B X register cave_type *c_ptr; X register int k, l, i, j; X int flag; X X if (cave`5Bchar_row`5D`5Bchar_col`5D.pl) X flag = FALSE; X else X flag = TRUE; X for (i = 0; i < cur_height; i++) +-+-+-+-+-+-+-+- END OF PART 76 +-+-+-+-+-+-+-+-