+/* $NetBSD: object.c,v 1.9 2003/08/07 09:37:39 agc Exp $ */
+
/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Timothy C. Stoehr.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)object.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: object.c,v 1.2 1993/08/01 18:52:21 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: object.c,v 1.9 2003/08/07 09:37:39 agc Exp $");
+#endif
#endif /* not lint */
/*
char *fruit = (char *) 0;
fighter rogue = {
- INIT_AW, /* armor, weapon */
- INIT_RINGS, /* rings */
- INIT_HP, /* Hp current,max */
- INIT_STR, /* Str current,max */
+ INIT_AW, /* armor */
+ INIT_AW, /* weapon */
+ INIT_RINGS, /* left ring */
+ INIT_RINGS, /* right ring */
+ INIT_HP, /* Hp current */
+ INIT_HP, /* Hp max */
+ INIT_STR, /* Str current */
+ INIT_STR, /* Str max */
INIT_PACK, /* pack */
INIT_GOLD, /* gold */
- INIT_EXP, /* exp level,points */
+ INIT_EXPLEVEL, /* exp level */
+ INIT_EXP, /* exp points */
0, 0, /* row, col */
INIT_CHAR, /* char */
INIT_MOVES /* moves */
{270, " ", "of searching ",0},
};
-extern short cur_level, max_level;
-extern short party_room;
-extern char *error_file;
-extern boolean is_wood[];
-
+void
put_objects()
{
short i, n;
put_gold();
}
+void
put_gold()
{
short i, j;
}
}
+void
plant_gold(row, col, is_maze)
-short row, col;
-boolean is_maze;
+ short row, col;
+ boolean is_maze;
{
object *obj;
(void) add_to_pack(obj, &level_objects, 0);
}
+void
place_at(obj, row, col)
-object *obj;
+ object *obj;
+ int row, col;
{
obj->row = row;
obj->col = col;
object *
object_at(pack, row, col)
-register object *pack;
-short row, col;
+ object *pack;
+ short row, col;
{
object *obj = (object *) 0;
object *
get_letter_object(ch)
+ int ch;
{
object *obj;
return(obj);
}
+void
free_stuff(objlist)
-object *objlist;
+ object *objlist;
{
object *obj;
}
}
-char *
+const char *
name_of(obj)
-object *obj;
+ const object *obj;
{
- char *retstring;
+ const char *retstring;
switch(obj->what_is) {
case SCROL:
return(what_is);
}
+void
gr_scroll(obj)
-object *obj;
+ object *obj;
{
short percent;
}
}
+void
gr_potion(obj)
-object *obj;
+ object *obj;
{
short percent;
}
}
+void
gr_weapon(obj, assign_wk)
-object *obj;
-int assign_wk;
+ object *obj;
+ int assign_wk;
{
short percent;
short i;
percent = get_rand(1, 96);
blessing = get_rand(1, 3);
- if (percent <= 16) {
- increment = 1;
- } else if (percent <= 32) {
- increment = -1;
- obj->is_cursed = 1;
- }
if (percent <= 32) {
+ if (percent <= 16) {
+ increment = 1;
+ } else {
+ increment = -1;
+ obj->is_cursed = 1;
+ }
for (i = 0; i < blessing; i++) {
if (coin_toss()) {
obj->hit_enchant += increment;
}
}
+void
gr_armor(obj)
-object *obj;
+ object *obj;
{
short percent;
short blessing;
}
}
+void
gr_wand(obj)
-object *obj;
+ object *obj;
{
obj->what_is = WAND;
obj->which_kind = get_rand(0, (WANDS - 1));
obj->class = get_rand(3, 7);
}
+void
get_food(obj, force_ration)
-object *obj;
-boolean force_ration;
+ object *obj;
+ boolean force_ration;
{
obj->what_is = FOOD;
}
}
+void
put_stairs()
{
short row, col;
dungeon[row][col] |= STAIRS;
}
+int
get_armor_class(obj)
-object *obj;
+ const object *obj;
{
if (obj) {
return(obj->class + obj->d_enchant);
return(obj);
}
+void
free_object(obj)
-object *obj;
+ object *obj;
{
obj->next_object = free_list;
free_list = obj;
}
+void
make_party()
{
short n;
}
}
+void
show_objects()
{
object *obj;
rc = get_mask_char(obj->what_is);
if (dungeon[row][col] & MONSTER) {
- if (monster = object_at(&level_monsters, row, col)) {
+ if ((monster =
+ object_at(&level_monsters, row, col)) != NULL) {
monster->trail_char = rc;
}
}
}
}
+void
put_amulet()
{
object *obj;
rand_place(obj);
}
+void
rand_place(obj)
-object *obj;
+ object *obj;
{
short row, col;
place_at(obj, row, col);
}
+void
c_object_for_wizard()
{
short ch, max, wk;
object *obj;
char buf[80];
+ max = 0;
if (pack_count((object *) 0) >= MAX_PACK_COUNT) {
message("pack full", 0);
return;