Permalink
Browse files

mod: fix airstrike bomb orientation

  • Loading branch information...
Aranud committed Feb 8, 2019
1 parent b858d3d commit a22899c23ebd8eb8597083ad5317ee0cbd869519
Showing with 17 additions and 18 deletions.
  1. +1 −9 src/cgame/cg_ents.c
  2. +16 −9 src/game/g_weapon.c
@@ -994,12 +994,6 @@ static void CG_Missile(centity_t *cent)
}
weapon = &cg_weapons[s1->weapon];

Com_Printf("%s\n", GetWeaponTableData(s1->weapon)->weapFile);
Com_Printf("lerpAngles: %f %f %f\n", cent->lerpAngles[0], cent->lerpAngles[1], cent->lerpAngles[2]);

// calculate the axis
//VectorCopy(s1->angles, cent->lerpAngles);

if (s1->weapon == WP_SMOKE_BOMB)
{
// the smoke effect
@@ -1221,7 +1215,7 @@ static void CG_Missile(centity_t *cent)
ent.axis[0][2] = 1;
}
}
else if (cent->currentState.weapon != WP_SHELL)
else if (cent->lerpAngles[0] == 0.f && cent->lerpAngles[1] == 0.f && cent->lerpAngles[2] == 0.f)
{
// FIXME: anything to do/save for edv?
if (VectorNormalize2(s1->pos.trDelta, ent.axis[0]) == 0.f)
@@ -1230,8 +1224,6 @@ static void CG_Missile(centity_t *cent)
}
}

//AxisToAngles(ent.axis, cent->lerpAngles);

// spin as it moves
if (s1->pos.trType != TR_STATIONARY)
{
@@ -2622,7 +2622,19 @@ void G_AirStrikeThink(gentity_t *ent)
VectorAdd(ent->r.currentOrigin, bomboffset, bomboffset);

VectorCopy(ent->r.currentAngles, angle);
angle[1] += crandom() * 90;

angle[0] += 10 + crandom();
if (angle[0] >= 360)
{
angle[0] -= 360;
}
else if (angle[0] < 0)
{
angle[0] += 360;
}

// drop the bomb horizontaly
angle[1] += 90 + crandom();
if (angle[1] >= 360)
{
angle[1] -= 360;
@@ -2631,15 +2643,10 @@ void G_AirStrikeThink(gentity_t *ent)
{
angle[1] += 360;
}

angle[2] += -10;

// TODO: rework bomb orientation

bomb = fire_missile(ent, bomboffset, tv(0, 0, -750.f), ent->s.weapon);

Com_Printf("----> Angles: %f %f %f\n", ent->r.currentAngles[0], ent->r.currentAngles[1], ent->r.currentAngles[2]);

bomb->s.apos.trType = TR_GRAVITY;
bomb->s.apos.trType = TR_LINEAR;
bomb->s.apos.trTime = level.time;

VectorCopy(angle, bomb->r.currentAngles);
@@ -2881,7 +2888,7 @@ void artillerySpotterThink(gentity_t *ent)
bomboffset[2] = 0;
VectorAdd(bomboffset, ent->s.pos.trBase, bomboffset);

bomb = fire_missile(ent->parent ? ent->parent : ent, bomboffset, tv(0.f, 0.f, -1650.f), ent->s.weapon); // 1650 like mortar
bomb = fire_missile(ent->parent ? ent->parent : ent, bomboffset, tv(0.f, 0.f, -750.f), ent->s.weapon);

bomb->nextthink += 1950; // overwrite, add delay between 1st bomb and 2nd one
bomb->splashDamage = 90; // overwrite

0 comments on commit a22899c

Please sign in to comment.