Data Structures | Defines | Functions | Variables

timeout.c File Reference

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

Data Structures

struct  ttable

Defines

#define VERBOSE_TIMER
#define TTAB(a, b, c)   {a,b,c}

Functions

STATIC_DCL void NDECL (stoned_dialogue)
STATIC_DCL void NDECL (vomiting_dialogue)
STATIC_DCL void NDECL (choke_dialogue)
STATIC_DCL void NDECL (slime_dialogue)
STATIC_DCL void NDECL (slip_or_trip)
STATIC_DCL void FDECL (see_lamp_flicker,(struct obj *, const char *))
STATIC_DCL void FDECL (lantern_message,(struct obj *))
STATIC_DCL void FDECL (cleanup_burn,(genericptr_t, long))
STATIC_OVL void stoned_dialogue ()
STATIC_OVL void vomiting_dialogue ()
STATIC_OVL void choke_dialogue ()
STATIC_OVL void slime_dialogue ()
void burn_away_slime ()
void nh_timeout ()
void fall_asleep (int how_long, boolean wakeup_msg)
void attach_egg_hatch_timeout (struct obj *egg)
void kill_egg (struct obj *egg)
void hatch_egg (genericptr_t arg, long timeout)
void learn_egg_type (int mnum)
void attach_fig_transform_timeout (struct obj *figurine)
STATIC_OVL void slip_or_trip ()
STATIC_OVL void see_lamp_flicker (struct obj *obj, const char *tailer)
STATIC_OVL void lantern_message (struct obj *obj)
void burn_object (genericptr_t arg, long timeout)
void begin_burn (struct obj *obj, boolean already_lit)
void end_burn (struct obj *obj, boolean timer_attached)
static void cleanup_burn (genericptr_t arg, long expire_time)
void do_storms ()
STATIC_DCL void FDECL (insert_timer,(timer_element *))
STATIC_DCL timer_elementFDECL (remove_timer,(timer_element **, SHORT_P, genericptr_t))
STATIC_DCL void FDECL (write_timer,(int, timer_element *))
STATIC_DCL boolean FDECL (mon_is_local,(struct monst *))
STATIC_DCL boolean FDECL (timer_is_local,(timer_element *))
STATIC_DCL int FDECL (maybe_write_timer,(int, int, BOOLEAN_P))
void run_timers ()
boolean start_timer (long when, short kind, short func_index, genericptr_t arg)
long stop_timer (short func_index, genericptr_t arg)
void obj_move_timers (struct obj *src, struct obj *dest)
void obj_split_timers (struct obj *src, struct obj *dest)
void obj_stop_timers (struct obj *obj)
STATIC_OVL void insert_timer (timer_element *gnu)
STATIC_OVL timer_elementremove_timer (timer_element **base, short func_index, genericptr_t arg)
STATIC_OVL void write_timer (int fd, timer_element *timer)
boolean obj_is_local (struct obj *obj)
STATIC_OVL boolean mon_is_local (struct monst *mon)
STATIC_OVL boolean timer_is_local (timer_element *timer)
STATIC_OVL int maybe_write_timer (int fd, int range, boolean write_it)
void save_timers (int fd, int mode, int range)
void restore_timers (int fd, int range, boolean ghostly, long adjust)
void relink_timers (boolean ghostly)

Variables

static NEARDATA const char *const stoned_texts []
static NEARDATA const char *const vomiting_texts []
static NEARDATA const char *const choke_texts []
static NEARDATA const char *const choke_texts2 []
static NEARDATA const char *const slime_texts []
static timer_elementtimer_base
static unsigned long timer_id = 1
static const ttable timeout_funcs [NUM_TIME_FUNCS]

Define Documentation

#define TTAB (   a,
  b,
 
)    {a,b,c}
#define VERBOSE_TIMER

Function Documentation

void attach_egg_hatch_timeout ( struct obj egg )

References HATCH_EGG, MAX_EGG_HATCH_TIME, rnd(), start_timer(), stop_timer(), and TIMER_OBJECT.

Referenced by create_object(), dosit(), hatch_egg(), mksobj(), poly_obj(), readobjnam(), and revive_egg().

Here is the call graph for this function:

Here is the caller graph for this function:

void attach_fig_transform_timeout ( struct obj figurine )

References FIG_TRANSFORM, rnd(), start_timer(), stop_timer(), and TIMER_OBJECT.

Referenced by carry_obj_effects(), and curse().

Here is the call graph for this function:

Here is the caller graph for this function:

void begin_burn ( struct obj obj,
boolean  already_lit 
)
void burn_away_slime (  )
void burn_object ( genericptr_t  arg,
long  timeout 
)
STATIC_OVL void choke_dialogue (  )

References A_STR, body_part(), Breathless, exercise(), FALSE, hcolor(), index, NECK, NH_BLUE, pline(), rn2(), SIZE, Strangled, and TIMEOUT.

Referenced by nh_timeout().

Here is the call graph for this function:

Here is the caller graph for this function:

static void cleanup_burn ( genericptr_t  arg,
long  expire_time 
) [static]

References obj::age, del_light_source(), LS_OBJECT, monstermoves, OBJ_INVENT, update_inventory, obj::where, and xname().

Here is the call graph for this function:

void do_storms (  )

References buzz(), CLOUD, COLNO, dlevel_t::flags, level, levl, nomul(), pline(), rn2(), rnd(), ROWNO, stop_occupation(), u, you::ux, and you::uy.

Referenced by moveloop().

Here is the call graph for this function:

Here is the caller graph for this function:

void end_burn ( struct obj obj,
boolean  timer_attached 
)
void fall_asleep ( int  how_long,
boolean  wakeup_msg 
)

References flags, Hear_again(), monstermoves, multi, nomovemsg, nomul(), flag::soundok, stop_occupation(), u, you::usleep, and You_can_move_again.

Referenced by domove(), dotrap(), gazemu(), hitmu(), moveloop(), nh_timeout(), peffects(), zapyourself(), and zhitu().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_DCL void FDECL ( see_lamp_flicker  ,
(struct obj *, const char *)   
)
STATIC_DCL boolean FDECL ( mon_is_local  ,
(struct monst *)   
)
STATIC_DCL boolean FDECL ( timer_is_local  ,
(timer_element *)   
)
STATIC_DCL int FDECL ( maybe_write_timer  ,
(int, int, BOOLEAN_P)   
)
STATIC_DCL void FDECL ( cleanup_burn  ,
(genericptr_t, long)   
)
STATIC_DCL void FDECL ( lantern_message  ,
(struct obj *)   
)
STATIC_DCL void FDECL ( insert_timer  ,
(timer_element *)   
)
STATIC_DCL timer_element* FDECL ( remove_timer  ,
(timer_element **, SHORT_P, genericptr_t  
)
STATIC_DCL void FDECL ( write_timer  ,
(int, timer_element *)   
)
void hatch_egg ( genericptr_t  arg,
long  timeout 
)
STATIC_OVL void insert_timer ( timer_element gnu )

References fe::next.

Referenced by restore_timers(), and start_timer().

Here is the caller graph for this function:

void kill_egg ( struct obj egg )

References HATCH_EGG, and stop_timer().

Referenced by create_object(), kill_eggs(), poly_obj(), and readobjnam().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void lantern_message ( struct obj obj )

References Hallucination, Monnam(), OBJ_FLOOR, OBJ_INVENT, OBJ_MINVENT, pline(), and s_suffix().

Referenced by burn_object().

Here is the call graph for this function:

Here is the caller graph for this function:

void learn_egg_type ( int  mnum )

References little_to_big(), monst::mnum, MV_KNOWS_EGG, mvitals::mvflags, and update_inventory.

Referenced by fully_identify_obj(), hatch_egg(), and polymon().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL int maybe_write_timer ( int  fd,
int  range,
boolean  write_it 
)

References fe::next, RANGE_GLOBAL, timer_is_local(), and write_timer().

Referenced by save_timers().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean mon_is_local ( struct monst mon )

References FALSE, migrating_mons, mydogs, monst::nmon, and TRUE.

Referenced by obj_is_local(), and timer_is_local().

Here is the caller graph for this function:

STATIC_DCL void NDECL ( slime_dialogue   )
STATIC_DCL void NDECL ( vomiting_dialogue   )
STATIC_DCL void NDECL ( choke_dialogue   )
STATIC_DCL void NDECL ( slip_or_trip   )
STATIC_DCL void NDECL ( stoned_dialogue   )
void nh_timeout (  )

References BInvis, Blind, Blinded, BLINDED, carrying(), choke_dialogue(), CONFUSION, monst::data, delayed_killer, DETECT_MONSTERS, DIED, done(), fall_asleep(), FALSE, Fast, FAST, find_ac(), flags, float_down(), flag::friday13, FROMOUTSIDE, FULL_MOON, Fumbling, FUMBLING, G_UNIQ, HALLUC, hcolor(), HConfusion, heal_legs(), HFumbling, HHallucination, HSleeping, HStun, I_SPECIAL, prop::intrinsic, inv_weight(), Invis, INVIS, KILLED_BY, KILLED_BY_AN, killer, killer_format, Levitation, LEVITATION, LOW_PM, LUCKSTONE, make_blinded(), make_confused(), make_hallucinated(), make_stunned(), make_vomiting(), permonst::mlevel, Monnam(), mons, flag::moonphase, moves, you::mtimedone, name_to_mon(), newsym(), NH_GOLDEN, NO_KILLER_PREFIX, nomovemsg, nomul(), pline(), POISONING, rehumanize(), rnd(), run_timers(), SEE_INVIS, See_invisible, see_monsters(), set_mimic_blocking(), SICK, SIZE, Sleep_resistance, Sleeping, SLEEPING, slime_dialogue(), SLIMED, Slimed, slip_or_trip(), stone_luck(), STONED, Stoned, stoned_dialogue(), STONING, stop_occupation(), STRANGLED, Strangled, Strcpy, STUNNED, the(), TIMEOUT, TRUE, TURNED_SLIME, type_is_pname, u, you::ucreamed, you::ugangr, you::uhave, you::uluck, you::umoved, Unchanging, unconscious(), you::uprops, you::usick_cause, you::uspellprot, you::uspmtime, you::usptime, you::ux, you::uy, Very_fast, VOMITING, Vomiting, vomiting_dialogue(), wake_nearby(), WOUNDED_LEGS, and youmonst.

Referenced by moveloop().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean obj_is_local ( struct obj obj )

References FALSE, mon_is_local(), OBJ_BURIED, OBJ_CONTAINED, OBJ_FLOOR, OBJ_INVENT, OBJ_MIGRATING, OBJ_MINVENT, and TRUE.

Referenced by maybe_write_ls(), save_light_sources(), and timer_is_local().

Here is the call graph for this function:

Here is the caller graph for this function:

void obj_move_timers ( struct obj src,
struct obj dest 
)

References fe::arg, fe::kind, fe::next, and TIMER_OBJECT.

Referenced by realloc_obj().

Here is the caller graph for this function:

void obj_split_timers ( struct obj src,
struct obj dest 
)

References fe::arg, fe::func_index, fe::kind, monstermoves, fe::next, start_timer(), fe::timeout, and TIMER_OBJECT.

Referenced by splitobj().

Here is the call graph for this function:

Here is the caller graph for this function:

void obj_stop_timers ( struct obj obj )
void relink_timers ( boolean  ghostly )

References fe::arg, find_oid(), fe::kind, lookup_id_mapping(), fe::next, TIMER_MONSTER, and TIMER_OBJECT.

Referenced by getlev(), and restgamestate().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL timer_element* remove_timer ( timer_element **  base,
short  func_index,
genericptr_t  arg 
)

References fe::next.

Referenced by stop_timer().

Here is the caller graph for this function:

void restore_timers ( int  fd,
int  range,
boolean  ghostly,
long  adjust 
)

References insert_timer(), mread(), and RANGE_GLOBAL.

Referenced by getlev(), and restgamestate().

Here is the call graph for this function:

Here is the caller graph for this function:

void run_timers (  )

References fe::arg, ttable::f, fe::func_index, fe::kind, monstermoves, fe::next, obj::timed, fe::timeout, timer_base, and TIMER_OBJECT.

Referenced by dorecover(), goto_level(), and nh_timeout().

Here is the caller graph for this function:

void save_timers ( int  fd,
int  mode,
int  range 
)

References bwrite(), FALSE, maybe_write_timer(), fe::next, perform_bwrite, RANGE_GLOBAL, RANGE_LEVEL, release_data, timer_is_local(), and TRUE.

Referenced by savegamestate(), and savelev().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void see_lamp_flicker ( struct obj obj,
const char *  tailer 
)

References an(), OBJ_FLOOR, OBJ_INVENT, OBJ_MINVENT, pline(), xname(), and Yname2().

Referenced by burn_object().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void slime_dialogue (  )

References A_DEX, an(), Blind, exercise(), FALSE, Hallucination, hcolor(), HFast, index, multi, NH_GREEN, nomul(), pline(), rndmonnam(), SIZE, Slimed, stop_occupation(), and TIMEOUT.

Referenced by nh_timeout().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void slip_or_trip (  )

References ARTICLE_NONE, ARTICLE_THE, Blind, body_part(), BUFSZ, doname(), FALSE, FOOT, Hallucination, highc(), is_ice(), is_pool(), makeplural(), otmp, pline(), obj::quan, rn2(), ROCK, sobj_at(), something, STEED, SUPPRESS_SADDLE, TRUE, u, upstart(), you::ux, you::uy, vobj_at, what, and x_monnam().

Referenced by nh_timeout().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean start_timer ( long  when,
short  kind,
short  func_index,
genericptr_t  arg 
)
STATIC_OVL void stoned_dialogue (  )

References A_DEX, exercise(), FALSE, HFast, nomul(), pline(), SIZE, Stoned, and TIMEOUT.

Referenced by nh_timeout().

Here is the call graph for this function:

Here is the caller graph for this function:

long stop_timer ( short  func_index,
genericptr_t  arg 
)
STATIC_OVL boolean timer_is_local ( timer_element timer )

References FALSE, mon_is_local(), obj_is_local(), TIMER_GLOBAL, TIMER_LEVEL, TIMER_MONSTER, TIMER_OBJECT, and TRUE.

Referenced by maybe_write_timer(), and save_timers().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void vomiting_dialogue (  )

References A_CON, d(), exercise(), FALSE, HConfusion, HStun, make_confused(), make_stunned(), morehungry(), SIZE, TIMEOUT, vomit(), and Vomiting.

Referenced by nh_timeout().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void write_timer ( int  fd,
timer_element timer 
)

References bwrite(), fe::kind, obj::o_id, TIMER_GLOBAL, TIMER_LEVEL, TIMER_MONSTER, and TIMER_OBJECT.

Referenced by maybe_write_timer().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

NEARDATA const char* const choke_texts[] [static]
Initial value:
 {
        "You find it hard to breathe.",
        "You're gasping for air.",
        "You can no longer breathe.",
        "You're turning %s.",
        "You suffocate."
}
NEARDATA const char* const choke_texts2[] [static]
Initial value:
 {
        "Your %s is becoming constricted.",
        "Your blood is having trouble reaching your brain.",
        "The pressure on your %s increases.",
        "Your consciousness is fading.",
        "You suffocate."
}
NEARDATA const char* const slime_texts[] [static]
Initial value:
 {
        "You are turning a little %s.",           
        "Your limbs are getting oozy.",              
        "Your skin begins to peel away.",            
        "You are turning into %s.",       
        "You have become %s."             
}
NEARDATA const char* const stoned_texts[] [static]
Initial value:
 {
        "You are slowing down.",                
        "Your limbs are stiffening.",           
        "Your limbs have turned to stone.",     
        "You have turned to stone.",            
        "You are a statue."                     
}
const ttable timeout_funcs[NUM_TIME_FUNCS] [static]
Initial value:
 {
    TTAB(rot_organic,   (timeout_proc)0,        "rot_organic"),
    TTAB(rot_corpse,    (timeout_proc)0,        "rot_corpse"),
    TTAB(revive_mon,    (timeout_proc)0,        "revive_mon"),
    TTAB(burn_object,   cleanup_burn,           "burn_object"),
    TTAB(hatch_egg,     (timeout_proc)0,        "hatch_egg"),

}

Referenced by run_timers().

unsigned long timer_id = 1 [static]
NEARDATA const char* const vomiting_texts[] [static]
Initial value:
 {
        "are feeling mildly nauseated.",        
        "feel slightly confused.",              
        "can't seem to think straight.",        
        "feel incredibly sick.",                
        "suddenly vomit!"                       
}