Data Structures | Defines | Functions | Variables

worm.c File Reference

#include "hack.h"
#include "lev.h"
Include dependency graph for worm.c:

Data Structures

struct  wseg

Defines

#define newseg()   (struct wseg *) alloc(sizeof(struct wseg))
#define dealloc_seg(wseg)   free((genericptr_t) (wseg))

Functions

STATIC_DCL void FDECL (toss_wsegs,(struct wseg *, BOOLEAN_P))
STATIC_DCL void FDECL (shrink_worm,(int))
STATIC_DCL void FDECL (random_dir,(XCHAR_P, XCHAR_P, xchar *, xchar *))
STATIC_DCL struct wsegFDECL (create_worm_tail,(int))
int get_wormno ()
void initworm (struct monst *worm, int wseg_count)
STATIC_OVL void toss_wsegs (struct wseg *curr, boolean display_update)
STATIC_OVL void shrink_worm (int wnum)
void worm_move (struct monst *worm)
void worm_nomove (struct monst *worm)
void wormgone (struct monst *worm)
void wormhitu (struct monst *worm)
void cutoff (struct monst *worm, struct wseg *tail)
void cutworm (struct monst *worm, xchar x, xchar y, struct obj *weap)
void see_wsegs (struct monst *worm)
void detect_wsegs (struct monst *worm, boolean use_detection_glyph)
void save_worm (int fd, int mode)
void rest_worm (int fd)
void place_wsegs (struct monst *worm)
void remove_worm (struct monst *worm)
void place_worm_tail_randomly (struct monst *worm, xchar x, xchar y)
STATIC_OVL void random_dir (xchar x, xchar y, xchar *nx, xchar *ny)
int count_wsegs (struct monst *mtmp)
STATIC_OVL struct wsegcreate_worm_tail (int num_segs)
boolean worm_known (struct monst *worm)
void flip_worm_segs_vertical (struct monst *worm, int y)
void flip_worm_segs_horizontal (struct monst *worm, int x)

Variables

struct wsegwheads [MAX_NUM_WORMS] = DUMMY
struct wsegwtails [MAX_NUM_WORMS] = DUMMY
long wgrowtime [MAX_NUM_WORMS] = DUMMY

Define Documentation

#define dealloc_seg (   wseg )    free((genericptr_t) (wseg))

Referenced by save_worm(), and toss_wsegs().

#define newseg (  )    (struct wseg *) alloc(sizeof(struct wseg))

Function Documentation

int count_wsegs ( struct monst mtmp )

References wseg::nseg.

Referenced by digactualhole(), keepdogs(), makemon(), migrate_to_level(), mintrap(), and newcham().

Here is the caller graph for this function:

STATIC_OVL struct wseg* create_worm_tail ( int  num_segs ) [read]

References newseg, wseg::nseg, wseg::wx, and wseg::wy.

Referenced by initworm().

Here is the caller graph for this function:

void cutoff ( struct monst worm,
struct wseg tail 
)

References flags, flag::mon_moving, mon_nam(), pline(), toss_wsegs(), and TRUE.

Referenced by cutworm().

Here is the call graph for this function:

Here is the caller graph for this function:

void cutworm ( struct monst worm,
xchar  x,
xchar  y,
struct obj weap 
)

References clone_mon(), cutoff(), d(), flags, get_wormno(), is_blade, monst::m_lev, max, monst::mhp, monst::mhpmax, flag::mon_moving, mon_nam(), Monnam(), wseg::nseg, place_wsegs(), pline(), remove_monster(), rn2(), rnd(), shrink_worm(), wseg::wx, and wseg::wy.

Referenced by known_hitum(), and thitmonst().

Here is the call graph for this function:

Here is the caller graph for this function:

void detect_wsegs ( struct monst worm,
boolean  use_detection_glyph 
)

References detected_monnum_to_glyph, monnum_to_glyph, wseg::nseg, PM_LONG_WORM_TAIL, show_glyph(), what_mon, wseg::wx, and wseg::wy.

Referenced by monster_detect().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_DCL void FDECL ( shrink_worm  ,
(int)   
)
STATIC_DCL struct wseg* FDECL ( create_worm_tail  ,
(int)   
) [read]
STATIC_DCL void FDECL ( random_dir  ,
(XCHAR_P, XCHAR_P, xchar *, xchar *)   
)
STATIC_DCL void FDECL ( toss_wsegs  ,
(struct wseg *, BOOLEAN_P)   
)
void flip_worm_segs_horizontal ( struct monst worm,
int  x 
)

References wseg::nseg, and wseg::wx.

Referenced by flip_level().

Here is the caller graph for this function:

void flip_worm_segs_vertical ( struct monst worm,
int  y 
)

References wseg::nseg, and wseg::wy.

Referenced by flip_level().

Here is the caller graph for this function:

int get_wormno (  )

References MAX_NUM_WORMS.

Referenced by cutworm(), makemon(), mon_arrive(), and newcham().

Here is the caller graph for this function:

void initworm ( struct monst worm,
int  wseg_count 
)

References create_worm_tail(), newseg, wseg::nseg, wseg::wx, and wseg::wy.

Referenced by makemon(), mon_arrive(), and newcham().

Here is the call graph for this function:

Here is the caller graph for this function:

void place_worm_tail_randomly ( struct monst worm,
xchar  x,
xchar  y 
)

References FALSE, goodpos(), newsym(), wseg::nseg, place_worm_seg, random_dir(), toss_wsegs(), wseg::wx, and wseg::wy.

Referenced by makemon(), newcham(), and rloc_to().

Here is the call graph for this function:

Here is the caller graph for this function:

void place_wsegs ( struct monst worm )

References wseg::nseg, place_worm_seg, wseg::wx, and wseg::wy.

Referenced by cutworm(), getlev(), and replmon().

Here is the caller graph for this function:

STATIC_OVL void random_dir ( xchar  x,
xchar  y,
xchar nx,
xchar ny 
)

References COLNO, rn2(), and ROWNO.

Referenced by place_worm_tail_randomly().

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_worm ( struct monst worm )

References newsym(), wseg::nseg, remove_monster(), wseg::wx, and wseg::wy.

Referenced by mnearto(), movebubbles(), and rloc_to().

Here is the call graph for this function:

Here is the caller graph for this function:

void rest_worm ( int  fd )

References MAX_NUM_WORMS, mread(), newseg, wseg::nseg, wseg::wx, and wseg::wy.

Referenced by getlev().

Here is the call graph for this function:

Here is the caller graph for this function:

void save_worm ( int  fd,
int  mode 
)

References bwrite(), dealloc_seg, MAX_NUM_WORMS, wseg::nseg, perform_bwrite, release_data, wseg::wx, and wseg::wy.

Referenced by savelev().

Here is the call graph for this function:

Here is the caller graph for this function:

void see_wsegs ( struct monst worm )

References newsym(), wseg::nseg, wseg::wx, and wseg::wy.

Referenced by m_move(), mon_set_minvis(), and see_monsters().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void shrink_worm ( int  wnum )

References wseg::nseg, toss_wsegs(), and TRUE.

Referenced by cutworm(), worm_move(), and worm_nomove().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void toss_wsegs ( struct wseg curr,
boolean  display_update 
)

References dealloc_seg, newsym(), wseg::nseg, and remove_monster().

Referenced by cutoff(), place_worm_tail_randomly(), shrink_worm(), and wormgone().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean worm_known ( struct monst worm )

References cansee, FALSE, wseg::nseg, TRUE, wseg::wx, and wseg::wy.

Referenced by lookat(), and monkilled().

Here is the caller graph for this function:

void worm_move ( struct monst worm )

References MHPMAX, moves, newseg, newsym(), wseg::nseg, place_worm_seg, rn1, rnd(), shrink_worm(), wseg::wx, and wseg::wy.

Referenced by m_move(), mattacku(), use_defensive(), and use_misc().

Here is the call graph for this function:

Here is the caller graph for this function:

void worm_nomove ( struct monst worm )

References shrink_worm().

Referenced by m_move().

Here is the call graph for this function:

Here is the caller graph for this function:

void wormgone ( struct monst worm )

References toss_wsegs(), and TRUE.

Referenced by keepdogs(), m_detach(), migrate_to_level(), and newcham().

Here is the call graph for this function:

Here is the caller graph for this function:

void wormhitu ( struct monst worm )

References distu, mattacku(), wseg::nseg, wseg::wx, and wseg::wy.

Here is the call graph for this function:


Variable Documentation

long wgrowtime[MAX_NUM_WORMS] = DUMMY
struct wseg* wheads[MAX_NUM_WORMS] = DUMMY
struct wseg * wtails[MAX_NUM_WORMS] = DUMMY