Jump to content

Home

missle


XSeth2kX

Recommended Posts

////// Mod //////

void G_HomingMissile( gentity_t *ent )

{

gentity_t *target = NULL;

gentity_t *blip = NULL;

vec3_t dir, blipdir, temp_dir;

 

while ((blip = findradius(blip, ent->r.currentOrigin, 2000)) != NULL) {

if (blip->client==NULL) continue;

if (blip==ent->parent) continue;

if (blip->health<=0) continue;

if (blip->client->sess.sessionTeam == TEAM_SPECTATOR)

continue;

 

if ((g_gametype.integer == GT_TEAM || g_gametype.integer == GT_CTF) &&

blip->client->sess.sessionTeam == ent->parent->client->sess.sessionTeam)

continue;

 

if (!visible (ent, blip))

continue;

 

VectorSubtract(blip->r.currentOrigin, ent->r.currentOrigin, blipdir);

blipdir[2] += 16;

if ((target == NULL) || (VectorLength(blipdir) < VectorLength(dir)))

{

 

VectorCopy(blipdir,temp_dir);

VectorNormalize(temp_dir);

VectorAdd(temp_dir,ent->r.currentAngles,temp_dir);

 

if(VectorLength(temp_dir)>1.6)

{

 

target = blip;

VectorCopy(blipdir, dir);

}

}

}

 

if (target == NULL) {

ent->nextthink = level.time + 10000;

} else {

ent->s.pos.trTime=level.time;

VectorCopy(ent->r.currentOrigin, ent->s.pos.trBase );

VectorNormalize(dir);

VectorScale(dir, 0.3,dir);

VectorAdd(dir,ent->r.currentAngles,dir);

// this 0.3 is swing rate.this value is cheap,I think.try 0.8 or 1.5.

 

 

 

VectorScale (dir,VectorLength(ent->s.pos.trDelta)*1.1,ent->s.pos.trDelta);

 

SnapVector (ent->s.pos.trDelta); ent->nextthink = level.time + 100; //decrease this value also makes fast swing.

}

}

 

 

////// Mod //////

 

i get an error on the while ((blip = findradius(blip, ent->r.currentOrigin, 2000)) != NULL)

 

C:\Program Files\LucasArts\Star Wars JK II Jedi Outcast\GameData\code\game\g_missile.c(282) : warning C4013: 'findradius' undefined; assuming extern returning int

C:\Program Files\LucasArts\Star Wars JK II Jedi Outcast\GameData\code\game\g_missile.c(282) : warning C4047: '=' : 'struct gentity_s *' differs in levels of indirection from 'int '

C:\Program Files\LucasArts\Star Wars JK II Jedi Outcast\GameData\code\game\g_missile.c(295) : warning C4013: 'visible' undefined; assuming extern returning int

 

:tank1:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...