comparison rogue5/armor.c @ 33:f502bf60e6e4

Import Rogue 5.4 from the Roguelike Restoration Project (r1490)
author elwin
date Mon, 24 May 2010 20:10:59 +0000
parents
children
comparison
equal deleted inserted replaced
32:2dcd75e6a736 33:f502bf60e6e4
1 /*
2 * This file contains misc functions for dealing with armor
3 * @(#)armor.c 4.14 (Berkeley) 02/05/99
4 *
5 * Rogue: Exploring the Dungeons of Doom
6 * Copyright (C) 1980-1983, 1985, 1999 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 THING *obj;
23 char *sp;
24
25 if ((obj = get_item("wear", ARMOR)) == NULL)
26 return;
27 if (cur_armor != NULL)
28 {
29 addmsg("you are already wearing some");
30 if (!terse)
31 addmsg(". You'll have to take it off first");
32 endmsg();
33 after = FALSE;
34 return;
35 }
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 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", obj->o_packch, 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 }