-+-+-+-+-+-+-+-+ START OF PART 16 -+-+-+-+-+-+-+-+ X i_ptr = &inventory`5BINVEN_LIGHT`5D; X i_ptr->p1 += inventory`5Bi`5D.p1; X if (i_ptr->p1 > OBJ_LAMP_MAX) X`09`7B X`09 i_ptr->p1 = OBJ_LAMP_MAX; X`09 msg_print ("Your lamp overflows, spilling oil on the ground."); X`09 msg_print("Your lamp is full."); X`09`7D X else if (i_ptr->p1 > OBJ_LAMP_MAX/2) X`09msg_print ("Your lamp is more than half full."); X else if (i_ptr->p1 == OBJ_LAMP_MAX/2) X`09msg_print ("Your lamp is half full."); X else X`09msg_print ("Your lamp is less than half full."); X desc_remain(i); X inven_destroy(i); X `7D X`7D $ CALL UNPACK DUNGEON.C;1 1077216421 $ create 'f' X/* source/eat.c: food 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#include X#else X#include X#endif X X/* Eat some food.`09`09`09`09`09-RAK-`09*/ Xvoid eat() X`7B X int32u i; X int j, k, item_val, ident; X register struct flags *f_ptr; X register struct misc *m_ptr; X register inven_type *i_ptr; X#ifdef ATARIST_MWC X int32u holder; X#endif 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_FOOD, TV_NEVER, &j, &k)) X msg_print("You are not carrying any food."); X else if (get_item(&item_val, "Eat what?", j, k, CNIL, CNIL)) X `7B X i_ptr = &inventory`5Bitem_val`5D; X free_turn_flag = FALSE; X i = i_ptr->flags; X ident = FALSE; X while (i != 0) X`09`7B X`09 j = bit_pos(&i) + 1; X`09 /* Foods`09`09`09`09`09*/ X`09 switch(j) X`09 `7B X`09 case 1: X`09 f_ptr = &py.flags; X`09 f_ptr->poisoned += randint(10) + i_ptr->level; X`09 ident = TRUE; X`09 break; X`09 case 2: X`09 f_ptr = &py.flags; X`09 f_ptr->blind += randint(250) + 10*i_ptr->level + 100; X`09 draw_cave(); X`09 msg_print("A veil of darkness surrounds you."); X`09 ident = TRUE; X`09 break; X`09 case 3: X`09 f_ptr = &py.flags; X`09 f_ptr->afraid += randint(10) + i_ptr->level; X`09 msg_print("You feel terrified!"); X`09 ident = TRUE; X`09 break; X`09 case 4: X`09 f_ptr = &py.flags; X`09 f_ptr->confused += randint(10) + i_ptr->level; X`09 msg_print("You feel drugged."); X`09 ident = TRUE; X`09 break; X`09 case 5: X`09 f_ptr = &py.flags; X`09 f_ptr->image += randint(200) + 25*i_ptr->level + 200; X`09 msg_print("You feel drugged."); X`09 ident = TRUE; X`09 break; X`09 case 6: X`09 ident = cure_poison(); X`09 break; X`09 case 7: X`09 ident = cure_blindness(); X`09 break; X`09 case 8: X`09 f_ptr = &py.flags; X`09 if (f_ptr->afraid > 1) X`09`09`7B X`09`09 f_ptr->afraid = 1; X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 9: X`09 ident = cure_confusion(); X`09 break; X`09 case 10: X`09 ident = TRUE; X`09 lose_str(); X`09 break; X`09 case 11: X`09 ident = TRUE; X`09 lose_con(); X`09 break; X#if 0 /* 12 through 15 are not used */ X`09 case 12: X`09 ident = TRUE; X`09 lose_int(); X`09 break; X`09 case 13: X`09 ident = TRUE; X`09 lose_wis(); X`09 break; X`09 case 14: X`09 ident = TRUE; X`09 lose_dex(); X`09 break; X`09 case 15: X`09 ident = TRUE; X`09 lose_chr(); X`09 break; X#endif X`09 case 16: X`09 if (res_stat (A_STR)) X`09`09`7B X`09`09 msg_print("You feel your strength returning."); X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 17: X`09 if (res_stat (A_CON)) X`09`09`7B X`09`09 msg_print("You feel your health returning."); X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 18: X`09 if (res_stat (A_INT)) X`09`09`7B X`09`09 msg_print("Your head spins a moment."); X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 19: X`09 if (res_stat (A_WIS)) X`09`09`7B X`09`09 msg_print("You feel your wisdom returning."); X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 20: X`09 if (res_stat (A_DEX)) X`09`09`7B X`09`09 msg_print("You feel more dextrous."); X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 21: X`09 if (res_stat (A_CHR)) X`09`09`7B X`09`09 msg_print("Your skin stops itching."); X`09`09 ident = TRUE; X`09`09`7D X`09 break; X`09 case 22: X`09 ident = hp_player(randint(6)); X`09 break; X`09 case 23: X`09 ident = hp_player(randint(12)); X`09 break; X`09 case 24: X`09 ident = hp_player(randint(18)); X`09 break; X#if 0 /* 25 is not used */ X`09 case 25: X`09 ident = hp_player(damroll(3, 6)); X`09 break; X#endif X`09 case 26: X`09 ident = hp_player(damroll(3, 12)); X`09 break; X`09 case 27: X`09 take_hit(randint(18), "poisonous food."); X`09 ident = TRUE; X`09 break; X#if 0 /* 28 through 30 are not used */ X`09 case 28: X`09 take_hit(randint(8), "poisonous food."); X`09 ident = TRUE; X`09 break; X`09 case 29: X`09 take_hit(damroll(2, 8), "poisonous food."); X`09 ident = TRUE; X`09 break; X`09 case 30: X`09 take_hit(damroll(3, 8), "poisonous food."); X`09 ident = TRUE; X`09 break; X#endif X`09 default: X`09 msg_print("Internal error in eat()"); X`09 break; X`09 `7D X`09 /* End of food actions.`09`09`09`09*/ X`09`7D X if (ident) X`09`7B X`09 if (!known1_p(i_ptr)) X`09 `7B X`09 /* use identified it, gain experience */ X`09 m_ptr = &py.misc; X`09 /* round half-way case up */ X`09 m_ptr->exp += (i_ptr->level + (m_ptr->lev >> 1)) / m_ptr->lev; X`09 prt_experience(); X X`09 identify (&item_val); X`09 i_ptr = &inventory`5Bitem_val`5D; X`09 `7D X`09`7D X else if (!known1_p(i_ptr)) X`09sample (i_ptr); X add_food(i_ptr->p1); X#ifdef ATARIST_MWC X py.flags.status &= `7E(holder = PY_WEAK`7CPY_HUNGRY); X#else X py.flags.status &= `7E(PY_WEAK`7CPY_HUNGRY); X#endif X prt_hunger(); X desc_remain(item_val); X inven_destroy(item_val); X `7D X`7D $ CALL UNPACK EAT.C;1 980318962 $ create 'f' Xwhy does the VMS port need its own versions of the curses functions in Xcbreak.c and getch.c? X Xfiles.c needs two restore_screen() calls to work properly? X Xclear_screen() in shell_out() after return from spawned process does Xnot clear screen properly? X Xif is only included in files.c, and errno is defined in externs.h, Xthen there is a 'psect' problem with errno? X XESCAPE is defined as Control-Z for compatibility with the VMS Moria versions V, Xbut this is not documented anywhere, note the define for ESCAPE in constant. Vh X X! and $ commands are aliases, but this is not documented X Xcurses puts vtxxx keypad into application mode, inkey() has some code Xto convert keypad escape sequences back into numbers, this code may Xcause strange behaviour if someone types a real ESCAPE character, Xwhy does curses put the keypad in application mode in the first place? X Xrefresh() and clear() do not seem to work right, note the contorted code Xin inkey() and clear_screen() to make these work right $ CALL UNPACK ERRORS.;1 1948141744 $ create 'f' X/* source/externs.h: declarations for global variables and initialized data 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/* VMS requires that this be in externs.h, not files.c; this prevents a X 'psect' error for the variable errno */ X#include X X/* Atari TC requires prototypes, but does not have __STDC__. X Hence, we check for ATARIST_TC here, and define LINT_ARGS if true. */ X#ifdef ATARIST_TC X#define LINT_ARGS X#endif X X/* This causes more trouble than it is worth, and very few systems still X have this bug in their include files. */ X#if 0 X/* many systems don't define these anywhere */ X#ifndef NeXT X#ifndef AMIGA X#if !defined(atarist) `7C`7C !defined(__GNUC__) X#ifndef __TURBOC__ X#if defined(USG) `7C`7C defined(DGUX) Xextern int sprintf(); X#else Xextern char *sprintf(); X#endif X#endif X#endif X#endif X#endif X#endif X X/* to avoid 'psect' problem with VMS declaration of errno */ X#ifndef VMS Xextern int errno; X#endif X Xextern char *copyright`5B5`5D; X X/* horrible hack: needed because compact_monster() can be called from deep X within creatures() via place_monster() and summon_monster() */ Xextern int hack_monptr; X Xextern vtype died_from; Xextern vtype savefile;`09`09`09/* The save file. -CJS- */ Xextern int32 birth_date; X X/* These are options, set with set_options command -CJS- */ Xextern int rogue_like_commands; Xextern int find_cut;`09`09`09/* Cut corners on a run */ Xextern int find_examine;`09`09/* Check corners on a run */ Xextern int find_prself;`09`09`09/* Print yourself on a run (slower) */ Xextern int find_bound;`09`09`09/* Stop run when the map shifts */ Xextern int prompt_carry_flag;`09`09/* Prompt to pick something up */ Xextern int show_weight_flag;`09`09/* Display weights in inventory */ Xextern int highlight_seams;`09`09/* Highlight magma and quartz */ Xextern int find_ignore_doors;`09`09/* Run through open doors */ Xextern int sound_beep_flag;`09`09/* Beep for invalid character */ Xextern int display_counts;`09`09/* Display rest/repeat counts */ X X/* global flags */ Xextern int new_level_flag;`09 /* Next level when true */ Xextern int teleport_flag;`09/* Handle teleport traps */ Xextern int eof_flag;`09`09/* Used to handle eof/HANGUP */ Xextern int player_light; /* Player carrying light */ Xextern int find_flag;`09/* Used in MORIA`09 */ Xextern int free_turn_flag;`09/* Used in MORIA`09 */ Xextern int weapon_heavy;`09/* Flag if the weapon too heavy -CJS- */ Xextern int pack_heavy;`09`09/* Flag if the pack too heavy -CJS- */ Xextern char doing_inven;`09/* Track inventory commands */ Xextern int screen_change;`09/* Screen changes (used in inven_commands) */ X Xextern int character_generated;`09 /* don't save score until char gen finish Ved*/ Xextern int character_saved;`09 /* prevents save on kill after save_char() */ X#if defined(STDIO_LOADED) Xextern FILE *highscore_fp;`09/* High score file pointer */ X#endif Xextern int command_count;`09/* Repetition of commands. -CJS- */ Xextern int default_dir;`09`09/* Use last direction in repeated commands */ Xextern int16 noscore;`09`09/* Don't score this game. -CJS- */ Xextern int32u randes_seed; /* For encoding colors */ Xextern int32u town_seed;`09 /* Seed for town genera*/ Xextern int16 dun_level;`09/* Cur dungeon level */ Xextern int16 missile_ctr;`09/* Counter for missiles */ Xextern int msg_flag;`09/* Set with first msg */ Xextern vtype old_msg`5BMAX_SAVE_MSG`5D;`09/* Last messages -CJS- */ Xextern int16 last_msg;`09`09`09/* Where in the array is the last */ Xextern int death;`09/* True if died`09 */ Xextern int32 turn;`09/* Cur trun of game */ Xextern int wizard;`09/* Wizard flag`09 */ Xextern int to_be_wizard; Xextern int16 panic_save; /* this is true if playing from a panic save */ X Xextern int wait_for_more; X Xextern char days`5B7`5D`5B29`5D; Xextern int closing_flag;`09/* Used for closing */ X Xextern int16 cur_height, cur_width;`09/* Cur dungeon size */ X/* Following are calculated from max dungeon sizes`09`09*/ Xextern int16 max_panel_rows, max_panel_cols; Xextern int panel_row, panel_col; Xextern int panel_row_min, panel_row_max; Xextern int panel_col_min, panel_col_max; Xextern int panel_col_prt, panel_row_prt; X X/* Following are all floor definitions`09`09`09`09*/ X#ifdef MAC Xextern cave_type (*cave)`5BMAX_WIDTH`5D; X#else Xextern cave_type cave`5BMAX_HEIGHT`5D`5BMAX_WIDTH`5D; X#endif X X/* Following are player variables`09`09`09`09*/ Xextern player_type py; X#ifdef MACGAME Xextern char *(*player_title)`5BMAX_PLAYER_LEVEL`5D; Xextern race_type *race; Xextern background_type *background; X#else Xextern char *player_title`5BMAX_CLASS`5D`5BMAX_PLAYER_LEVEL`5D; Xextern race_type race`5BMAX_RACES`5D; Xextern background_type background`5BMAX_BACKGROUND`5D; X#endif Xextern int32u player_exp`5BMAX_PLAYER_LEVEL`5D; Xextern int16u player_hp`5BMAX_PLAYER_LEVEL`5D; Xextern int16 char_row; Xextern int16 char_col; X Xextern int8u rgold_adj`5BMAX_RACES`5D`5BMAX_RACES`5D; X Xextern class_type class`5BMAX_CLASS`5D; Xextern int16 class_level_adj`5BMAX_CLASS`5D`5BMAX_LEV_ADJ`5D; X X/* Warriors don't have spells, so there is no entry for them. */ X#ifdef MACGAME Xextern spell_type (*magic_spell)`5B31`5D; X#else Xextern spell_type magic_spell`5BMAX_CLASS-1`5D`5B31`5D; X#endif Xextern char *spell_names`5B62`5D; Xextern int32u spell_learned;`09/* Bit field for spells learnt -CJS- */ Xextern int32u spell_worked;`09/* Bit field for spells tried -CJS- */ Xextern int32u spell_forgotten;`09/* Bit field for spells forgotten -JEW- */ Xextern int8u spell_order`5B32`5D;`09/* remember order that spells are learne Vd in */ Xextern int16u player_init`5BMAX_CLASS`5D`5B5`5D; Xextern int16 total_winner; Xextern int32 max_score; X X/* Following are store definitions`09`09`09`09*/ X#ifdef MACGAME Xextern owner_type *owners; X#else Xextern owner_type owners`5BMAX_OWNERS`5D; X#endif X#ifdef MAC Xextern store_type *store; X#else Xextern store_type store`5BMAX_STORES`5D; X#endif Xextern int16u store_choice`5BMAX_STORES`5D`5BSTORE_CHOICES`5D; X#ifndef MAC Xextern int (*store_buy`5BMAX_STORES`5D)(); X#endif X X/* Following are treasure arrays`09and variables`09`09`09*/ X#ifdef MACGAME Xextern treasure_type *object_list; X#else Xextern treasure_type object_list`5BMAX_OBJECTS`5D; X#endif Xextern int8u object_ident`5BOBJECT_IDENT_SIZE`5D; Xextern int16 t_level`5BMAX_OBJ_LEVEL+1`5D; Xextern inven_type t_list`5BMAX_TALLOC`5D; +-+-+-+-+-+-+-+- END OF PART 16 +-+-+-+-+-+-+-+-