summaryrefslogtreecommitdiff
path: root/games/rogue/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'games/rogue/object.c')
-rw-r--r--games/rogue/object.c97
1 files changed, 60 insertions, 37 deletions
diff --git a/games/rogue/object.c b/games/rogue/object.c
index 03b63a5c18b..a74bb3a7077 100644
--- a/games/rogue/object.c
+++ b/games/rogue/object.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: object.c,v 1.3 1998/08/22 08:55:36 pjanzen Exp $ */
/* $NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $ */
/*
@@ -40,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $";
+static char rcsid[] = "$OpenBSD: object.c,v 1.3 1998/08/22 08:55:36 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $";
* 1.) No portion of this notice shall be removed.
* 2.) Credit shall not be taken for the creation of this source.
* 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
+ * gain or profit.
*
*/
@@ -65,13 +66,18 @@ object *free_list = (object *) 0;
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 */
@@ -159,11 +165,7 @@ struct id id_rings[RINGS] = {
{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;
@@ -186,6 +188,7 @@ put_objects()
put_gold();
}
+void
put_gold()
{
short i, j;
@@ -215,9 +218,10 @@ put_gold()
}
}
+void
plant_gold(row, col, is_maze)
-short row, col;
-boolean is_maze;
+ short row, col;
+ boolean is_maze;
{
object *obj;
@@ -232,8 +236,10 @@ boolean is_maze;
(void) add_to_pack(obj, &level_objects, 0);
}
+void
place_at(obj, row, col)
-object *obj;
+ object *obj;
+ short row, col;
{
obj->row = row;
obj->col = col;
@@ -243,8 +249,8 @@ object *obj;
object *
object_at(pack, row, col)
-register object *pack;
-short row, col;
+ object *pack;
+ short row, col;
{
object *obj = (object *) 0;
@@ -274,8 +280,9 @@ get_letter_object(ch)
return(obj);
}
+void
free_stuff(objlist)
-object *objlist;
+ object *objlist;
{
object *obj;
@@ -289,7 +296,7 @@ object *objlist;
char *
name_of(obj)
-object *obj;
+ object *obj;
{
char *retstring;
@@ -409,8 +416,9 @@ gr_what_is()
return(what_is);
}
+void
gr_scroll(obj)
-object *obj;
+ object *obj;
{
short percent;
@@ -447,8 +455,9 @@ object *obj;
}
}
+void
gr_potion(obj)
-object *obj;
+ object *obj;
{
short percent;
@@ -487,9 +496,10 @@ object *obj;
}
}
+void
gr_weapon(obj, assign_wk)
-object *obj;
-int assign_wk;
+ object *obj;
+ int assign_wk;
{
short percent;
short i;
@@ -511,13 +521,13 @@ int assign_wk;
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;
@@ -552,8 +562,9 @@ int assign_wk;
}
}
+void
gr_armor(obj)
-object *obj;
+ object *obj;
{
short percent;
short blessing;
@@ -578,17 +589,19 @@ object *obj;
}
}
+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;
@@ -599,6 +612,7 @@ boolean force_ration;
}
}
+void
put_stairs()
{
short row, col;
@@ -607,8 +621,9 @@ put_stairs()
dungeon[row][col] |= STAIRS;
}
+int
get_armor_class(obj)
-object *obj;
+ object *obj;
{
if (obj) {
return(obj->class + obj->d_enchant);
@@ -637,13 +652,15 @@ alloc_object()
return(obj);
}
+void
free_object(obj)
-object *obj;
+ object *obj;
{
obj->next_object = free_list;
free_list = obj;
}
+void
make_party()
{
short n;
@@ -656,6 +673,7 @@ make_party()
}
}
+void
show_objects()
{
object *obj;
@@ -671,7 +689,8 @@ show_objects()
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))) {
monster->trail_char = rc;
}
}
@@ -693,6 +712,7 @@ show_objects()
}
}
+void
put_amulet()
{
object *obj;
@@ -702,8 +722,9 @@ put_amulet()
rand_place(obj);
}
+void
rand_place(obj)
-object *obj;
+ object *obj;
{
short row, col;
@@ -711,12 +732,14 @@ object *obj;
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;