diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rogue4/armor.c	Sat Oct 24 16:52:52 2009 +0000
@@ -0,0 +1,86 @@
+/*
+ * This file contains misc functions for dealing with armor
+ * @(#)armor.c	4.8 (Berkeley) 4/6/82
+ *
+ * Rogue: Exploring the Dungeons of Doom
+ * Copyright (C) 1980, 1981, 1982 Michael Toy, Ken Arnold and Glenn Wichman
+ * All rights reserved.
+ *
+ * See the file LICENSE.TXT for full copyright and licensing information.
+ */
+
+#include <curses.h>
+#include "rogue.h"
+
+/*
+ * wear:
+ *	The player wants to wear something, so let him/her put it on.
+ */
+wear()
+{
+    register THING *obj;
+    register char *sp;
+
+    if (cur_armor != NULL)
+    {
+	addmsg("you are already wearing some");
+	if (!terse)
+	    addmsg(".  You'll have to take it off first");
+	endmsg();
+	after = FALSE;
+	return;
+    }
+    if ((obj = get_item("wear", ARMOR)) == NULL)
+	return;
+    if (obj->o_type != ARMOR)
+    {
+	msg("you can't wear that");
+	return;
+    }
+    waste_time();
+    obj->o_flags |= ISKNOW;
+    sp = inv_name(obj, TRUE);
+    cur_armor = obj;
+    if (!terse)
+	addmsg("you are now ");
+    msg("wearing %s", sp);
+}
+
+/*
+ * take_off:
+ *	Get the armor off of the players back
+ */
+take_off()
+{
+    register THING *obj;
+
+    if ((obj = cur_armor) == NULL)
+    {
+	after = FALSE;
+	if (terse)
+		msg("not wearing armor");
+	else
+		msg("you aren't wearing any armor");
+	return;
+    }
+    if (!dropcheck(cur_armor))
+	return;
+    cur_armor = NULL;
+    if (terse)
+	addmsg("was");
+    else
+	addmsg("you used to be ");
+    msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
+}
+
+/*
+ * waste_time:
+ *	Do nothing but let other things happen
+ */
+waste_time()
+{
+    do_daemons(BEFORE);
+    do_fuses(BEFORE);
+    do_daemons(AFTER);
+    do_fuses(AFTER);
+}