Permalink
Browse files

mod: WIP work shell orientation

  • Loading branch information...
Aranud committed Feb 8, 2019
1 parent 776c2ba commit b858d3d0850a578c38d213765fbf66dac4b31ad3
Showing with 44 additions and 17 deletions.
  1. +14 −11 src/cgame/cg_ents.c
  2. +5 −1 src/game/g_missile.c
  3. +25 −5 src/game/g_weapon.c
@@ -994,8 +994,11 @@ 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);
//VectorCopy(s1->angles, cent->lerpAngles);

if (s1->weapon == WP_SMOKE_BOMB)
{
@@ -1082,6 +1085,7 @@ static void CG_Missile(centity_t *cent)
Com_Memset(&ent, 0, sizeof(ent));
VectorCopy(cent->lerpOrigin, ent.origin);
VectorCopy(cent->lerpOrigin, ent.oldorigin);
AnglesToAxis(cent->lerpAngles, ent.axis);

// flicker between two skins
ent.skinNum = cg.clientFrame & 1;
@@ -1217,7 +1221,7 @@ static void CG_Missile(centity_t *cent)
ent.axis[0][2] = 1;
}
}
else
else if (cent->currentState.weapon != WP_SHELL)
{
// FIXME: anything to do/save for edv?
if (VectorNormalize2(s1->pos.trDelta, ent.axis[0]) == 0.f)
@@ -1226,7 +1230,7 @@ static void CG_Missile(centity_t *cent)
}
}

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

// spin as it moves
if (s1->pos.trType != TR_STATIONARY)
@@ -1679,22 +1683,21 @@ void CG_MovePlane(centity_t *cent)
// fade effect
if (cent->currentState.time)
{
ent.shaderRGBA[3] = (byte)(255.f * (float)(cent->currentState.time2 - cg.time) / (float)(cent->currentState.time2 - cent->currentState.time));
ent.shaderRGBA[3] = (byte)(255.f * (float)(cent->currentState.time2 - cg.time) / (float)(cent->currentState.time2 - cent->currentState.time));
}
else
{
ent.shaderRGBA[3] = 255;
}
else
{
ent.shaderRGBA[3] = 255;
}

// model
// explicit shader to apply fade effect
if (cent->currentState.teamNum == TEAM_AXIS)
{
ent.hModel = cgs.media.airstrikePlane[0];
ent.hModel = cgs.media.airstrikePlane[0];
}
else
{
ent.hModel = cgs.media.airstrikePlane[1];
ent.hModel = cgs.media.airstrikePlane[1];
}

// add to refresh list
@@ -468,7 +468,7 @@ void Landmine_Check_Ground(gentity_t *self)
*/
void G_RunMissile(gentity_t *ent)
{
vec3_t origin;
vec3_t origin, angle;
trace_t tr;

// shootable ent (i.e landmine, dynamite, satchel)
@@ -488,6 +488,7 @@ void G_RunMissile(gentity_t *ent)

// get current position
BG_EvaluateTrajectory(&ent->s.pos, level.time, origin, qfalse, ent->s.effect2Time);
BG_EvaluateTrajectory(&ent->s.apos, level.time, angle, qtrue, ent->s.effect2Time);

// ignore body
if ((ent->clipmask & CONTENTS_BODY) && ((GetWeaponTableData(ent->s.weapon)->firingMode & WEAPON_FIRING_MODE_THROWABLE) || ent->s.weapon == WP_ARTY || ent->s.weapon == WP_SHELL))
@@ -545,6 +546,7 @@ void G_RunMissile(gentity_t *ent)
{
G_RunThink(ent);
VectorCopy(origin, ent->r.currentOrigin); // keep the previous origin to don't go too far
VectorCopy(angle, ent->r.currentAngles);

return; // keep flying
}
@@ -558,6 +560,7 @@ void G_RunMissile(gentity_t *ent)

// back in the world, keep going like normal
VectorCopy(origin, ent->r.currentOrigin);
VectorCopy(angle, ent->r.currentAngles);
ent->count = 0;
ent->count2 = 1;
}
@@ -619,6 +622,7 @@ void G_RunMissile(gentity_t *ent)
}

VectorCopy(tr.endpos, ent->r.currentOrigin);
VectorCopy(angle, ent->r.currentAngles);

if (tr.startsolid)
{
@@ -2614,16 +2614,36 @@ void G_AirStrikeThink(gentity_t *ent)
if (ent->active)
{
gentity_t *bomb;
vec3_t bomboffset;
vec3_t bomboffset, angle;

bomboffset[0] = crandom() * .5f * BOMBSPREAD;
bomboffset[1] = crandom() * .5f * BOMBSPREAD;
bomboffset[2] = 0.f;
VectorAdd(ent->r.currentOrigin, bomboffset, bomboffset);
bomboffset[2] = BG_GetGroundHeightAtPoint(bomboffset);

VectorCopy(ent->r.currentAngles, angle);
angle[1] += crandom() * 90;
if (angle[1] >= 360)
{
angle[1] -= 360;
}
else if (angle[1] < 0)
{
angle[1] += 360;
}

angle[2] += -10;

// TODO: rework bomb orientation
bomb = fire_missile(ent, ent->r.currentOrigin, tv(-1, -1, -1) /*bomboffset*/, ent->s.weapon);
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.trTime = level.time;

VectorCopy(angle, bomb->r.currentAngles);
VectorCopy(angle, bomb->s.apos.trBase);
}

ent->nextthink = (int)(level.time + 100 + crandom() * 50);
@@ -2861,7 +2881,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, -1.f), ent->s.weapon);
bomb = fire_missile(ent->parent ? ent->parent : ent, bomboffset, tv(0.f, 0.f, -1650.f), ent->s.weapon); // 1650 like mortar

bomb->nextthink += 1950; // overwrite, add delay between 1st bomb and 2nd one
bomb->splashDamage = 90; // overwrite
@@ -2878,7 +2898,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, -1.f), ent->s.weapon);
bomb = fire_missile(ent->parent ? ent->parent : ent, bomboffset, tv(0.f, 0.f, -1650.f), ent->s.weapon);
}

// next bomb drop, add randomness

0 comments on commit b858d3d

Please sign in to comment.