Skip to content

Commit 58d3d00

Browse files
committed
Fix lifting/jumping interactions
1 parent a4298b4 commit 58d3d00

File tree

1 file changed

+43
-25
lines changed

1 file changed

+43
-25
lines changed

src/zc/hero.cpp

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,45 +2997,61 @@ void HeroClass::draw(BITMAP* dest)
29972997

29982998
void HeroClass::masked_draw(BITMAP* dest)
29992999
{
3000-
if(isdungeon() && currscr<128 && (x<16 || x>224 || y<18 || y>146) && !get_bit(quest_rules,qr_FREEFORM))
3001-
{
3002-
// clip under doorways
3003-
BITMAP *sub=create_sub_bitmap(dest,16,playing_field_offset+16,224,144);
3004-
3005-
if(sub!=NULL)
3006-
{
3007-
yofs -= (playing_field_offset+16);
3008-
xofs -= 16;
3009-
sprite::draw(sub);
3000+
zfix lz, lfz;
3001+
if(lift_wpn)
3002+
{
3003+
lz = lift_wpn->z;
3004+
lfz = lift_wpn->fakez;
3005+
}
3006+
3007+
if(isdungeon() && currscr<128 && (x<16 || x>224 || y<18 || y>146) && !get_bit(quest_rules,qr_FREEFORM))
3008+
{
3009+
// clip under doorways
3010+
BITMAP *sub=create_sub_bitmap(dest,16,playing_field_offset+16,224,144);
3011+
3012+
if(sub!=NULL)
3013+
{
3014+
yofs -= (playing_field_offset+16);
3015+
xofs -= 16;
3016+
sprite::draw(sub);
30103017
if(lift_wpn)
30113018
{
30123019
handle_lift(false);
30133020
bool shad = lift_wpn->has_shadow;
30143021
lift_wpn->has_shadow = false;
3022+
lift_wpn->z += z;
3023+
lift_wpn->fakez += fakez;
30153024
lift_wpn->draw(sub);
30163025
lift_wpn->has_shadow = shad;
30173026
}
30183027
prompt_draw(sub);
3019-
xofs+=16;
3020-
yofs += (playing_field_offset+16);
3021-
destroy_bitmap(sub);
3022-
}
3023-
}
3024-
else
3025-
{
3026-
sprite::draw(dest);
3028+
xofs+=16;
3029+
yofs += (playing_field_offset+16);
3030+
destroy_bitmap(sub);
3031+
}
3032+
}
3033+
else
3034+
{
3035+
sprite::draw(dest);
30273036
if(lift_wpn)
30283037
{
30293038
handle_lift(false);
30303039
bool shad = lift_wpn->has_shadow;
30313040
lift_wpn->has_shadow = false;
3041+
lift_wpn->z += z;
3042+
lift_wpn->fakez += fakez;
30323043
lift_wpn->draw(dest);
30333044
lift_wpn->has_shadow = shad;
30343045
}
30353046
prompt_draw(dest);
3036-
}
3037-
3038-
return;
3047+
}
3048+
3049+
if(lift_wpn)
3050+
{
3051+
lift_wpn->z = lz;
3052+
lift_wpn->fakez = lfz;
3053+
}
3054+
return;
30393055
}
30403056
void HeroClass::prompt_draw(BITMAP* dest)
30413057
{
@@ -10227,12 +10243,13 @@ void HeroClass::drop_liftwpn()
1022710243
handle_lift(false); //sets position properly, accounting for large weapons
1022810244
auto liftid = current_item_id(itype_liftglove,true,true);
1022910245
itemdata const& glove = itemsbuf[liftid];
10246+
auto lheight = liftheight+z+fakez;
1023010247
if(glove.flags & ITEM_FLAG1)
1023110248
{
1023210249
lift_wpn->z = 0;
10233-
lift_wpn->fakez = liftheight;
10250+
lift_wpn->fakez = lheight;
1023410251
}
10235-
else lift_wpn->z = liftheight;
10252+
else lift_wpn->z = lheight;
1023610253
lift_wpn->dir = dir;
1023710254
lift_wpn->step = 0;
1023810255
lift_wpn->fakefall = 0;
@@ -10308,12 +10325,13 @@ void HeroClass::do_liftglove(int32_t liftid, bool passive)
1030810325
//Throw the weapon!
1030910326
//hero's direction and position
1031010327
handle_lift(false); //sets position properly, accounting for large weapons
10328+
auto lheight = liftheight+z+fakez;
1031110329
if(glove.flags & ITEM_FLAG1)
1031210330
{
1031310331
lift_wpn->z = 0;
10314-
lift_wpn->fakez = liftheight;
10332+
lift_wpn->fakez = lheight;
1031510333
}
10316-
else lift_wpn->z = liftheight;
10334+
else lift_wpn->z = lheight;
1031710335
lift_wpn->dir = dir;
1031810336
//Configured throw speed in both axes
1031910337
lift_wpn->step = zfix(glove.misc2)/100;

0 commit comments

Comments
 (0)