+/* $NetBSD: monster.c,v 1.7 1998/11/10 13:01:32 hubertf 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.
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)monster.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: monster.c,v 1.2 1993/08/01 18:52:23 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)monster.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: monster.c,v 1.7 1998/11/10 13:01:32 hubertf Exp $");
+#endif
#endif /* not lint */
/*
object level_monsters;
boolean mon_disappeared;
-char *m_names[] = {
+const char *const m_names[] = {
"aquator",
"bat",
"centaur",
{(ASLEEP|WAKENS|WANDERS),"1d7",21,'Z',8,5,14,69,0,0,0,0,0}
};
-extern short cur_level;
-extern short cur_room, party_room;
-extern short blind, halluc, haste_self;
-extern boolean detect_monster, see_invisible, r_see_invisible;
-extern short stealthy;
-
+void
put_mons()
{
short i;
object *
gr_monster(monster, mn)
-register object *monster;
-register mn;
+ object *monster;
+ int mn;
{
if (!monster) {
monster = alloc_object();
return(monster);
}
+void
mv_mons()
{
- register object *monster, *next_monster;
+ object *monster, *next_monster, *test_mons;
boolean flew;
if (haste_self % 2) {
if (!(flew && mon_can_go(monster, rogue.row, rogue.col))) {
mv_1_monster(monster, rogue.row, rogue.col);
}
-NM: monster = next_monster;
+NM: test_mons = level_monsters.next_monster;
+ monster = NULL;
+ while (test_mons)
+ {
+ if (next_monster == test_mons)
+ {
+ monster = next_monster;
+ break;
+ }
+ test_mons = test_mons -> next_monster;
+ }
}
}
+void
party_monsters(rn, n)
-int rn, n;
+ int rn, n;
{
short i, j;
short row, col;
object *monster;
boolean found;
+ row = col = 0;
n += n;
for (i = 0; i < MONSTERS; i++) {
}
}
+char
gmc_row_col(row, col)
-register row, col;
+ int row, col;
{
- register object *monster;
+ object *monster;
- if (monster = object_at(&level_monsters, row, col)) {
+ if ((monster = object_at(&level_monsters, row, col)) != NULL) {
if ((!(detect_monster || see_invisible || r_see_invisible) &&
(monster->m_flags & INVISIBLE)) || blind) {
return(monster->trail_char);
}
}
+char
gmc(monster)
-object *monster;
+ object *monster;
{
if ((!(detect_monster || see_invisible || r_see_invisible) &&
(monster->m_flags & INVISIBLE))
return(monster->m_char);
}
+void
mv_1_monster(monster, row, col)
-register object *monster;
-short row, col;
+ object *monster;
+ short row, col;
{
short i, n;
boolean tried[6];
}
}
+int
mtry(monster, row, col)
-register object *monster;
-register short row, col;
+ object *monster;
+ short row, col;
{
if (mon_can_go(monster, row, col)) {
move_mon_to(monster, row, col);
return(0);
}
+void
move_mon_to(monster, row, col)
-register object *monster;
-register short row, col;
+ object *monster;
+ short row, col;
{
short c;
- register mrow, mcol;
+ int mrow, mcol;
mrow = monster->row;
mcol = monster->col;
}
}
+int
mon_can_go(monster, row, col)
-register object *monster;
-register short row, col;
+ const object *monster;
+ short row, col;
{
object *obj;
short dr, dc;
return(1);
}
+void
wake_up(monster)
-object *monster;
+ object *monster;
{
if (!(monster->m_flags & NAPPING)) {
monster->m_flags &= (~(ASLEEP | IMITATES | WAKENS));
}
}
+void
wake_room(rn, entering, row, col)
-short rn;
-boolean entering;
-short row, col;
+ short rn;
+ boolean entering;
+ short row, col;
{
object *monster;
short wake_percent;
}
}
-char *
+const char *
mon_name(monster)
-object *monster;
+ const object *monster;
{
short ch;
return(m_names[ch]);
}
+int
rogue_is_around(row, col)
-register row, col;
+ int row, col;
{
short rdif, cdif, retval;
return(retval);
}
+void
wanderer()
{
object *monster;
}
}
+void
show_monsters()
{
object *monster;
}
}
+void
create_monster()
{
short row, col;
}
}
+void
put_m_at(row, col, monster)
-short row, col;
-object *monster;
+ short row, col;
+ object *monster;
{
monster->row = row;
monster->col = col;
aim_monster(monster);
}
+void
aim_monster(monster)
-object *monster;
+ object *monster;
{
short i, rn, d, r;
}
}
+int
rogue_can_see(row, col)
-register row, col;
+ int row, col;
{
- register retval;
+ int retval;
retval = !blind &&
(((get_room_number(row, col) == cur_room) &&
return(retval);
}
+int
move_confused(monster)
-object *monster;
+ object *monster;
{
short i, row, col;
return(0);
}
+int
flit(monster)
-object *monster;
+ object *monster;
{
short i, row, col;
return(1);
}
+char
gr_obj_char()
{
short r;
- char *rs = "%!?]=/):*";
+ const char *rs = "%!?]=/):*";
r = get_rand(0, 8);
return(rs[r]);
}
+int
no_room_for_monster(rn)
-int rn;
+ int rn;
{
short i, j;
return(1);
}
+void
aggravate()
{
object *monster;
boolean
mon_sees(monster, row, col)
-object *monster;
+ const object *monster;
+ int row, col;
{
short rn, rdif, cdif, retval;
return(retval);
}
+void
mv_aquatars()
{
object *monster;