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

@ -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
}

View file

@ -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;

View file

@ -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,6 +478,7 @@ 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]);
@ -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

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_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 ) ;

View file

@ -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},

View file

@ -775,6 +775,9 @@ void actor_fire (edict_t *self)
case 15:
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;
}

View file

@ -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

View file

@ -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,6 +458,7 @@ 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]);
@ -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);
}
}