Skip to content

Commit addd8ac

Browse files
committed
Lifting bombs stuff
1 parent 530f7c6 commit addd8ac

File tree

7 files changed

+212
-69
lines changed

7 files changed

+212
-69
lines changed

src/base/zdefs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ enum {ENC_METHOD_192B104=0, ENC_METHOD_192B105, ENC_METHOD_192B185, ENC_METHOD_2
305305
#define V_SFX 8
306306
#define V_FAVORITES 3
307307

308-
#define V_COMPATRULE 41
308+
#define V_COMPATRULE 42
309309
#define V_ZINFO 3
310310

311311
//= V_SHOPS is under V_MISC
@@ -1126,7 +1126,7 @@ enum
11261126
qr_OLD_FFC_FUNCTIONALITY = 50*8, qr_OLD_SHALLOW_SFX, qr_BUGGED_LAYERED_FLAGS, qr_HARDCODED_FFC_BUSH_DROPS,
11271127
qr_POUNDLAYERS1AND2, qr_MOVINGBLOCK_FAKE_SOLID, qr_NEW_HERO_MOVEMENT2, qr_CARRYABLE_NO_ACROSS_SCREEN,
11281128
//51
1129-
qr_NO_SCROLL_WHILE_CARRYING, qr_HELD_BOMBS_EXPLODE,
1129+
qr_NO_SCROLL_WHILE_CARRYING, qr_HELD_BOMBS_EXPLODE, qr_BROKEN_MOVING_BOMBS,
11301130
//60
11311131
//70
11321132

src/dialog/itemeditor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,11 @@ void loadinfo(ItemNameInfo * inf, itemdata const& ref)
408408
inf->misc[0] = "Fuse Duration (0 = Remote):";
409409
inf->misc[1] = "Max. On Screen:";
410410
inf->misc[2] = "Damage to Player:";
411+
_SET(misc[3], "Lift Level", "If 0, the weapon is not liftable. Otherwise, liftable using Lift Gloves of at least this level.");
412+
_SET(misc[4], "Lift Height", "The Z height above the player's head to lift the weapon.");
411413
inf->flag[1] = "Explosion Hurts Player";
414+
_SET(flag[2], "Stops Movement on Landing", "If the weapon lands due to gravity, it's step will be set to 0.");
415+
_SET(flag[3], "Auto-Lift", "If the player owns a Lift Glove, place the bomb directly in the player's hands.");
412416
inf->wpn[0] = "Bomb Sprite:";
413417
inf->wpn[1] = "Explosion Sprite:";
414418
inf->actionsnd[0] = "Explosion Sound:";
@@ -420,8 +424,13 @@ void loadinfo(ItemNameInfo * inf, itemdata const& ref)
420424
inf->misc[0] = "Fuse Duration (0 = Remote):";
421425
inf->misc[1] = "Max. On Screen:";
422426
inf->misc[2] = "Damage to Player:";
427+
_SET(misc[3], "Lift Level", "If 0, the weapon is not liftable. Otherwise, liftable using Lift Gloves of at least this level.");
428+
_SET(misc[4], "Lift Time", "The time, in frames, to lift the weapon above the player's head.");
429+
_SET(misc[5], "Lift Height", "The Z height above the player's head to lift the weapon.");
423430
inf->flag[0] = "Use 1.92 Timing";
424431
inf->flag[1] = "Explosion Hurts Player";
432+
_SET(flag[2], "Stops Movement on Landing", "If the weapon lands due to gravity, it's step will be set to 0.");
433+
_SET(flag[3], "Auto-Lift", "If the player owns a Lift Glove, place the bomb directly in the player's hands.");
425434
inf->wpn[0] = "Bomb Sprite:";
426435
inf->wpn[1] = "Explosion Sprite:";
427436
inf->actionsnd[0] = "Explosion Sound:";

src/dialog/quest_rules.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,10 @@ static GUI::ListData compatRulesList
879879
{ "Broken ->HitBY UIDs", qr_BROKENHITBY,
880880
"If enabled, ->HitBy[HIT_BY_(thing)_UID] will use the real engine uid instead of the script uid,"
881881
" and both Player fire and bomb weapons won't work with HitBy if they hurt the player."
882-
" Note that you can access the real engine uid with ->HitBy[HIT_BY_(thing)_ENGINE_UID] regardless of this rule."}
882+
" Note that you can access the real engine uid with ->HitBy[HIT_BY_(thing)_ENGINE_UID] regardless of this rule."},
883+
{ "Broken Moving & Air Bombs", qr_BROKEN_MOVING_BOMBS,
884+
"If enabled, bombs exploding while moving will behave oddly and broken, and bomb explosions"
885+
" will continue obeying gravity." }
883886
};
884887

885888
static GUI::ListData enemiesRulesList

src/qst.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,6 +3622,8 @@ int32_t readrules(PACKFILE *f, zquestheader *Header, bool keepdata)
36223622
set_bit(quest_rules,qr_MOVINGBLOCK_FAKE_SOLID,1);
36233623
if(compatrule_version < 41)
36243624
set_bit(quest_rules,qr_BROKENHITBY,1);
3625+
if(compatrule_version < 42)
3626+
set_bit(quest_rules,qr_BROKEN_MOVING_BOMBS,1);
36253627

36263628
set_bit(quest_rules,qr_ANIMATECUSTOMWEAPONS,0);
36273629
if (s_version < 16)

src/weapons.cpp

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,18 @@ weapon::weapon(zfix X,zfix Y,zfix Z,int32_t Id,int32_t Type,int32_t pow,int32_t
13061306
case wThrown:
13071307
misc_wflags = WFLAG_BREAK_WHEN_LANDING;
13081308
break;
1309+
case wLitBomb:
1310+
case wLitSBomb:
1311+
if(parentitem>=0)
1312+
{
1313+
itemdata const& parent = itemsbuf[parentitem];
1314+
if((parent.family==itype_bomb || parent.family==itype_sbomb)
1315+
&& (parent.flags&ITEM_FLAG3))
1316+
{
1317+
misc_wflags |= WFLAG_STOP_WHEN_LANDING;
1318+
}
1319+
}
1320+
break;
13091321
}
13101322

13111323

@@ -3430,15 +3442,19 @@ void weapon::limited_animate()
34303442
if(!misc)
34313443
break;
34323444

3433-
if(clk==(misc-2) && step==0)
3445+
bool fixboom = !get_bit(quest_rules,qr_BROKEN_MOVING_BOMBS);
3446+
bool canboom = (fixboom || step==0);
3447+
if(clk==(misc-2) && canboom)
34343448
{
34353449
id = (id>wEnemyWeapons ? (id==ewLitSBomb||id==ewSBomb ? ewSBomb : ewBomb)
34363450
: parentitem>-1 ? ((itemsbuf[parentitem].family==itype_sbomb) ? wSBomb:wBomb)
34373451
: (id==wLitSBomb||id==wSBomb ? wSBomb : wBomb));
34383452
hxofs=2000;
3453+
step = 0;
3454+
if(fixboom) moveflags &= ~FLAG_OBEYS_GRAV;
34393455
}
34403456

3441-
if(clk==(misc-1) && step==0)
3457+
if(clk==(misc-1) && canboom)
34423458
{
34433459
sfx((id>=wEnemyWeapons || parentitem<0) ? WAV_BOMB :
34443460
itemsbuf[parentitem].usesound,pan(int32_t(x)));
@@ -3456,14 +3472,19 @@ void weapon::limited_animate()
34563472
usedefence = usedefencedummy;
34573473
useweapon = useweapondummy;
34583474
hzsz=16;
3475+
step = 0;
3476+
if(fixboom) moveflags &= ~FLAG_OBEYS_GRAV;
34593477
}
34603478

34613479
int32_t boomend = (misc+(((id == wBomb || id == wSBomb || id == wLitBomb || id == wLitSBomb) &&
34623480
(parentitem>-1 && itemsbuf[parentitem].flags & ITEM_FLAG1)) ? 35 : 31));
34633481

3464-
if(clk==boomend && step==0)
3482+
if(clk==boomend && canboom)
3483+
{
34653484
hxofs=2000;
3466-
3485+
step = 0;
3486+
if(fixboom) moveflags &= ~FLAG_OBEYS_GRAV;
3487+
}
34673488
if(id<wEnemyWeapons)
34683489
{
34693490
if(clk==(misc-1))
@@ -3543,7 +3564,7 @@ void weapon::limited_animate()
35433564

35443565
if(clk==misc+34)
35453566
{
3546-
if(step==0)
3567+
if(canboom)
35473568
{
35483569
dead=1;
35493570
}
@@ -3892,6 +3913,8 @@ bool weapon::animate(int32_t index)
38923913

38933914
if(misc_wflags & WFLAG_BREAK_WHEN_LANDING) //Die
38943915
dead = 0;
3916+
if(misc_wflags & WFLAG_STOP_WHEN_LANDING) //Stop movement
3917+
step = 0;
38953918
}
38963919

38973920
if(y>192) dead=0; // Out of bounds
@@ -3906,8 +3929,13 @@ bool weapon::animate(int32_t index)
39063929
if(fakez <= 0)
39073930
{
39083931
fakez = fakefall = 0;
3909-
if(didfall && (misc_wflags & WFLAG_BREAK_WHEN_LANDING)) //Die
3910-
dead = 0;
3932+
if(didfall)
3933+
{
3934+
if(misc_wflags & WFLAG_BREAK_WHEN_LANDING) //Die
3935+
dead = 0;
3936+
if(misc_wflags & WFLAG_STOP_WHEN_LANDING) //Stop movement
3937+
step = 0;
3938+
}
39113939
}
39123940
else if(fakefall <= (int32_t)zinit.terminalv)
39133941
{
@@ -3922,8 +3950,13 @@ bool weapon::animate(int32_t index)
39223950
if(z <= 0)
39233951
{
39243952
z = fall = 0;
3925-
if(didfall && (misc_wflags & WFLAG_BREAK_WHEN_LANDING)) //Die
3926-
dead = 0;
3953+
if(didfall)
3954+
{
3955+
if(misc_wflags & WFLAG_BREAK_WHEN_LANDING) //Die
3956+
dead = 0;
3957+
if(misc_wflags & WFLAG_STOP_WHEN_LANDING) //Stop movement
3958+
step = 0;
3959+
}
39273960
}
39283961
else if(fall <= (int32_t)zinit.terminalv)
39293962
{

src/weapons.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extern byte bszboomflip[4];
4343
#define WFLAG_BURN_STRONGFIRE 0x10
4444
#define WFLAG_BURN_MAGICFIRE 0x20
4545
#define WFLAG_BURN_DIVINEFIRE 0x40
46+
#define WFLAG_STOP_WHEN_LANDING 0x80
4647

4748
#define WFLAG_MAX 6
4849

0 commit comments

Comments
 (0)