Skip to content

Commit

Permalink
Enforce Weapon Pitch Limits + Fix Weapon "Unlatching" (#3821)
Browse files Browse the repository at this point in the history
  • Loading branch information
DARwins1 committed May 31, 2024
1 parent ce99946 commit ce00145
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
2 changes: 0 additions & 2 deletions data/base/stats/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -2957,8 +2957,6 @@
"lightWorld": 1,
"longHit": 80,
"longRange": 12032,
"maxElevation": 90,
"minElevation": -30,
"minRange": 512,
"minimumDamage": 33,
"missGfx": "FXMExp.PIE",
Expand Down
2 changes: 0 additions & 2 deletions data/mods/campaign/wz2100_camclassic/stats/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -2289,8 +2289,6 @@
"lightWorld": 1,
"longHit": 80,
"longRange": 12000,
"maxElevation": 90,
"minElevation": -30,
"minRange": 512,
"minimumDamage": 33,
"missGfx": "FXMExp.PIE",
Expand Down
4 changes: 0 additions & 4 deletions data/mp/stats/weapons.json
Original file line number Diff line number Diff line change
Expand Up @@ -3183,8 +3183,6 @@
"lightWorld": 1,
"longHit": 65,
"longRange": 1920,
"maxElevation": 90,
"minElevation": -30,
"minRange": 256,
"minimumDamage": 33,
"missGfx": "FXMExp.PIE",
Expand Down Expand Up @@ -4100,8 +4098,6 @@
"lightWorld": 1,
"longHit": 55,
"longRange": 1280,
"maxElevation": 90,
"minElevation": -60,
"minRange": 128,
"minimumDamage": 33,
"missGfx": "FXMNExp.PIE",
Expand Down
5 changes: 3 additions & 2 deletions src/projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,16 @@ static PROJECTILE* proj_SendProjectileAngledInternal(WEAPON* psWeap, SIMPLE_OBJE
proj.state = PROJ_INFLIGHT;

// If droid or structure, set muzzle pitch.
// Don't allow pitching the muzzle above outside the weapon's limits.
if (psAttacker != nullptr && weapon_slot >= 0)
{
if (psAttacker->type == OBJ_DROID)
{
((DROID *)psAttacker)->asWeaps[weapon_slot].rot.pitch = proj.rot.pitch;
((DROID *)psAttacker)->asWeaps[weapon_slot].rot.pitch = (uint16_t)clip(angleDelta(proj.rot.pitch), (int32_t)DEG(psStats->minElevation), (int32_t)DEG(psStats->maxElevation));
}
else if (psAttacker->type == OBJ_STRUCTURE)
{
((STRUCTURE *)psAttacker)->asWeaps[weapon_slot].rot.pitch = proj.rot.pitch;
((STRUCTURE *)psAttacker)->asWeaps[weapon_slot].rot.pitch = (uint16_t)clip(angleDelta(proj.rot.pitch), (int32_t)DEG(psStats->minElevation), (int32_t)DEG(psStats->maxElevation));
}
}

Expand Down

0 comments on commit ce00145

Please sign in to comment.