Skip to content

Commit

Permalink
add pickup_thrown (from hardfought branch)
Browse files Browse the repository at this point in the history
  • Loading branch information
NHTangles committed Jul 14, 2017
1 parent b658100 commit adb0d77
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions dat/opthelp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ null allow nulls to be sent to your terminal [TRUE]
delay code) if moving objects seem to teleport across rooms
number_pad use the number keys to move instead of yuhjklbn [FALSE]
perm_invent keep inventory in a permanent window [FALSE]
pickup_thrown autopickup things you threw [FALSE]
prayconfirm use confirmation prompt when #pray command issued [TRUE]
pushweapon when wielding a new weapon, put your previously
wielded weapon into the secondary weapon slot [FALSE]
Expand Down
1 change: 1 addition & 0 deletions include/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ struct instance_flags {
boolean use_menu_glyphs;
boolean hilite_hidden_stairs;
boolean hilite_obj_piles;
boolean pickup_thrown;
/*
* Window capability support.
*/
Expand Down
3 changes: 2 additions & 1 deletion include/obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ struct obj {

Bitfield(in_use,1); /* for magic items before useup items */
Bitfield(bypass,1); /* mark this as an object to be skipped by bhito() */
/* 6 free bits */
Bitfield(was_thrown,1); /* for pickup_thrown */
/* 5 free bits */

int corpsenm; /* type of corpse is mons[corpsenm] */
#define leashmon corpsenm /* gets m_id of attached pet */
Expand Down
1 change: 1 addition & 0 deletions src/bones.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ boolean restore;
otmp->rknown = 0;
otmp->invlet = 0;
otmp->no_charge = 0;
otmp->was_thrown = 0;

if (otmp->otyp == SLIME_MOLD) goodfruit(otmp->spe);
#ifdef MAIL
Expand Down
2 changes: 2 additions & 0 deletions src/dothrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
register int range, urange;
boolean impaired = (Confusion || Stunned || Blind ||
Hallucination || Fumbling);

obj->was_thrown = 1;

if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) {
boolean slipok = TRUE;
Expand Down
1 change: 1 addition & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static struct Bool_Opt
{"page_wait", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"perm_invent", &flags.perm_invent, FALSE, SET_IN_GAME},
{"pickup_thrown", &iflags.pickup_thrown, FALSE, SET_IN_GAME},
{"popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME}, /*WC*/
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME},
{"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/
Expand Down
17 changes: 9 additions & 8 deletions src/pickup.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,23 +640,23 @@ menu_item **pick_list; /* list of objects and counts to pick up */


#ifndef AUTOPICKUP_EXCEPTIONS
if (!*otypes || index(otypes, curr->oclass))
if (!*otypes || index(otypes, curr->oclass) || (iflags.pickup_thrown && curr->was_thrown))
#else
if ((!*otypes || index(otypes, curr->oclass) ||
is_autopickup_exception(curr, TRUE)) &&
!is_autopickup_exception(curr, FALSE))
if (((!*otypes || index(otypes, curr->oclass) ||
is_autopickup_exception(curr, TRUE)) &&
!is_autopickup_exception(curr, FALSE)) || (iflags.pickup_thrown && curr->was_thrown))
#endif
n++;

if (n) {
*pick_list = pi = (menu_item *) alloc(sizeof(menu_item) * n);
for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow))
#ifndef AUTOPICKUP_EXCEPTIONS
if (!*otypes || index(otypes, curr->oclass)) {
if (!*otypes || index(otypes, curr->oclass) || (iflags.pickup_thrown && curr->was_thrown)) {
#else
if ((!*otypes || index(otypes, curr->oclass) ||
is_autopickup_exception(curr, TRUE)) &&
!is_autopickup_exception(curr, FALSE)) {
if (((!*otypes || index(otypes, curr->oclass) ||
is_autopickup_exception(curr, TRUE)) &&
!is_autopickup_exception(curr, FALSE)) || (iflags.pickup_thrown && curr->was_thrown)) {
#endif
pi[n].item.a_obj = curr;
pi[n].count = curr->quan;
Expand Down Expand Up @@ -1394,6 +1394,7 @@ boolean telekinesis; /* not picking it up directly by hand */
obj = splitobj(obj, count);

obj = pick_obj(obj);
obj->was_thrown = 0;

if (uwep && uwep == obj) mrg_to_wielded = TRUE;
nearload = near_capacity();
Expand Down

0 comments on commit adb0d77

Please sign in to comment.