Skip to content

Commit e2c6edf

Browse files
EmilyV99connorjclark
authored andcommitted
fix: Lift gloves with specific settings not allowing throwing
Gloves with Button=0 and 'Disable Item Use' set were unable to throw objects once picked up.
1 parent cd7d682 commit e2c6edf

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

src/zc/hero.cpp

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14575,11 +14575,21 @@ void HeroClass::moveheroOld()
1457514575
WalkflagInfo info;
1457614576

1457714577
bool no_jinx = true;
14578-
if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee...
14578+
bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS);
14579+
if(liftonly)
14580+
{
14581+
if(replay_version_check(38))
14582+
{
14583+
auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn);
14584+
no_jinx = checkitem_jinx(itmid);
14585+
if(no_jinx)
14586+
startwpn(itmid);
14587+
}
14588+
}
14589+
else if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee...
1457914590
{
1458014591
bool paidmagic = false;
14581-
bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS);
14582-
if(!liftonly && btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_wand : false) : current_item(itype_wand)))
14592+
if(btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_wand : false) : current_item(itype_wand)))
1458314593
{
1458414594
attackid=directWpn>-1 ? directWpn : current_item_id(itype_wand);
1458514595
no_jinx = checkitem_jinx(attackid);
@@ -14598,7 +14608,7 @@ void HeroClass::moveheroOld()
1459814608
item_error();
1459914609
}
1460014610
}
14601-
else if(!liftonly && (btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer)
14611+
else if((btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer)
1460214612
&& (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_hammer : false) : current_item(itype_hammer)))
1460314613
{
1460414614
no_jinx = checkitem_jinx(dowpn);
@@ -14616,7 +14626,7 @@ void HeroClass::moveheroOld()
1461614626
attackclk=0;
1461714627
}
1461814628
}
14619-
else if(!liftonly && (btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire)
14629+
else if((btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire)
1462014630
&& (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_candle : false) : current_item(itype_candle)))
1462114631
{
1462214632
//checkbunny handled where magic cost is paid
@@ -14629,7 +14639,7 @@ void HeroClass::moveheroOld()
1462914639
attackclk=0;
1463014640
}
1463114641
}
14632-
else if(!liftonly && (btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna)
14642+
else if((btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna)
1463314643
&& (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_cbyrna : false) : current_item(itype_cbyrna)))
1463414644
{
1463514645
attackid=directWpn>-1 ? directWpn : current_item_id(itype_cbyrna);
@@ -14649,7 +14659,7 @@ void HeroClass::moveheroOld()
1464914659
item_error();
1465014660
}
1465114661
}
14652-
else if(!liftonly && (btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet)
14662+
else if((btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet)
1465314663
&& (directWpn>-1 ? (!item_disabled(directWpn) && itemsbuf[directWpn].family==itype_bugnet) : current_item(itype_bugnet)))
1465414664
{
1465514665
attackid = directWpn>-1 ? directWpn : current_item_id(itype_bugnet);
@@ -18969,11 +18979,21 @@ bool HeroClass::premove()
1896918979
do_lens();
1897018980

1897118981
bool no_jinx = true;
18972-
if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee...
18982+
bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS);
18983+
if(liftonly)
18984+
{
18985+
if(replay_version_check(38))
18986+
{
18987+
auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn);
18988+
no_jinx = checkitem_jinx(itmid);
18989+
if(no_jinx)
18990+
startwpn(itmid);
18991+
}
18992+
}
18993+
else if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee...
1897318994
{
1897418995
bool paidmagic = false;
18975-
bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS);
18976-
if(!liftonly && btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_wand : false) : current_item(itype_wand)))
18996+
if(btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_wand : false) : current_item(itype_wand)))
1897718997
{
1897818998
attackid=directWpn>-1 ? directWpn : current_item_id(itype_wand);
1897918999
no_jinx = checkitem_jinx(attackid);
@@ -18992,7 +19012,7 @@ bool HeroClass::premove()
1899219012
item_error();
1899319013
}
1899419014
}
18995-
else if(!liftonly && (btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer)
19015+
else if((btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer)
1899619016
&& (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_hammer : false) : current_item(itype_hammer)))
1899719017
{
1899819018
no_jinx = checkitem_jinx(dowpn);
@@ -19010,7 +19030,7 @@ bool HeroClass::premove()
1901019030
attackclk=0;
1901119031
}
1901219032
}
19013-
else if(!liftonly && (btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire)
19033+
else if((btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire)
1901419034
&& (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_candle : false) : current_item(itype_candle)))
1901519035
{
1901619036
//checkbunny handled where magic cost is paid
@@ -19023,7 +19043,7 @@ bool HeroClass::premove()
1902319043
attackclk=0;
1902419044
}
1902519045
}
19026-
else if(!liftonly && (btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna)
19046+
else if((btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna)
1902719047
&& (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].family==itype_cbyrna : false) : current_item(itype_cbyrna)))
1902819048
{
1902919049
attackid=directWpn>-1 ? directWpn : current_item_id(itype_cbyrna);
@@ -19043,7 +19063,7 @@ bool HeroClass::premove()
1904319063
item_error();
1904419064
}
1904519065
}
19046-
else if(!liftonly && (btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet)
19066+
else if((btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet)
1904719067
&& (directWpn>-1 ? (!item_disabled(directWpn) && itemsbuf[directWpn].family==itype_bugnet) : current_item(itype_bugnet)))
1904819068
{
1904919069
attackid = directWpn>-1 ? directWpn : current_item_id(itype_bugnet);

src/zc/replay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct ReplayStep;
3131

3232
static const int ASSERT_SNAPSHOT_BUFFER = 10;
3333
static const int ASSERT_FAILED_EXIT_CODE = 120;
34-
static const int VERSION = 37;
34+
static const int VERSION = 38;
3535

3636
static const std::string ANNOTATION_MARKER = "«";
3737
static const char TypeMeta = 'M';

0 commit comments

Comments
 (0)