Annotation of early-roguelike/rogue4/armor.c, Revision 1.1
1.1 ! rubenllo 1: /*
! 2: * This file contains misc functions for dealing with armor
! 3: * @(#)armor.c 4.8 (Berkeley) 4/6/82
! 4: *
! 5: * Rogue: Exploring the Dungeons of Doom
! 6: * Copyright (C) 1980, 1981, 1982 Michael Toy, Ken Arnold and Glenn Wichman
! 7: * All rights reserved.
! 8: *
! 9: * See the file LICENSE.TXT for full copyright and licensing information.
! 10: */
! 11:
! 12: #include <curses.h>
! 13: #include "rogue.h"
! 14:
! 15: /*
! 16: * wear:
! 17: * The player wants to wear something, so let him/her put it on.
! 18: */
! 19: void
! 20: wear(void)
! 21: {
! 22: register THING *obj;
! 23: register char *sp;
! 24:
! 25: if (cur_armor != NULL)
! 26: {
! 27: addmsg("you are already wearing some");
! 28: if (!terse)
! 29: addmsg(". You'll have to take it off first");
! 30: endmsg();
! 31: after = FALSE;
! 32: return;
! 33: }
! 34: if ((obj = get_item("wear", ARMOR)) == NULL)
! 35: return;
! 36: if (obj->o_type != ARMOR)
! 37: {
! 38: msg("you can't wear that");
! 39: return;
! 40: }
! 41: waste_time();
! 42: obj->o_flags |= ISKNOW;
! 43: sp = inv_name(obj, TRUE);
! 44: cur_armor = obj;
! 45: if (!terse)
! 46: addmsg("you are now ");
! 47: msg("wearing %s", sp);
! 48: }
! 49:
! 50: /*
! 51: * take_off:
! 52: * Get the armor off of the players back
! 53: */
! 54: void
! 55: take_off(void)
! 56: {
! 57: register THING *obj;
! 58:
! 59: if ((obj = cur_armor) == NULL)
! 60: {
! 61: after = FALSE;
! 62: if (terse)
! 63: msg("not wearing armor");
! 64: else
! 65: msg("you aren't wearing any armor");
! 66: return;
! 67: }
! 68: if (!dropcheck(cur_armor))
! 69: return;
! 70: cur_armor = NULL;
! 71: if (terse)
! 72: addmsg("was");
! 73: else
! 74: addmsg("you used to be ");
! 75: msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
! 76: }
! 77:
! 78: /*
! 79: * waste_time:
! 80: * Do nothing but let other things happen
! 81: */
! 82: void
! 83: waste_time(void)
! 84: {
! 85: do_daemons(BEFORE);
! 86: do_fuses(BEFORE);
! 87: do_daemons(AFTER);
! 88: do_fuses(AFTER);
! 89: }
CVSweb