diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/include/extern.h nethack-autofire/include/extern.h --- nethack-3.4.3/include/extern.h 2003-12-08 10:39:13.000000000 +1100 +++ nethack-autofire/include/extern.h 2006-07-14 14:00:10.000000000 +1000 @@ -435,6 +435,7 @@ E void FDECL(impact_drop, (struct obj *, E int NDECL(dothrow); E int NDECL(dofire); +E int FDECL(throw_obj, (struct obj *, int)); E void FDECL(hitfloor, (struct obj *)); E void FDECL(hurtle, (int,int,int,BOOLEAN_P)); E void FDECL(mhurtle, (struct monst *,int,int,int)); diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/include/flag.h nethack-autofire/include/flag.h --- nethack-3.4.3/include/flag.h 2003-12-08 10:39:13.000000000 +1100 +++ nethack-autofire/include/flag.h 2006-07-14 14:10:47.000000000 +1000 @@ -23,6 +23,7 @@ struct flag { boolean asksavedisk; #endif boolean autodig; /* MRKR: Automatically dig */ + boolean autofire; /* Automatically fire bow */ boolean autoquiver; /* Automatically fill quiver */ boolean beginner; #ifdef MAIL diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/src/dothrow.c nethack-autofire/src/dothrow.c --- nethack-3.4.3/src/dothrow.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-autofire/src/dothrow.c 2006-07-14 14:06:39.000000000 +1000 @@ -7,7 +7,7 @@ #include "hack.h" #include "edog.h" -STATIC_DCL int FDECL(throw_obj, (struct obj *,int)); +STATIC_DCL int FDECL(get_throw_dir, (struct obj *)); STATIC_DCL void NDECL(autoquiver); STATIC_DCL int FDECL(gem_accept, (struct monst *, struct obj *)); STATIC_DCL void FDECL(tmiss, (struct obj *, struct monst *)); @@ -34,16 +34,9 @@ extern boolean notonhead; /* for long wo /* Throw the selected object, asking for direction */ STATIC_OVL int -throw_obj(obj, shotlimit) +get_throw_dir(obj) struct obj *obj; -int shotlimit; { - struct obj *otmp; - int multishot = 1; - schar skill; - long wep_mask; - boolean twoweap; - /* ask "in what direction?" */ #ifndef GOLDOBJ if (!getdir((char *)0)) { @@ -54,8 +47,6 @@ int shotlimit; } return(0); } - - if(obj->oclass == COIN_CLASS) return(throw_gold(obj)); #else if (!getdir((char *)0)) { /* obj might need to be merged back into the singular gold object */ @@ -63,6 +54,25 @@ int shotlimit; addinv(obj); return(0); } +#endif + + return (1); +} + +/* + * Throw an object in the direction given by u.dx, u.dy, u.dz (already set) + */ + +int +throw_obj(obj, shotlimit) +struct obj *obj; +int shotlimit; +{ + struct obj *otmp; + int multishot = 1; + schar skill; + long wep_mask; + boolean twoweap; /* Throwing money is usually for getting rid of it when @@ -73,7 +83,6 @@ int shotlimit; possibly using a sling. */ if(obj->oclass == COIN_CLASS && obj != uquiver) return(throw_gold(obj)); -#endif if(!canletgo(obj,"throw")) return(0); @@ -214,6 +223,7 @@ dothrow() /* (or jewels, or iron balls... ) */ if (!obj) return(0); + if (!get_throw_dir(obj)) return(0); return throw_obj(obj, shotlimit); } @@ -326,6 +336,7 @@ dofire() shotlimit = (multi || save_cm) ? multi + 1 : 0; multi = 0; /* reset; it's been used up */ + if (!get_throw_dir(uquiver)) return(0); return throw_obj(uquiver, shotlimit); } diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/src/options.c nethack-autofire/src/options.c --- nethack-3.4.3/src/options.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-autofire/src/options.c 2006-07-14 14:09:50.000000000 +1000 @@ -51,6 +51,7 @@ static struct Bool_Opt {"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE}, #endif {"autodig", &flags.autodig, FALSE, SET_IN_GAME}, + {"autofire", &flags.autofire, FALSE, SET_IN_GAME}, {"autopickup", &flags.pickup, TRUE, SET_IN_GAME}, {"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME}, #if defined(MICRO) && !defined(AMIGA) diff -Npbaur -x '*~' -x '#*#' nethack-3.4.3/src/uhitm.c nethack-autofire/src/uhitm.c --- nethack-3.4.3/src/uhitm.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-autofire/src/uhitm.c 2006-07-14 14:19:02.000000000 +1000 @@ -363,6 +363,16 @@ register struct monst *mtmp; if (u.twoweap && !can_twoweapon()) untwoweapon(); + if (flags.autofire && uwep && is_launcher(uwep) + && uquiver && ammo_and_launcher(uquiver, uwep)) { + + /* If you're wielding a launcher with appropriate + * ammo in your quiver, fire it automatically + */ + + return throw_obj(uquiver, 0); + } + if(unweapon) { unweapon = FALSE; if(flags.verbose) {