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:
Knightmare66 2021-11-03 18:02:54 -04:00
parent b4a509243d
commit 054d9522ec
10 changed files with 204 additions and 117 deletions

View file

@ -353,19 +353,19 @@ void blaster_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *
} }
else else
{ {
if (self->style == BLASTER_GREEN) //green if (self->style == BLASTER_GREEN) // green
tempevent = TE_BLASTER2; 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 #ifdef KMQUAKE2_ENGINE_MOD // Knightmare- looks better than flechette
tempevent = TE_BLUEHYPERBLASTER; tempevent = TE_BLUEHYPERBLASTER;
#else #else
tempevent = TE_FLECHETTE; tempevent = TE_FLECHETTE;
#endif #endif
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
else if (self->style == BLASTER_RED) //red else if (self->style == BLASTER_RED) // red
tempevent = TE_REDBLASTER; tempevent = TE_REDBLASTER;
#endif #endif
else //standard yellow else // standard yellow
tempevent = TE_BLASTER; tempevent = TE_BLASTER;
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);

View file

@ -381,5 +381,5 @@ void InitLithiumVars (void)
tech_regen_armor_always = gi.cvar("tech_regen_armor_always", "0", 0); tech_regen_armor_always = gi.cvar("tech_regen_armor_always", "0", 0);
tech_vampire = gi.cvar("tech_vampire", "0.5", 0); tech_vampire = gi.cvar("tech_vampire", "0.5", 0);
tech_vampiremax = gi.cvar("tech_vampiremax", "200", 0); tech_vampiremax = gi.cvar("tech_vampiremax", "200", 0);
// end CTF Tech stuff // end CTF stuff
} }

View file

@ -727,20 +727,20 @@ void actor_fire (edict_t *self)
actorGrenadeLauncher (self); actorGrenadeLauncher (self);
break; break;
case 7: case 7:
actorRocket(self); actorRocket (self);
break; break;
case 8: case 8:
actorHyperblaster(self); actorHyperblaster (self);
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else else
self->monsterinfo.aiflags |= AI_HOLD_FRAME; self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break; break;
case 9: case 9:
actorRailGun(self); actorRailGun (self);
break; break;
case 10: case 10:
actorBFG(self); actorBFG (self);
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else else
@ -798,7 +798,7 @@ void actor_seekcover (edict_t *self)
actor_run (self); actor_run (self);
return; return;
} }
VectorCopy(self->mins,mins); VectorCopy (self->mins, mins);
mins[2] += 18; mins[2] += 18;
if (mins[2] > 0) mins[2] = 0; if (mins[2] > 0) mins[2] = 0;
VectorCopy (self->maxs, maxs); VectorCopy (self->maxs, maxs);
@ -1361,7 +1361,7 @@ void SP_misc_actor (edict_t *self)
self->actor_weapon[0] = 0; self->actor_weapon[0] = 0;
self->actor_weapon[1] = -self->sounds; 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[0] = self->sounds;
self->actor_weapon[1] = 0; self->actor_weapon[1] = 0;
@ -1540,7 +1540,7 @@ void SP_misc_actor (edict_t *self)
{ {
int weapon; int weapon;
weapon = self->actor_weapon[0]; weapon = self->actor_weapon[0];
if (weapon == 6 || weapon == 7 || weapon == 10) if ( (weapon == 6) || (weapon == 7) || (weapon == 10) )
self->monsterinfo.min_range = 200; self->monsterinfo.min_range = 200;
else else
self->monsterinfo.min_range = 0; self->monsterinfo.min_range = 0;

View file

@ -59,7 +59,7 @@ void ActorTarget (edict_t *self, vec3_t target)
vec3_t v; vec3_t v;
if (!self->enemy) { if (!self->enemy) {
VectorClear(target); VectorClear (target);
return; return;
} }
if (self->monsterinfo.aiflags & AI_GOOD_GUY) if (self->monsterinfo.aiflags & AI_GOOD_GUY)
@ -69,9 +69,9 @@ void ActorTarget (edict_t *self, vec3_t target)
if (self->enemy->health > 0) if (self->enemy->health > 0)
{ {
int weapon; int weapon;
trace_t tr; trace_t tr;
vec3_t start; vec3_t start;
qboolean can_see=false; qboolean can_see=false;
VectorCopy(self->s.origin,start); VectorCopy(self->s.origin,start);
@ -146,7 +146,7 @@ void actorBlaster (edict_t *self)
#endif #endif
} }
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
else if (sk_blaster_color->value == 4) { // red else if ((int)sk_blaster_color->value == 4) { // red
color = BLASTER_RED; color = BLASTER_RED;
effect = EF_BLASTER|EF_IONRIPPER; effect = EF_BLASTER|EF_IONRIPPER;
} }
@ -478,37 +478,38 @@ void actorGrenadeLauncher (edict_t *self)
float drop; float drop;
float last_error, last_up, v_error; float last_error, last_up, v_error;
int i; int i;
VectorCopy (forward, target); // save target point VectorCopy (forward, target); // save target point
// horizontal distance to target // horizontal distance to target
x = sqrt( forward[0]*forward[0] + forward[1]*forward[1]); x = sqrt( forward[0] * forward[0] + forward[1] * forward[1]);
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]); cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
// constant horizontal velocity (since grenades don't have drag) // constant horizontal velocity (since grenades don't have drag)
vx = GRENADE_VELOCITY * cosa; vx = GRENADE_VELOCITY * cosa;
// time to reach target x // time to reach target x
t = x/vx; t = x / vx;
// in that time, grenade will drop this much: // 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; forward[2] = target[2] + drop;
// this is a good first cut, but incorrect since angle now changes, so // this is a good first cut, but incorrect since angle now changes, so
// horizontal speed changes // horizontal speed changes
VectorCopy (forward, aim); VectorCopy (forward, aim);
VectorNormalize (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; vx = GRENADE_VELOCITY * cosa;
t = x/vx; t = x / vx;
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME); y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
v_error = target[2]-y; v_error = target[2] - y;
last_error = 2*v_error; last_error = 2 * v_error;
for (i=0; i<10 && fabs(v_error) > 4 && fabs(v_error) < fabs(last_error); i++) 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; forward[2] = target[2] + drop;
VectorCopy (forward, aim); VectorCopy (forward, aim);
VectorNormalize (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; vx = GRENADE_VELOCITY * cosa;
t = x/vx; t = x / vx;
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME); y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
v_error = target[2]-y; v_error = target[2]-y;
// If error is increasing... we can't get there from here and // If error is increasing... we can't get there from here and
// probably shouldn't be here in the first place. Too late now... // 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? // OK... the aim vector hit a solid, but would the grenade actually hit?
int contents; 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; vx = GRENADE_VELOCITY * cosa;
VectorSubtract (tr.endpos, start, dist); VectorSubtract (tr.endpos, start, dist);
dist[2] = 0; dist[2] = 0;
x = VectorLength(dist); x = VectorLength(dist);
t = x/vx; t = x / vx;
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME); drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
tr.endpos[2] -= drop; tr.endpos[2] -= drop;
// move just a bit in the aim direction // move just a bit in the aim direction
tr.endpos[0] += aim[0]; 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); tr = gi.trace(start, vec3_origin, vec3_origin, target, self, MASK_SOLID);
if (tr.fraction < 1.0) 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; vx = GRENADE_VELOCITY * cosa;
VectorSubtract (tr.endpos, start, dist); VectorSubtract (tr.endpos, start, dist);
dist[2] = 0; dist[2] = 0;
x = VectorLength(dist); x = VectorLength(dist);
t = x/vx; t = x / vx;
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME); drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
tr.endpos[2] -= drop; tr.endpos[2] -= drop;
tr.endpos[0] += aim[0]; tr.endpos[0] += aim[0];
tr.endpos[1] += aim[1]; tr.endpos[1] += aim[1];
@ -587,7 +588,7 @@ void actorGrenadeLauncher (edict_t *self)
VectorCopy (self->velocity, v1); VectorCopy (self->velocity, v1);
VectorNormalize (v1); VectorNormalize (v1);
delta = -monster_speed/GRENADE_VELOCITY; delta = -monster_speed / GRENADE_VELOCITY;
VectorMA (aim, delta, v1, aim); VectorMA (aim, delta, v1, aim);
VectorNormalize (aim); VectorNormalize (aim);
} }
@ -665,12 +666,12 @@ void actorHyperblaster (edict_t *self)
else else
{ {
// Knightmare- select color // Knightmare- select color
if (sk_hyperblaster_color->value == 2) // green if ((int)sk_hyperblaster_color->value == 2) // green
color = BLASTER_GREEN; color = BLASTER_GREEN;
else if (sk_hyperblaster_color->value == 3) // blue else if ((int)sk_hyperblaster_color->value == 3) // blue
color = BLASTER_BLUE; color = BLASTER_BLUE;
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
else if (sk_hyperblaster_color->value == 4) // red else if ((int)sk_hyperblaster_color->value == 4) // red
color = BLASTER_RED; color = BLASTER_RED;
#endif #endif
else // standard yellow else // standard yellow
@ -683,12 +684,12 @@ void actorHyperblaster (edict_t *self)
VectorNormalize (forward); VectorNormalize (forward);
if ((random() * 3) < 1) if ((random() * 3) < 1)
{ {
if (sk_hyperblaster_color->value == 2) // green if ((int)sk_hyperblaster_color->value == 2) // green
effect = (EF_HYPERBLASTER|EF_TRACKER); 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; effect = EF_BLUEHYPERBLASTER;
#ifdef KMQUAKE2_ENGINE_MOD #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; effect = EF_HYPERBLASTER|EF_IONRIPPER;
#endif #endif
else // standard yellow else // standard yellow

View file

@ -1145,7 +1145,7 @@ void Blaster_Fire (edict_t *ent, vec3_t g_offset, int damage, qboolean hyper, in
else if (color == BLASTER_RED) else if (color == BLASTER_RED)
muzzleflash = MZ_REDHYPERBLASTER; muzzleflash = MZ_REDHYPERBLASTER;
#endif #endif
else //standard orange else // standard orange
muzzleflash = MZ_HYPERBLASTER; muzzleflash = MZ_HYPERBLASTER;
} }
else 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) else if (color == BLASTER_RED)
muzzleflash = MZ_REDBLASTER; muzzleflash = MZ_REDBLASTER;
#endif #endif
else //standard orange else // standard orange
muzzleflash = MZ_BLASTER; muzzleflash = MZ_BLASTER;
} }

View file

@ -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_strncasecmp ( char * s1 , char * s2 , size_t n ) ;
extern int Q_stricmp ( char * s1 , char * s2 ) ; extern int Q_stricmp ( char * s1 , char * s2 ) ;
extern void Com_PageInMemory ( byte * buffer , int size ) ; 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 * COM_Parse ( char * * data_p ) ;
extern char * va ( char * format , ... ) ; extern char * va ( char * format , ... ) ;
extern void Swap_Init ( void ) ; 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_stand ( edict_t * self ) ;
extern void berserk_search ( edict_t * self ) ; extern void berserk_search ( edict_t * self ) ;
extern void berserk_sight ( edict_t * self , edict_t * other ) ; extern void berserk_sight ( edict_t * self , edict_t * other ) ;
extern void actorPlasmaRifle ( edict_t * self ) ;
extern void actorDisintegrator ( edict_t * self ) ; extern void actorDisintegrator ( edict_t * self ) ;
extern void actorPlasmaBeam ( edict_t * self ) ; extern void actorPlasmaBeam ( edict_t * self ) ;
extern void actorETF_Rifle ( edict_t * self ) ; extern void actorETF_Rifle ( edict_t * self ) ;

View file

@ -226,6 +226,8 @@
{"Q_strncasecmp", (byte *)Q_strncasecmp}, {"Q_strncasecmp", (byte *)Q_strncasecmp},
{"Q_stricmp", (byte *)Q_stricmp}, {"Q_stricmp", (byte *)Q_stricmp},
{"Com_PageInMemory", (byte *)Com_PageInMemory}, {"Com_PageInMemory", (byte *)Com_PageInMemory},
{"Com_ParseColorString", (byte *)Com_ParseColorString},
{"Com_ParseHexDigit", (byte *)Com_ParseHexDigit},
{"COM_Parse", (byte *)COM_Parse}, {"COM_Parse", (byte *)COM_Parse},
{"va", (byte *)va}, {"va", (byte *)va},
{"Swap_Init", (byte *)Swap_Init}, {"Swap_Init", (byte *)Swap_Init},
@ -1536,6 +1538,7 @@
{"berserk_stand", (byte *)berserk_stand}, {"berserk_stand", (byte *)berserk_stand},
{"berserk_search", (byte *)berserk_search}, {"berserk_search", (byte *)berserk_search},
{"berserk_sight", (byte *)berserk_sight}, {"berserk_sight", (byte *)berserk_sight},
{"actorPlasmaRifle", (byte *)actorPlasmaRifle},
{"actorDisintegrator", (byte *)actorDisintegrator}, {"actorDisintegrator", (byte *)actorDisintegrator},
{"actorPlasmaBeam", (byte *)actorPlasmaBeam}, {"actorPlasmaBeam", (byte *)actorPlasmaBeam},
{"actorETF_Rifle", (byte *)actorETF_Rifle}, {"actorETF_Rifle", (byte *)actorETF_Rifle},

View file

@ -729,7 +729,7 @@ void actor_fire (edict_t *self)
actorGrenadeLauncher (self); actorGrenadeLauncher (self);
break; break;
case 7: case 7:
actorRocket(self); actorRocket (self);
break; break;
case 8: case 8:
actorHyperblaster(self); actorHyperblaster(self);
@ -739,10 +739,10 @@ void actor_fire (edict_t *self)
self->monsterinfo.aiflags |= AI_HOLD_FRAME; self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break; break;
case 9: case 9:
actorRailGun(self); actorRailGun (self);
break; break;
case 10: case 10:
actorBFG(self); actorBFG (self);
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else else
@ -752,28 +752,31 @@ void actor_fire (edict_t *self)
actorIonripper(self); actorIonripper(self);
break; break;
case 12: case 12:
actorPhalanx(self); actorPhalanx (self);
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else else
self->monsterinfo.aiflags |= AI_HOLD_FRAME; self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break; break;
case 13: case 13:
actorETF_Rifle(self); actorETF_Rifle (self);
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else else
self->monsterinfo.aiflags |= AI_HOLD_FRAME; self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break; break;
case 14: case 14:
actorPlasmaBeam(self); actorPlasmaBeam (self);
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
self->monsterinfo.aiflags &= ~AI_HOLD_FRAME; self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
else else
self->monsterinfo.aiflags |= AI_HOLD_FRAME; self->monsterinfo.aiflags |= AI_HOLD_FRAME;
break; break;
case 15: case 15:
actorDisintegrator(self); actorDisintegrator (self);
break;
case 16:
actorPlasmaRifle (self);
break; break;
} }
} }
@ -1056,6 +1059,10 @@ void actor_attack (edict_t *self)
self->monsterinfo.currentmove = attackmove; self->monsterinfo.currentmove = attackmove;
self->monsterinfo.pausetime = level.time + 10 * FRAMETIME; self->monsterinfo.pausetime = level.time + 10 * FRAMETIME;
break; 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]; weapon = self->actor_weapon[self->actor_current_weapon];
// If actor has no weapon, well then of course he should not attack // 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; return false;
if (self->enemy->health > 0) 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 1300 : ETF Rifle
1400 : Plasma beam 1400 : Plasma beam
1500 : Disintegrator 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. "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. "target" targetname of the path_corner the actor will move to.
"targetname" Name of the specific actor. "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[0] = 0;
self->actor_weapon[1] = -self->sounds; 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[0] = self->sounds;
self->actor_weapon[1] = 0; self->actor_weapon[1] = 0;
@ -1643,10 +1651,12 @@ void SP_misc_actor (edict_t *self)
self->monsterinfo.min_range = 0; self->monsterinfo.min_range = 0;
else else
{ {
int weapon; int weapon;
weapon = self->actor_weapon[0]; 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; self->monsterinfo.min_range = 200;
else if (weapon == 13)
self->monsterinfo.min_range = 100; // Knightamre- min range for ETF rifle
else else
self->monsterinfo.min_range = 0; 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 13: Com_strcat (filename, sizeof(filename), "w_etfrifle.md2"); break;
case 14: Com_strcat (filename, sizeof(filename), "w_plasma.md2"); break; case 14: Com_strcat (filename, sizeof(filename), "w_plasma.md2"); break;
case 15: Com_strcat (filename, sizeof(filename), "w_disrupt.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 // end Knightmare
default: Com_strcat (filename, sizeof(filename), "w_blaster.md2"); break; default: Com_strcat (filename, sizeof(filename), "w_blaster.md2"); break;
} }

View file

@ -17,6 +17,8 @@ void actorPhalanx (edict_t *self);
void actorETF_Rifle (edict_t *self); void actorETF_Rifle (edict_t *self);
void actorPlasmaBeam (edict_t *self); void actorPlasmaBeam (edict_t *self);
void actorDisintegrator (edict_t *self); void actorDisintegrator (edict_t *self);
// Knightmare- LMSP Plasma Rifle
void actorPlasmaRifle (edict_t *self);
// Generated by ModelEd // Generated by ModelEd

View file

@ -38,7 +38,7 @@ void ActorTarget (edict_t *self, vec3_t target)
if (!self->enemy) if (!self->enemy)
{ {
VectorClear(target); VectorClear (target);
return; return;
} }
@ -49,9 +49,9 @@ void ActorTarget (edict_t *self, vec3_t target)
if (self->enemy->health > 0) if (self->enemy->health > 0)
{ {
int weapon; int weapon;
trace_t tr; trace_t tr;
vec3_t start; vec3_t start;
qboolean can_see=false; qboolean can_see=false;
VectorCopy(self->s.origin,start); VectorCopy(self->s.origin,start);
@ -113,11 +113,11 @@ void actorBlaster (edict_t *self)
return; return;
// Knightmare- select color and effect // Knightmare- select color and effect
if (sk_blaster_color->value == 2) { // green if ((int)sk_blaster_color->value == 2) { // green
color = BLASTER_GREEN; color = BLASTER_GREEN;
effect = (EF_BLASTER|EF_TRACKER); 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; color = BLASTER_BLUE;
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
effect = EF_BLASTER|EF_BLUEHYPERBLASTER; effect = EF_BLASTER|EF_BLUEHYPERBLASTER;
@ -126,7 +126,7 @@ void actorBlaster (edict_t *self)
#endif #endif
} }
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
else if (sk_blaster_color->value == 4) { // red else if ((int)sk_blaster_color->value == 4) { // red
color = BLASTER_RED; color = BLASTER_RED;
effect = EF_BLASTER|EF_IONRIPPER; effect = EF_BLASTER|EF_IONRIPPER;
} }
@ -458,37 +458,38 @@ void actorGrenadeLauncher (edict_t *self)
float drop; float drop;
float last_error, last_up, v_error; float last_error, last_up, v_error;
int i; int i;
VectorCopy (forward, target); // save target point VectorCopy (forward, target); // save target point
// horizontal distance to target // horizontal distance to target
x = sqrt( forward[0]*forward[0] + forward[1]*forward[1]); x = sqrt( forward[0] * forward[0] + forward[1] * forward[1]);
cosa = sqrt(aim[0]*aim[0] + aim[1]*aim[1]); cosa = sqrt(aim[0] * aim[0] + aim[1] * aim[1]);
// constant horizontal velocity (since grenades don't have drag) // constant horizontal velocity (since grenades don't have drag)
vx = GRENADE_VELOCITY * cosa; vx = GRENADE_VELOCITY * cosa;
// time to reach target x // time to reach target x
t = x/vx; t = x / vx;
// in that time, grenade will drop this much: // 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; forward[2] = target[2] + drop;
// this is a good first cut, but incorrect since angle now changes, so // this is a good first cut, but incorrect since angle now changes, so
// horizontal speed changes // horizontal speed changes
VectorCopy (forward, aim); VectorCopy (forward, aim);
VectorNormalize (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; vx = GRENADE_VELOCITY * cosa;
t = x/vx; t = x / vx;
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME); y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
v_error = target[2]-y; v_error = target[2] - y;
last_error = 2*v_error; last_error = 2 * v_error;
for (i=0; i<10 && fabs(v_error) > 4 && fabs(v_error) < fabs(last_error); i++) 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; forward[2] = target[2] + drop;
VectorCopy (forward, aim); VectorCopy (forward, aim);
VectorNormalize (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; vx = GRENADE_VELOCITY * cosa;
t = x/vx; t = x / vx;
y = GRENADE_VELOCITY*aim[2]*t - 0.5*sv_gravity->value*t*(t+FRAMETIME); y = GRENADE_VELOCITY * aim[2] * t - 0.5 * sv_gravity->value * t * (t + FRAMETIME);
v_error = target[2]-y; v_error = target[2]-y;
// If error is increasing... we can't get there from here and // If error is increasing... we can't get there from here and
// probably shouldn't be here in the first place. Too late now... // 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? // OK... the aim vector hit a solid, but would the grenade actually hit?
int contents; 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; vx = GRENADE_VELOCITY * cosa;
VectorSubtract (tr.endpos, start, dist); VectorSubtract (tr.endpos, start, dist);
dist[2] = 0; dist[2] = 0;
x = VectorLength(dist); x = VectorLength(dist);
t = x/vx; t = x / vx;
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME); drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
tr.endpos[2] -= drop; tr.endpos[2] -= drop;
// move just a bit in the aim direction // move just a bit in the aim direction
tr.endpos[0] += aim[0]; 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); tr = gi.trace(start, vec3_origin, vec3_origin, target, self, MASK_SOLID);
if (tr.fraction < 1.0) 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; vx = GRENADE_VELOCITY * cosa;
VectorSubtract (tr.endpos, start, dist); VectorSubtract (tr.endpos, start, dist);
dist[2] = 0; dist[2] = 0;
x = VectorLength(dist); x = VectorLength(dist);
t = x/vx; t = x / vx;
drop = 0.5*sv_gravity->value*t*(t+FRAMETIME); drop = 0.5 * sv_gravity->value * t * (t + FRAMETIME);
tr.endpos[2] -= drop; tr.endpos[2] -= drop;
tr.endpos[0] += aim[0]; tr.endpos[0] += aim[0];
tr.endpos[1] += aim[1]; tr.endpos[1] += aim[1];
@ -567,7 +568,7 @@ void actorGrenadeLauncher (edict_t *self)
VectorCopy (self->velocity, v1); VectorCopy (self->velocity, v1);
VectorNormalize (v1); VectorNormalize (v1);
delta = -monster_speed/GRENADE_VELOCITY; delta = -monster_speed / GRENADE_VELOCITY;
VectorMA (aim, delta, v1, aim); VectorMA (aim, delta, v1, aim);
VectorNormalize (aim); VectorNormalize (aim);
} }
@ -646,12 +647,12 @@ void actorHyperblaster (edict_t *self)
else else
{ {
// Knightmare- select color // Knightmare- select color
if (sk_hyperblaster_color->value == 2) // green if ((int)sk_hyperblaster_color->value == 2) // green
color = BLASTER_GREEN; color = BLASTER_GREEN;
else if (sk_hyperblaster_color->value == 3) // blue else if ((int)sk_hyperblaster_color->value == 3) // blue
color = BLASTER_BLUE; color = BLASTER_BLUE;
#ifdef KMQUAKE2_ENGINE_MOD #ifdef KMQUAKE2_ENGINE_MOD
else if (sk_hyperblaster_color->value == 4) // red else if ((int)sk_hyperblaster_color->value == 4) // red
color = BLASTER_RED; color = BLASTER_RED;
#endif #endif
else // standard yellow else // standard yellow
@ -664,12 +665,12 @@ void actorHyperblaster (edict_t *self)
VectorNormalize (forward); VectorNormalize (forward);
if ((random() * 3) < 1) if ((random() * 3) < 1)
{ {
if (sk_hyperblaster_color->value == 2) // green if ((int)sk_hyperblaster_color->value == 2) // green
effect = (EF_HYPERBLASTER|EF_TRACKER); 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; effect = EF_BLUEHYPERBLASTER;
#ifdef KMQUAKE2_ENGINE_MOD #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; effect = EF_HYPERBLASTER|EF_IONRIPPER;
#endif #endif
else // standard yellow else // standard yellow
@ -812,7 +813,7 @@ void actorIonripper (edict_t *self)
vec3_t start, target; vec3_t start, target;
vec3_t forward, right, up; vec3_t forward, right, up;
vec3_t tempang; vec3_t tempang;
int damage; int damage, speed;
if (!self->enemy || !self->enemy->inuse) if (!self->enemy || !self->enemy->inuse)
return; 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); gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/rippfire.wav"), 1, ATTN_NORM, 0);
if (self->monsterinfo.aiflags & AI_TWO_GUNS) damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 40 : 50;
damage = 40; speed = (int)sk_ionripper_speed->value;
else
damage = 50;
fire_ionripper (self, start, forward, damage, 500, EF_IONRIPPER); fire_ionripper (self, start, forward, damage, speed, EF_IONRIPPER);
if (developer->value) if (developer->value)
TraceAimPoint (start, target); TraceAimPoint (start, target);
@ -843,7 +842,7 @@ void actorIonripper (edict_t *self)
G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start); G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start);
VectorSubtract (target, start, forward); VectorSubtract (target, start, forward);
VectorNormalize (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 start, target;
vec3_t forward, right, up; vec3_t forward, right, up;
int damage = 80; int damage, speed;
float damage_radius = 120; float damage_radius = 120.0f;
int radius_damage = 120; int radius_damage;
if (!self->enemy || !self->enemy->inuse) if (!self->enemy || !self->enemy->inuse)
return; return;
@ -862,6 +861,10 @@ void actorPhalanx (edict_t *self)
if (level.time >= self->monsterinfo.pausetime) if (level.time >= self->monsterinfo.pausetime)
return; 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) if (self->actor_gunframe == 2 || self->actor_gunframe == 3)
{ {
AngleVectors (self->s.angles, forward, right, up); AngleVectors (self->s.angles, forward, right, up);
@ -884,14 +887,14 @@ void actorPhalanx (edict_t *self)
forward[YAW] -= 1.5; forward[YAW] -= 1.5;
VectorNormalize (forward); 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 else
{ {
forward[YAW] += 1.5; forward[YAW] += 1.5;
VectorNormalize (forward); 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); 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; int damage;
float damage_radius; float damage_radius;
int radius_damage; int radius_damage;
int speed;
if (!self->enemy || !self->enemy->inuse) { if (!self->enemy || !self->enemy->inuse) {
self->monsterinfo.pausetime = 0; 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); gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/nail1.wav"), 1, ATTN_NORM, 0);
if (self->monsterinfo.aiflags & AI_TWO_GUNS) damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 8 : 10;
damage = 8; radius_damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 16 : 20;
else damage_radius = 100.0f;
damage = 10; speed = (int)sk_etf_rifle_speed->value;
damage_radius = 100; fire_flechette (self, start, forward, damage, speed, damage_radius, radius_damage);
radius_damage = 20;
fire_flechette (self, start, forward, damage, 1500, damage_radius, radius_damage);
if (developer->value) if (developer->value)
TraceAimPoint (start, target); TraceAimPoint (start, target);
@ -949,7 +950,7 @@ void actorETF_Rifle (edict_t *self)
ActorTarget (self, target); ActorTarget (self, target);
VectorSubtract (target, start, forward); VectorSubtract (target, start, forward);
VectorNormalize (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 start, target;
vec3_t forward, right, up; vec3_t forward, right, up;
int damage; int damage, speed;
if (!self->enemy || !self->enemy->inuse) if (!self->enemy || !self->enemy->inuse)
return; 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); gi.positioned_sound(start, self, CHAN_WEAPON, gi.soundindex("weapons/disint2.wav"), 1, ATTN_NORM, 0);
if (self->monsterinfo.aiflags & AI_TWO_GUNS) damage = (self->monsterinfo.aiflags & AI_TWO_GUNS) ? 32 : 40;
damage = 30; speed = (int)sk_disruptor_speed->value;
else
damage = 40;
fire_tracker (self, start, forward, damage, sk_disruptor_speed->value, self->enemy); fire_tracker (self, start, forward, damage, speed, self->enemy);
if (developer->value) if (developer->value)
TraceAimPoint (start, target); TraceAimPoint (start, target);
@ -1033,6 +1032,73 @@ void actorDisintegrator (edict_t *self)
G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start); G_ProjectSource2(self->s.origin, self->muzzle2, forward, right, up, start);
VectorSubtract (target, start, forward); VectorSubtract (target, start, forward);
VectorNormalize (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);
} }
} }