comparison rogue4/armor.c @ 12:9535a08ddc39

Import Rogue 5.2 from the Roguelike Restoration Project (r1490)
author edwarj4
date Sat, 24 Oct 2009 16:52:52 +0000
parents
children 1b73a8641b37
comparison
equal deleted inserted replaced
11:949d558c2162 12:9535a08ddc39
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 wear()
20 {
21 register THING *obj;
22 register char *sp;
23
24 if (cur_armor != NULL)
25 {
26 addmsg("you are already wearing some");
27 if (!terse)
28 addmsg(". You'll have to take it off first");
29 endmsg();
30 after = FALSE;
31 return;
32 }
33 if ((obj = get_item("wear", ARMOR)) == NULL)
34 return;
35 if (obj->o_type != ARMOR)
36 {
37 msg("you can't wear that");
38 return;
39 }
40 waste_time();
41 obj->o_flags |= ISKNOW;
42 sp = inv_name(obj, TRUE);
43 cur_armor = obj;
44 if (!terse)
45 addmsg("you are now ");
46 msg("wearing %s", sp);
47 }
48
49 /*
50 * take_off:
51 * Get the armor off of the players back
52 */
53 take_off()
54 {
55 register THING *obj;
56
57 if ((obj = cur_armor) == NULL)
58 {
59 after = FALSE;
60 if (terse)
61 msg("not wearing armor");
62 else
63 msg("you aren't wearing any armor");
64 return;
65 }
66 if (!dropcheck(cur_armor))
67 return;
68 cur_armor = NULL;
69 if (terse)
70 addmsg("was");
71 else
72 addmsg("you used to be ");
73 msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
74 }
75
76 /*
77 * waste_time:
78 * Do nothing but let other things happen
79 */
80 waste_time()
81 {
82 do_daemons(BEFORE);
83 do_fuses(BEFORE);
84 do_daemons(AFTER);
85 do_fuses(AFTER);
86 }