mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2024-11-14 08:31:04 +00:00
More formatting changes to misc_actor code in default missionpack and Lazarus DLLs.
Added support for LMSP plasma rifle to misc_actor in missionpack DLL.
This commit is contained in:
parent
b4a509243d
commit
054d9522ec
10 changed files with 204 additions and 117 deletions
|
@ -353,19 +353,19 @@ void blaster_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
|
|||
}
|
||||
else
|
||||
{
|
||||
if (self->style == BLASTER_GREEN) //green
|
||||
if (self->style == BLASTER_GREEN) // green
|
||||
tempevent = TE_BLASTER2;
|
||||
else if (self->style == BLASTER_BLUE) //blue
|
||||
else if (self->style == BLASTER_BLUE) // blue
|
||||
#ifdef KMQUAKE2_ENGINE_MOD // Knightmare- looks better than flechette
|
||||
tempevent = TE_BLUEHYPERBLASTER;
|
||||
#else
|
||||
tempevent = TE_FLECHETTE;
|
||||
#endif
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (self->style == BLASTER_RED) //red
|
||||
else if (self->style == BLASTER_RED) // red
|
||||
tempevent = TE_REDBLASTER;
|
||||
#endif
|
||||
else //standard yellow
|
||||
else // standard yellow
|
||||
tempevent = TE_BLASTER;
|
||||
|
||||
gi.WriteByte (svc_temp_entity);
|
||||
|
|
|
@ -381,5 +381,5 @@ void InitLithiumVars (void)
|
|||
tech_regen_armor_always = gi.cvar("tech_regen_armor_always", "0", 0);
|
||||
tech_vampire = gi.cvar("tech_vampire", "0.5", 0);
|
||||
tech_vampiremax = gi.cvar("tech_vampiremax", "200", 0);
|
||||
// end CTF Tech stuff
|
||||
// end CTF stuff
|
||||
}
|
||||
|
|
|
@ -727,20 +727,20 @@ void actor_fire (edict_t *self)
|
|||
actorGrenadeLauncher (self);
|
||||
break;
|
||||
case 7:
|
||||
actorRocket(self);
|
||||
actorRocket (self);
|
||||
break;
|
||||
case 8:
|
||||
actorHyperblaster(self);
|
||||
actorHyperblaster (self);
|
||||
if (level.time >= self->monsterinfo.pausetime)
|
||||
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
|
||||
else
|
||||
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
|
||||
break;
|
||||
case 9:
|
||||
actorRailGun(self);
|
||||
actorRailGun (self);
|
||||
break;
|
||||
case 10:
|
||||
actorBFG(self);
|
||||
actorBFG (self);
|
||||
if (level.time >= self->monsterinfo.pausetime)
|
||||
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
|
||||
else
|
||||
|
@ -798,7 +798,7 @@ void actor_seekcover (edict_t *self)
|
|||
actor_run (self);
|
||||
return;
|
||||
}
|
||||
VectorCopy(self->mins,mins);
|
||||
VectorCopy (self->mins, mins);
|
||||
mins[2] += 18;
|
||||
if (mins[2] > 0) mins[2] = 0;
|
||||
VectorCopy (self->maxs, maxs);
|
||||
|
@ -1361,7 +1361,7 @@ void SP_misc_actor (edict_t *self)
|
|||
self->actor_weapon[0] = 0;
|
||||
self->actor_weapon[1] = -self->sounds;
|
||||
}
|
||||
else if (self->sounds < 10)
|
||||
else if (self->sounds <= 10)
|
||||
{
|
||||
self->actor_weapon[0] = self->sounds;
|
||||
self->actor_weapon[1] = 0;
|
||||
|
@ -1540,7 +1540,7 @@ void SP_misc_actor (edict_t *self)
|
|||
{
|
||||
int weapon;
|
||||
weapon = self->actor_weapon[0];
|
||||
if (weapon == 6 || weapon == 7 || weapon == 10)
|
||||
if ( (weapon == 6) || (weapon == 7) || (weapon == 10) )
|
||||
self->monsterinfo.min_range = 200;
|
||||
else
|
||||
self->monsterinfo.min_range = 0;
|
||||
|
|
|
@ -59,7 +59,7 @@ void ActorTarget (edict_t *self, vec3_t target)
|
|||
vec3_t v;
|
||||
|
||||
if (!self->enemy) {
|
||||
VectorClear(target);
|
||||
VectorClear (target);
|
||||
return;
|
||||
}
|
||||
if (self->monsterinfo.aiflags & AI_GOOD_GUY)
|
||||
|
@ -146,7 +146,7 @@ void actorBlaster (edict_t *self)
|
|||
#endif
|
||||
}
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (sk_blaster_color->value == 4) { // red
|
||||
else if ((int)sk_blaster_color->value == 4) { // red
|
||||
color = BLASTER_RED;
|
||||
effect = EF_BLASTER|EF_IONRIPPER;
|
||||
}
|
||||
|
@ -478,37 +478,38 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
float drop;
|
||||
float last_error, last_up, v_error;
|
||||
int i;
|
||||
|
||||
VectorCopy (forward, target); // save target point
|
||||
// horizontal distance to target
|
||||
x = sqrt( forward[0]*forward[0] + forward[1]*forward[1]);
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
x = sqrt( forward[0] * forward[0] + forward[1] * forward[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
// constant horizontal velocity (since grenades don't have drag)
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
// time to reach target x
|
||||
t = x/vx;
|
||||
t = x / vx;
|
||||
// in that time, grenade will drop this much:
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
forward[2] = target[2] + drop;
|
||||
// this is a good first cut, but incorrect since angle now changes, so
|
||||
// horizontal speed changes
|
||||
VectorCopy (forward, aim);
|
||||
VectorNormalize (aim);
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
t = x/vx;
|
||||
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
v_error = target[2]-y;
|
||||
last_error = 2*v_error;
|
||||
t = x / vx;
|
||||
y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
v_error = target[2] - y;
|
||||
last_error = 2 * v_error;
|
||||
for (i=0; i<10 && fabs(v_error) > 4 && fabs(v_error) < fabs(last_error); i++)
|
||||
{
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
forward[2] = target[2] + drop;
|
||||
VectorCopy (forward, aim);
|
||||
VectorNormalize (aim);
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
t = x/vx;
|
||||
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
t = x / vx;
|
||||
y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
v_error = target[2]-y;
|
||||
// If error is increasing... we can't get there from here and
|
||||
// probably shouldn't be here in the first place. Too late now...
|
||||
|
@ -536,13 +537,13 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
// OK... the aim vector hit a solid, but would the grenade actually hit?
|
||||
int contents;
|
||||
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
VectorSubtract (tr.endpos, start, dist);
|
||||
dist[2] = 0;
|
||||
x = VectorLength(dist);
|
||||
t = x/vx;
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
t = x / vx;
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
tr.endpos[2] -= drop;
|
||||
// move just a bit in the aim direction
|
||||
tr.endpos[0] += aim[0];
|
||||
|
@ -557,13 +558,13 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
tr = gi.trace(start, vec3_origin, vec3_origin, target, self, MASK_SOLID);
|
||||
if (tr.fraction < 1.0)
|
||||
{
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
VectorSubtract (tr.endpos, start, dist);
|
||||
dist[2] = 0;
|
||||
x = VectorLength(dist);
|
||||
t = x/vx;
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
t = x / vx;
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
tr.endpos[2] -= drop;
|
||||
tr.endpos[0] += aim[0];
|
||||
tr.endpos[1] += aim[1];
|
||||
|
@ -587,7 +588,7 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
|
||||
VectorCopy (self->velocity, v1);
|
||||
VectorNormalize (v1);
|
||||
delta = -monster_speed/GRENADE_VELOCITY;
|
||||
delta = -monster_speed / GRENADE_VELOCITY;
|
||||
VectorMA (aim, delta, v1, aim);
|
||||
VectorNormalize (aim);
|
||||
}
|
||||
|
@ -665,12 +666,12 @@ void actorHyperblaster (edict_t *self)
|
|||
else
|
||||
{
|
||||
// Knightmare- select color
|
||||
if (sk_hyperblaster_color->value == 2) // green
|
||||
if ((int)sk_hyperblaster_color->value == 2) // green
|
||||
color = BLASTER_GREEN;
|
||||
else if (sk_hyperblaster_color->value == 3) // blue
|
||||
else if ((int)sk_hyperblaster_color->value == 3) // blue
|
||||
color = BLASTER_BLUE;
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (sk_hyperblaster_color->value == 4) // red
|
||||
else if ((int)sk_hyperblaster_color->value == 4) // red
|
||||
color = BLASTER_RED;
|
||||
#endif
|
||||
else // standard yellow
|
||||
|
@ -683,12 +684,12 @@ void actorHyperblaster (edict_t *self)
|
|||
VectorNormalize (forward);
|
||||
if ((random() * 3) < 1)
|
||||
{
|
||||
if (sk_hyperblaster_color->value == 2) // green
|
||||
if ((int)sk_hyperblaster_color->value == 2) // green
|
||||
effect = (EF_HYPERBLASTER|EF_TRACKER);
|
||||
else if (sk_hyperblaster_color->value == 3) // blue
|
||||
else if ((int)sk_hyperblaster_color->value == 3) // blue
|
||||
effect = EF_BLUEHYPERBLASTER;
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (sk_hyperblaster_color->value == 4) // red
|
||||
else if ((int)sk_hyperblaster_color->value == 4) // red
|
||||
effect = EF_HYPERBLASTER|EF_IONRIPPER;
|
||||
#endif
|
||||
else // standard yellow
|
||||
|
|
|
@ -1145,7 +1145,7 @@ void Blaster_Fire (edict_t *ent, vec3_t g_offset, int damage, qboolean hyper, in
|
|||
else if (color == BLASTER_RED)
|
||||
muzzleflash = MZ_REDHYPERBLASTER;
|
||||
#endif
|
||||
else //standard orange
|
||||
else // standard orange
|
||||
muzzleflash = MZ_HYPERBLASTER;
|
||||
}
|
||||
else
|
||||
|
@ -1162,7 +1162,7 @@ void Blaster_Fire (edict_t *ent, vec3_t g_offset, int damage, qboolean hyper, in
|
|||
else if (color == BLASTER_RED)
|
||||
muzzleflash = MZ_REDBLASTER;
|
||||
#endif
|
||||
else //standard orange
|
||||
else // standard orange
|
||||
muzzleflash = MZ_BLASTER;
|
||||
}
|
||||
|
||||
|
|
|
@ -226,6 +226,8 @@ extern int Q_strcasecmp ( char * s1 , char * s2 ) ;
|
|||
extern int Q_strncasecmp ( char * s1 , char * s2 , size_t n ) ;
|
||||
extern int Q_stricmp ( char * s1 , char * s2 ) ;
|
||||
extern void Com_PageInMemory ( byte * buffer , int size ) ;
|
||||
extern qboolean Com_ParseColorString ( const char * s , color_t outColor ) ;
|
||||
extern int Com_ParseHexDigit ( const char c ) ;
|
||||
extern char * COM_Parse ( char * * data_p ) ;
|
||||
extern char * va ( char * format , ... ) ;
|
||||
extern void Swap_Init ( void ) ;
|
||||
|
@ -1536,6 +1538,7 @@ extern void berserk_fidget ( edict_t * self ) ;
|
|||
extern void berserk_stand ( edict_t * self ) ;
|
||||
extern void berserk_search ( edict_t * self ) ;
|
||||
extern void berserk_sight ( edict_t * self , edict_t * other ) ;
|
||||
extern void actorPlasmaRifle ( edict_t * self ) ;
|
||||
extern void actorDisintegrator ( edict_t * self ) ;
|
||||
extern void actorPlasmaBeam ( edict_t * self ) ;
|
||||
extern void actorETF_Rifle ( edict_t * self ) ;
|
||||
|
|
|
@ -226,6 +226,8 @@
|
|||
{"Q_strncasecmp", (byte *)Q_strncasecmp},
|
||||
{"Q_stricmp", (byte *)Q_stricmp},
|
||||
{"Com_PageInMemory", (byte *)Com_PageInMemory},
|
||||
{"Com_ParseColorString", (byte *)Com_ParseColorString},
|
||||
{"Com_ParseHexDigit", (byte *)Com_ParseHexDigit},
|
||||
{"COM_Parse", (byte *)COM_Parse},
|
||||
{"va", (byte *)va},
|
||||
{"Swap_Init", (byte *)Swap_Init},
|
||||
|
@ -1536,6 +1538,7 @@
|
|||
{"berserk_stand", (byte *)berserk_stand},
|
||||
{"berserk_search", (byte *)berserk_search},
|
||||
{"berserk_sight", (byte *)berserk_sight},
|
||||
{"actorPlasmaRifle", (byte *)actorPlasmaRifle},
|
||||
{"actorDisintegrator", (byte *)actorDisintegrator},
|
||||
{"actorPlasmaBeam", (byte *)actorPlasmaBeam},
|
||||
{"actorETF_Rifle", (byte *)actorETF_Rifle},
|
||||
|
|
|
@ -729,7 +729,7 @@ void actor_fire (edict_t *self)
|
|||
actorGrenadeLauncher (self);
|
||||
break;
|
||||
case 7:
|
||||
actorRocket(self);
|
||||
actorRocket (self);
|
||||
break;
|
||||
case 8:
|
||||
actorHyperblaster(self);
|
||||
|
@ -739,10 +739,10 @@ void actor_fire (edict_t *self)
|
|||
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
|
||||
break;
|
||||
case 9:
|
||||
actorRailGun(self);
|
||||
actorRailGun (self);
|
||||
break;
|
||||
case 10:
|
||||
actorBFG(self);
|
||||
actorBFG (self);
|
||||
if (level.time >= self->monsterinfo.pausetime)
|
||||
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
|
||||
else
|
||||
|
@ -752,28 +752,31 @@ void actor_fire (edict_t *self)
|
|||
actorIonripper(self);
|
||||
break;
|
||||
case 12:
|
||||
actorPhalanx(self);
|
||||
actorPhalanx (self);
|
||||
if (level.time >= self->monsterinfo.pausetime)
|
||||
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
|
||||
else
|
||||
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
|
||||
break;
|
||||
case 13:
|
||||
actorETF_Rifle(self);
|
||||
actorETF_Rifle (self);
|
||||
if (level.time >= self->monsterinfo.pausetime)
|
||||
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
|
||||
else
|
||||
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
|
||||
break;
|
||||
case 14:
|
||||
actorPlasmaBeam(self);
|
||||
actorPlasmaBeam (self);
|
||||
if (level.time >= self->monsterinfo.pausetime)
|
||||
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
|
||||
else
|
||||
self->monsterinfo.aiflags |= AI_HOLD_FRAME;
|
||||
break;
|
||||
case 15:
|
||||
actorDisintegrator(self);
|
||||
actorDisintegrator (self);
|
||||
break;
|
||||
case 16:
|
||||
actorPlasmaRifle (self);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1056,6 +1059,10 @@ void actor_attack (edict_t *self)
|
|||
self->monsterinfo.currentmove = attackmove;
|
||||
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
|
||||
break;
|
||||
case 16:
|
||||
self->monsterinfo.currentmove = attackmove;
|
||||
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1119,7 @@ qboolean actor_checkattack (edict_t *self)
|
|||
|
||||
weapon = self->actor_weapon[self->actor_current_weapon];
|
||||
// If actor has no weapon, well then of course he should not attack
|
||||
if (weapon < 1 || weapon > 15) // Knightmare- mission pack weapon support, was > 10
|
||||
if (weapon < 1 || weapon > 16) // Knightmare- mission pack weapon support, was > 10
|
||||
return false;
|
||||
|
||||
if (self->enemy->health > 0)
|
||||
|
@ -1336,6 +1343,7 @@ Ignored if health<0, unless flies=1. In that event, the initially dead actor wil
|
|||
1300 : ETF Rifle
|
||||
1400 : Plasma beam
|
||||
1500 : Disintegrator
|
||||
1600 : Plasma Rifle (LMSP)
|
||||
"style" Specifies the 0-based index of the skin the actor will use. Default=0. The valid range for style is 0 to the number of skins referenced from within the model itself minus one. What number references what skin is dependent on the individual model. If the style value +1 exceeds the number of referenced skins, skin 0 will be used. The number of available skins for all player models distributed with Lazarus are given in the ActorPak documentation.
|
||||
"target" targetname of the path_corner the actor will move to.
|
||||
"targetname" Name of the specific actor.
|
||||
|
@ -1466,7 +1474,7 @@ void SP_misc_actor (edict_t *self)
|
|||
self->actor_weapon[0] = 0;
|
||||
self->actor_weapon[1] = -self->sounds;
|
||||
}
|
||||
else if (self->sounds < 15) // Knightmare- added mission pack weapon support, was < 10
|
||||
else if (self->sounds <= 16) // Knightmare- added mission pack weapon support, was <= 10
|
||||
{
|
||||
self->actor_weapon[0] = self->sounds;
|
||||
self->actor_weapon[1] = 0;
|
||||
|
@ -1645,8 +1653,10 @@ void SP_misc_actor (edict_t *self)
|
|||
{
|
||||
int weapon;
|
||||
weapon = self->actor_weapon[0];
|
||||
if (weapon == 6 || weapon == 7 || weapon == 10 || weapon == 12) // Knightmare- added phalanx support
|
||||
if ( (weapon == 6) || (weapon == 7) || (weapon == 10) || (weapon == 12) ) // Knightmare- added phalanx support
|
||||
self->monsterinfo.min_range = 200;
|
||||
else if (weapon == 13)
|
||||
self->monsterinfo.min_range = 100; // Knightamre- min range for ETF rifle
|
||||
else
|
||||
self->monsterinfo.min_range = 0;
|
||||
}
|
||||
|
@ -2140,6 +2150,8 @@ void actor_files (void)
|
|||
case 13: Com_strcat (filename, sizeof(filename), "w_etfrifle.md2"); break;
|
||||
case 14: Com_strcat (filename, sizeof(filename), "w_plasma.md2"); break;
|
||||
case 15: Com_strcat (filename, sizeof(filename), "w_disrupt.md2"); break;
|
||||
// LMSP plasma rifle
|
||||
case 16: Com_strcat (filename, sizeof(filename), "w_plasmarifle.md2"); break;
|
||||
// end Knightmare
|
||||
default: Com_strcat (filename, sizeof(filename), "w_blaster.md2"); break;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ void actorPhalanx (edict_t *self);
|
|||
void actorETF_Rifle (edict_t *self);
|
||||
void actorPlasmaBeam (edict_t *self);
|
||||
void actorDisintegrator (edict_t *self);
|
||||
// Knightmare- LMSP Plasma Rifle
|
||||
void actorPlasmaRifle (edict_t *self);
|
||||
|
||||
// Generated by ModelEd
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void ActorTarget (edict_t *self, vec3_t target)
|
|||
|
||||
if (!self->enemy)
|
||||
{
|
||||
VectorClear(target);
|
||||
VectorClear (target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -113,11 +113,11 @@ void actorBlaster (edict_t *self)
|
|||
return;
|
||||
|
||||
// Knightmare- select color and effect
|
||||
if (sk_blaster_color->value == 2) { // green
|
||||
if ((int)sk_blaster_color->value == 2) { // green
|
||||
color = BLASTER_GREEN;
|
||||
effect = (EF_BLASTER|EF_TRACKER);
|
||||
}
|
||||
else if (sk_blaster_color->value == 3) { // blue
|
||||
else if ((int)sk_blaster_color->value == 3) { // blue
|
||||
color = BLASTER_BLUE;
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
effect = EF_BLASTER|EF_BLUEHYPERBLASTER;
|
||||
|
@ -126,7 +126,7 @@ void actorBlaster (edict_t *self)
|
|||
#endif
|
||||
}
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (sk_blaster_color->value == 4) { // red
|
||||
else if ((int)sk_blaster_color->value == 4) { // red
|
||||
color = BLASTER_RED;
|
||||
effect = EF_BLASTER|EF_IONRIPPER;
|
||||
}
|
||||
|
@ -458,37 +458,38 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
float drop;
|
||||
float last_error, last_up, v_error;
|
||||
int i;
|
||||
|
||||
VectorCopy (forward, target); // save target point
|
||||
// horizontal distance to target
|
||||
x = sqrt( forward[0]*forward[0] + forward[1]*forward[1]);
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
x = sqrt( forward[0] * forward[0] + forward[1] * forward[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
// constant horizontal velocity (since grenades don't have drag)
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
// time to reach target x
|
||||
t = x/vx;
|
||||
t = x / vx;
|
||||
// in that time, grenade will drop this much:
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
forward[2] = target[2] + drop;
|
||||
// this is a good first cut, but incorrect since angle now changes, so
|
||||
// horizontal speed changes
|
||||
VectorCopy (forward, aim);
|
||||
VectorNormalize (aim);
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
t = x/vx;
|
||||
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
v_error = target[2]-y;
|
||||
last_error = 2*v_error;
|
||||
t = x / vx;
|
||||
y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
v_error = target[2] - y;
|
||||
last_error = 2 * v_error;
|
||||
for (i=0; i<10 && fabs(v_error) > 4 && fabs(v_error) < fabs(last_error); i++)
|
||||
{
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
forward[2] = target[2] + drop;
|
||||
VectorCopy (forward, aim);
|
||||
VectorNormalize (aim);
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
t = x/vx;
|
||||
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
t = x / vx;
|
||||
y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
v_error = target[2]-y;
|
||||
// If error is increasing... we can't get there from here and
|
||||
// probably shouldn't be here in the first place. Too late now...
|
||||
|
@ -516,13 +517,13 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
// OK... the aim vector hit a solid, but would the grenade actually hit?
|
||||
int contents;
|
||||
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
VectorSubtract (tr.endpos, start, dist);
|
||||
dist[2] = 0;
|
||||
x = VectorLength(dist);
|
||||
t = x/vx;
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
t = x / vx;
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
tr.endpos[2] -= drop;
|
||||
// move just a bit in the aim direction
|
||||
tr.endpos[0] += aim[0];
|
||||
|
@ -537,13 +538,13 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
tr = gi.trace(start, vec3_origin, vec3_origin, target, self, MASK_SOLID);
|
||||
if (tr.fraction < 1.0)
|
||||
{
|
||||
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]);
|
||||
cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
|
||||
vx = GRENADE_VELOCITY * cosa;
|
||||
VectorSubtract (tr.endpos, start, dist);
|
||||
dist[2] = 0;
|
||||
x = VectorLength(dist);
|
||||
t = x/vx;
|
||||
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME);
|
||||
t = x / vx;
|
||||
drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
|
||||
tr.endpos[2] -= drop;
|
||||
tr.endpos[0] += aim[0];
|
||||
tr.endpos[1] += aim[1];
|
||||
|
@ -567,7 +568,7 @@ void actorGrenadeLauncher (edict_t *self)
|
|||
|
||||
VectorCopy (self->velocity, v1);
|
||||
VectorNormalize (v1);
|
||||
delta = -monster_speed/GRENADE_VELOCITY;
|
||||
delta = -monster_speed / GRENADE_VELOCITY;
|
||||
VectorMA (aim, delta, v1, aim);
|
||||
VectorNormalize (aim);
|
||||
}
|
||||
|
@ -646,12 +647,12 @@ void actorHyperblaster (edict_t *self)
|
|||
else
|
||||
{
|
||||
// Knightmare- select color
|
||||
if (sk_hyperblaster_color->value == 2) // green
|
||||
if ((int)sk_hyperblaster_color->value == 2) // green
|
||||
color = BLASTER_GREEN;
|
||||
else if (sk_hyperblaster_color->value == 3) // blue
|
||||
else if ((int)sk_hyperblaster_color->value == 3) // blue
|
||||
color = BLASTER_BLUE;
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (sk_hyperblaster_color->value == 4) // red
|
||||
else if ((int)sk_hyperblaster_color->value == 4) // red
|
||||
color = BLASTER_RED;
|
||||
#endif
|
||||
else // standard yellow
|
||||
|
@ -664,12 +665,12 @@ void actorHyperblaster (edict_t *self)
|
|||
VectorNormalize (forward);
|
||||
if ((random() * 3) < 1)
|
||||
{
|
||||
if (sk_hyperblaster_color->value == 2) // green
|
||||
if ((int)sk_hyperblaster_color->value == 2) // green
|
||||
effect = (EF_HYPERBLASTER|EF_TRACKER);
|
||||
else if (sk_hyperblaster_color->value == 3) // blue
|
||||
else if ((int)sk_hyperblaster_color->value == 3) // blue
|
||||
effect = EF_BLUEHYPERBLASTER;
|
||||
#ifdef KMQUAKE2_ENGINE_MOD
|
||||
else if (sk_hyperblaster_color->value == 4) // red
|
||||
else if ((int)sk_hyperblaster_color->value == 4) // red
|
||||
effect = EF_HYPERBLASTER|EF_IONRIPPER;
|
||||
#endif
|
||||
else // standard yellow
|
||||
|
@ -812,7 +813,7 @@ void actorIonripper (edict_t *self)
|
|||
vec3_t start, target;
|
||||
vec3_t forward, right, up;
|
||||
vec3_t tempang;
|
||||
int damage;
|
||||
int damage, speed;
|
||||
|
||||
if (!self->enemy || !self->enemy->inuse)
|
||||
return;
|
||||
|
@ -828,12 +829,10 @@ void actorIonripper (edict_t *self)
|
|||
|
||||
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/rippfire.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
if (self->monsterinfo.aiflags & AI_TWO_GUNS)
|
||||
damage = 40;
|
||||
else
|
||||
damage = 50;
|
||||
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 40 : 50;
|
||||
speed = (int)sk_ionripper_speed->value;
|
||||
|
||||
fire_ionripper (self, start, forward, damage, 500, EF_IONRIPPER);
|
||||
fire_ionripper (self, start, forward, damage, speed, EF_IONRIPPER);
|
||||
|
||||
if (developer->value)
|
||||
TraceAimPoint (start, target);
|
||||
|
@ -843,7 +842,7 @@ void actorIonripper (edict_t *self)
|
|||
G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start);
|
||||
VectorSubtract (target, start, forward);
|
||||
VectorNormalize (forward);
|
||||
fire_ionripper (self, start, forward, damage, 500, EF_IONRIPPER);
|
||||
fire_ionripper (self, start, forward, damage, speed, EF_IONRIPPER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -852,9 +851,9 @@ void actorPhalanx (edict_t *self)
|
|||
{
|
||||
vec3_t start, target;
|
||||
vec3_t forward, right, up;
|
||||
int damage = 80;
|
||||
float damage_radius = 120;
|
||||
int radius_damage = 120;
|
||||
int damage, speed;
|
||||
float damage_radius = 120.0f;
|
||||
int radius_damage;
|
||||
|
||||
if (!self->enemy || !self->enemy->inuse)
|
||||
return;
|
||||
|
@ -862,6 +861,10 @@ void actorPhalanx (edict_t *self)
|
|||
if (level.time >= self->monsterinfo.pausetime)
|
||||
return;
|
||||
|
||||
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 80 : 60;
|
||||
speed = (int)sk_phalanx_speed->value;
|
||||
radius_damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 90 : 120;
|
||||
|
||||
if (self->actor_gunframe == 2 || self->actor_gunframe == 3)
|
||||
{
|
||||
AngleVectors (self->s.angles, forward, right, up);
|
||||
|
@ -884,14 +887,14 @@ void actorPhalanx (edict_t *self)
|
|||
forward[YAW] -= 1.5;
|
||||
VectorNormalize (forward);
|
||||
|
||||
fire_phalanx_plasma (self, start, forward, damage, 725, damage_radius, radius_damage);
|
||||
fire_phalanx_plasma (self, start, forward, damage, speed, damage_radius, radius_damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
forward[YAW] += 1.5;
|
||||
VectorNormalize (forward);
|
||||
|
||||
fire_phalanx_plasma (self, start, forward, damage, 725, damage_radius, radius_damage);
|
||||
fire_phalanx_plasma (self, start, forward, damage, speed, damage_radius, radius_damage);
|
||||
|
||||
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/plasshot.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
|
@ -913,6 +916,7 @@ void actorETF_Rifle (edict_t *self)
|
|||
int damage;
|
||||
float damage_radius;
|
||||
int radius_damage;
|
||||
int speed;
|
||||
|
||||
if (!self->enemy || !self->enemy->inuse) {
|
||||
self->monsterinfo.pausetime = 0;
|
||||
|
@ -930,15 +934,12 @@ void actorETF_Rifle (edict_t *self)
|
|||
|
||||
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/nail1.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
if (self->monsterinfo.aiflags & AI_TWO_GUNS)
|
||||
damage = 8;
|
||||
else
|
||||
damage = 10;
|
||||
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 8 : 10;
|
||||
radius_damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 16 : 20;
|
||||
damage_radius = 100.0f;
|
||||
speed = (int)sk_etf_rifle_speed->value;
|
||||
|
||||
damage_radius = 100;
|
||||
radius_damage = 20;
|
||||
|
||||
fire_flechette (self, start, forward, damage, 1500, damage_radius, radius_damage);
|
||||
fire_flechette (self, start, forward, damage, speed, damage_radius, radius_damage);
|
||||
|
||||
if (developer->value)
|
||||
TraceAimPoint (start, target);
|
||||
|
@ -949,7 +950,7 @@ void actorETF_Rifle (edict_t *self)
|
|||
ActorTarget (self, target);
|
||||
VectorSubtract (target, start, forward);
|
||||
VectorNormalize (forward);
|
||||
fire_flechette (self, start, forward, damage, 1500, damage_radius, radius_damage);
|
||||
fire_flechette (self, start, forward, damage, speed, damage_radius, radius_damage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1006,7 @@ void actorDisintegrator (edict_t *self)
|
|||
{
|
||||
vec3_t start, target;
|
||||
vec3_t forward, right, up;
|
||||
int damage;
|
||||
int damage, speed;
|
||||
|
||||
if (!self->enemy || !self->enemy->inuse)
|
||||
return;
|
||||
|
@ -1018,12 +1019,10 @@ void actorDisintegrator (edict_t *self)
|
|||
|
||||
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/disint2.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
if (self->monsterinfo.aiflags & AI_TWO_GUNS)
|
||||
damage = 30;
|
||||
else
|
||||
damage = 40;
|
||||
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 32 : 40;
|
||||
speed = (int)sk_disruptor_speed->value;
|
||||
|
||||
fire_tracker (self, start, forward, damage, sk_disruptor_speed->value, self->enemy);
|
||||
fire_tracker (self, start, forward, damage, speed, self->enemy);
|
||||
|
||||
if (developer->value)
|
||||
TraceAimPoint (start, target);
|
||||
|
@ -1033,6 +1032,73 @@ void actorDisintegrator (edict_t *self)
|
|||
G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start);
|
||||
VectorSubtract (target, start, forward);
|
||||
VectorNormalize (forward);
|
||||
fire_tracker (self, start, forward, damage, sk_disruptor_speed->value, self->enemy);
|
||||
fire_tracker (self, start, forward, damage, speed, self->enemy);
|
||||
}
|
||||
}
|
||||
|
||||
// Plasma Rifle (LMSP)
|
||||
void actorPlasmaRifle (edict_t *self)
|
||||
{
|
||||
vec3_t start, target;
|
||||
vec3_t forward, right, up;
|
||||
vec3_t angles, offset_r, offset_l, offsetSpread;
|
||||
int damage, speed;
|
||||
float dist, spreadWidth, bboxWidth;
|
||||
qboolean spread=false;
|
||||
|
||||
if (!self->enemy || !self->enemy->inuse)
|
||||
return;
|
||||
|
||||
AngleVectors (self->s.angles, forward, right, up);
|
||||
G_ProjectSource2 (self->s.origin, self->muzzle, forward, right, up, start);
|
||||
ActorTarget (self, target);
|
||||
VectorSubtract (target, start, forward);
|
||||
dist = VectorLength (forward);
|
||||
VectorNormalize (forward);
|
||||
|
||||
// Get spread from start to target for enemies, compare against bbox size
|
||||
// Use spread mode if bbox size >= spread * 0.9
|
||||
if (self->enemy->solid == SOLID_BBOX)
|
||||
{
|
||||
vectoangles (forward, angles);
|
||||
// right spread, -10 yaw
|
||||
angles[YAW] -= 10;
|
||||
AngleVectors (angles, offset_r, NULL, NULL);
|
||||
VectorScale (offset_r, dist, offset_r);
|
||||
// left spread, +10 yaw
|
||||
angles[YAW] += 20;
|
||||
AngleVectors (angles, offset_l, NULL, NULL);
|
||||
VectorScale (offset_l, dist, offset_l);
|
||||
// Get distance between spread points at target range
|
||||
VectorSubtract (offset_l, offset_r, offsetSpread);
|
||||
spreadWidth = VectorLength (offsetSpread);
|
||||
// Compare to enemy bbox size
|
||||
bboxWidth = self->enemy->maxs[0] - self->enemy->mins[0];
|
||||
if (bboxWidth >= (spreadWidth * 0.9f))
|
||||
spread = true;
|
||||
}
|
||||
|
||||
if (spread) {
|
||||
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 34 : 43;
|
||||
speed = (int)sk_plasma_rifle_speed_spread->value;
|
||||
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex(PLASMA_SOUND_FIRE2), 1, ATTN_NORM, 0);
|
||||
}
|
||||
else {
|
||||
damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 48: 60;
|
||||
speed = (int)sk_plasma_rifle_speed_bounce->value;
|
||||
gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex(PLASMA_SOUND_FIRE1), 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
||||
fire_plasma_rifle (self, start, forward, damage, speed, spread);
|
||||
|
||||
if (developer->value)
|
||||
TraceAimPoint (start, target);
|
||||
|
||||
if (self->monsterinfo.aiflags & AI_TWO_GUNS)
|
||||
{
|
||||
G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start);
|
||||
VectorSubtract (target, start, forward);
|
||||
VectorNormalize (forward);
|
||||
fire_plasma_rifle (self, start, forward, damage, speed, spread);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue