What they do and how they do it
g_missile.c
In the missile functions you'll see nearly the same code for each one, which determines how the missiles react, so lets see what all those lines really mean:-
bolt = G_Spawn(); create the missile
bolt->classname = "rocket"; the missile name
bolt->nextthink = level.time + 10000; how long the missle stays before exploding
bolt->think = G_ExplodeMissile; tells it to explode
bolt->s.eType = ET_MISSILE; what to explode
bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
bolt->s.weapon = WP_ROCKET_LAUNCHER; where is the missile being fired from
bolt->r.ownerNum = self->s.number; who is firing the missile
bolt->parent = self;
bolt->damage = 100; how much damage on direct hit
bolt->splashDamage = 100; how much damage if hit by splash radius
bolt->splashRadius = 60; how big the splash radius is
bolt->methodOfDeath = MOD_ROCKET; message shown on death by weapon type
bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH; death message for splash damage
bolt->clipmask = MASK_SHOT;
bolt->s.pos.trType = TR_LINEAR; trajectory of the missile (see grenade tutorial)
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME;
// move a bit on the very first frame
VectorCopy( start, bolt->s.pos.trBase );
VectorScale( dir, 2000, bolt->s.pos.trDelta ); how fast the missle will travel once fired
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
VectorCopy (start, bolt->r.currentOrigin);
return bolt;
}
So you can have a play around with your rocket effects now :) |