vkQuake2 doxygen  1.0 dev
m_soldier.c File Reference
#include "g_local.h"
#include "m_soldier.h"

Go to the source code of this file.

Functions

void soldier_idle (edict_t *self)
 
void soldier_cock (edict_t *self)
 
void soldier_stand (edict_t *self)
 
void soldier_walk1_random (edict_t *self)
 
void soldier_walk (edict_t *self)
 
void soldier_run (edict_t *self)
 
void soldier_pain (edict_t *self, edict_t *other, float kick, int damage)
 
void soldier_fire (edict_t *self, int flash_number)
 
void soldier_fire1 (edict_t *self)
 
void soldier_attack1_refire1 (edict_t *self)
 
void soldier_attack1_refire2 (edict_t *self)
 
void soldier_fire2 (edict_t *self)
 
void soldier_attack2_refire1 (edict_t *self)
 
void soldier_attack2_refire2 (edict_t *self)
 
void soldier_duck_down (edict_t *self)
 
void soldier_duck_up (edict_t *self)
 
void soldier_fire3 (edict_t *self)
 
void soldier_attack3_refire (edict_t *self)
 
void soldier_fire4 (edict_t *self)
 
void soldier_fire8 (edict_t *self)
 
void soldier_attack6_refire (edict_t *self)
 
void soldier_attack (edict_t *self)
 
void soldier_sight (edict_t *self, edict_t *other)
 
void soldier_duck_hold (edict_t *self)
 
void soldier_dodge (edict_t *self, edict_t *attacker, float eta)
 
void soldier_fire6 (edict_t *self)
 
void soldier_fire7 (edict_t *self)
 
void soldier_dead (edict_t *self)
 
void soldier_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
 
void SP_monster_soldier_x (edict_t *self)
 
void SP_monster_soldier_light (edict_t *self)
 
void SP_monster_soldier (edict_t *self)
 
void SP_monster_soldier_ss (edict_t *self)
 

Variables

static int sound_idle
 
static int sound_sight1
 
static int sound_sight2
 
static int sound_pain_light
 
static int sound_pain
 
static int sound_pain_ss
 
static int sound_death_light
 
static int sound_death
 
static int sound_death_ss
 
static int sound_cock
 
mframe_t soldier_frames_stand1 []
 
mmove_t soldier_move_stand1 = {FRAME_stand101, FRAME_stand130, soldier_frames_stand1, soldier_stand}
 
mframe_t soldier_frames_stand3 []
 
mmove_t soldier_move_stand3 = {FRAME_stand301, FRAME_stand339, soldier_frames_stand3, soldier_stand}
 
mframe_t soldier_frames_walk1 []
 
mmove_t soldier_move_walk1 = {FRAME_walk101, FRAME_walk133, soldier_frames_walk1, NULL}
 
mframe_t soldier_frames_walk2 []
 
mmove_t soldier_move_walk2 = {FRAME_walk209, FRAME_walk218, soldier_frames_walk2, NULL}
 
mframe_t soldier_frames_start_run []
 
mmove_t soldier_move_start_run = {FRAME_run01, FRAME_run02, soldier_frames_start_run, soldier_run}
 
mframe_t soldier_frames_run []
 
mmove_t soldier_move_run = {FRAME_run03, FRAME_run08, soldier_frames_run, NULL}
 
mframe_t soldier_frames_pain1 []
 
mmove_t soldier_move_pain1 = {FRAME_pain101, FRAME_pain105, soldier_frames_pain1, soldier_run}
 
mframe_t soldier_frames_pain2 []
 
mmove_t soldier_move_pain2 = {FRAME_pain201, FRAME_pain207, soldier_frames_pain2, soldier_run}
 
mframe_t soldier_frames_pain3 []
 
mmove_t soldier_move_pain3 = {FRAME_pain301, FRAME_pain318, soldier_frames_pain3, soldier_run}
 
mframe_t soldier_frames_pain4 []
 
mmove_t soldier_move_pain4 = {FRAME_pain401, FRAME_pain417, soldier_frames_pain4, soldier_run}
 
static int blaster_flash [] = {MZ2_SOLDIER_BLASTER_1, MZ2_SOLDIER_BLASTER_2, MZ2_SOLDIER_BLASTER_3, MZ2_SOLDIER_BLASTER_4, MZ2_SOLDIER_BLASTER_5, MZ2_SOLDIER_BLASTER_6, MZ2_SOLDIER_BLASTER_7, MZ2_SOLDIER_BLASTER_8}
 
static int shotgun_flash [] = {MZ2_SOLDIER_SHOTGUN_1, MZ2_SOLDIER_SHOTGUN_2, MZ2_SOLDIER_SHOTGUN_3, MZ2_SOLDIER_SHOTGUN_4, MZ2_SOLDIER_SHOTGUN_5, MZ2_SOLDIER_SHOTGUN_6, MZ2_SOLDIER_SHOTGUN_7, MZ2_SOLDIER_SHOTGUN_8}
 
static int machinegun_flash [] = {MZ2_SOLDIER_MACHINEGUN_1, MZ2_SOLDIER_MACHINEGUN_2, MZ2_SOLDIER_MACHINEGUN_3, MZ2_SOLDIER_MACHINEGUN_4, MZ2_SOLDIER_MACHINEGUN_5, MZ2_SOLDIER_MACHINEGUN_6, MZ2_SOLDIER_MACHINEGUN_7, MZ2_SOLDIER_MACHINEGUN_8}
 
mframe_t soldier_frames_attack1 []
 
mmove_t soldier_move_attack1 = {FRAME_attak101, FRAME_attak112, soldier_frames_attack1, soldier_run}
 
mframe_t soldier_frames_attack2 []
 
mmove_t soldier_move_attack2 = {FRAME_attak201, FRAME_attak218, soldier_frames_attack2, soldier_run}
 
mframe_t soldier_frames_attack3 []
 
mmove_t soldier_move_attack3 = {FRAME_attak301, FRAME_attak309, soldier_frames_attack3, soldier_run}
 
mframe_t soldier_frames_attack4 []
 
mmove_t soldier_move_attack4 = {FRAME_attak401, FRAME_attak406, soldier_frames_attack4, soldier_run}
 
mframe_t soldier_frames_attack6 []
 
mmove_t soldier_move_attack6 = {FRAME_runs01, FRAME_runs14, soldier_frames_attack6, soldier_run}
 
mframe_t soldier_frames_duck []
 
mmove_t soldier_move_duck = {FRAME_duck01, FRAME_duck05, soldier_frames_duck, soldier_run}
 
mframe_t soldier_frames_death1 []
 
mmove_t soldier_move_death1 = {FRAME_death101, FRAME_death136, soldier_frames_death1, soldier_dead}
 
mframe_t soldier_frames_death2 []
 
mmove_t soldier_move_death2 = {FRAME_death201, FRAME_death235, soldier_frames_death2, soldier_dead}
 
mframe_t soldier_frames_death3 []
 
mmove_t soldier_move_death3 = {FRAME_death301, FRAME_death345, soldier_frames_death3, soldier_dead}
 
mframe_t soldier_frames_death4 []
 
mmove_t soldier_move_death4 = {FRAME_death401, FRAME_death453, soldier_frames_death4, soldier_dead}
 
mframe_t soldier_frames_death5 []
 
mmove_t soldier_move_death5 = {FRAME_death501, FRAME_death524, soldier_frames_death5, soldier_dead}
 
mframe_t soldier_frames_death6 []
 
mmove_t soldier_move_death6 = {FRAME_death601, FRAME_death610, soldier_frames_death6, soldier_dead}
 

Function Documentation

◆ soldier_attack()

void soldier_attack ( edict_t self)

Definition at line 772 of file m_soldier.c.

773 {
774  if (self->s.skinnum < 4)
775  {
776  if (random() < 0.5)
777  self->monsterinfo.currentmove = &soldier_move_attack1;
778  else
779  self->monsterinfo.currentmove = &soldier_move_attack2;
780  }
781  else
782  {
783  self->monsterinfo.currentmove = &soldier_move_attack4;
784  }
785 }

Referenced by SP_monster_soldier_x().

◆ soldier_attack1_refire1()

void soldier_attack1_refire1 ( edict_t self)

Definition at line 533 of file m_soldier.c.

534 {
535  if (self->s.skinnum > 1)
536  return;
537 
538  if (self->enemy->health <= 0)
539  return;
540 
541  if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
542  self->monsterinfo.nextframe = FRAME_attak102;
543  else
544  self->monsterinfo.nextframe = FRAME_attak110;
545 }

◆ soldier_attack1_refire2()

void soldier_attack1_refire2 ( edict_t self)

Definition at line 547 of file m_soldier.c.

548 {
549  if (self->s.skinnum < 2)
550  return;
551 
552  if (self->enemy->health <= 0)
553  return;
554 
555  if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
556  self->monsterinfo.nextframe = FRAME_attak102;
557 }

◆ soldier_attack2_refire1()

void soldier_attack2_refire1 ( edict_t self)

Definition at line 583 of file m_soldier.c.

584 {
585  if (self->s.skinnum > 1)
586  return;
587 
588  if (self->enemy->health <= 0)
589  return;
590 
591  if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
592  self->monsterinfo.nextframe = FRAME_attak204;
593  else
594  self->monsterinfo.nextframe = FRAME_attak216;
595 }

◆ soldier_attack2_refire2()

void soldier_attack2_refire2 ( edict_t self)

Definition at line 597 of file m_soldier.c.

598 {
599  if (self->s.skinnum < 2)
600  return;
601 
602  if (self->enemy->health <= 0)
603  return;
604 
605  if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
606  self->monsterinfo.nextframe = FRAME_attak204;
607 }

◆ soldier_attack3_refire()

void soldier_attack3_refire ( edict_t self)

Definition at line 659 of file m_soldier.c.

660 {
661  if ((level.time + 0.4) < self->monsterinfo.pausetime)
662  self->monsterinfo.nextframe = FRAME_attak303;
663 }

◆ soldier_attack6_refire()

void soldier_attack6_refire ( edict_t self)

Definition at line 741 of file m_soldier.c.

742 {
743  if (self->enemy->health <= 0)
744  return;
745 
746  if (range(self, self->enemy) < RANGE_MID)
747  return;
748 
749  if (skill->value == 3)
750  self->monsterinfo.nextframe = FRAME_runs03;
751 }

◆ soldier_cock()

void soldier_cock ( edict_t self)

Definition at line 50 of file m_soldier.c.

51 {
52  if (self->s.frame == FRAME_stand322)
53  gi.sound (self, CHAN_WEAPON, sound_cock, 1, ATTN_IDLE, 0);
54  else
55  gi.sound (self, CHAN_WEAPON, sound_cock, 1, ATTN_NORM, 0);
56 }

◆ soldier_dead()

void soldier_dead ( edict_t self)

Definition at line 884 of file m_soldier.c.

885 {
886  VectorSet (self->mins, -16, -16, -24);
887  VectorSet (self->maxs, 16, 16, -8);
888  self->movetype = MOVETYPE_TOSS;
889  self->svflags |= SVF_DEADMONSTER;
890  self->nextthink = 0;
891  gi.linkentity (self);
892 }

◆ soldier_die()

void soldier_die ( edict_t self,
edict_t inflictor,
edict_t attacker,
int  damage,
vec3_t  point 
)

Definition at line 1144 of file m_soldier.c.

1145 {
1146  int n;
1147 
1148 // check for gib
1149  if (self->health <= self->gib_health)
1150  {
1151  gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/udeath.wav"), 1, ATTN_NORM, 0);
1152  for (n= 0; n < 3; n++)
1153  ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
1154  ThrowGib (self, "models/objects/gibs/chest/tris.md2", damage, GIB_ORGANIC);
1155  ThrowHead (self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC);
1156  self->deadflag = DEAD_DEAD;
1157  return;
1158  }
1159 
1160  if (self->deadflag == DEAD_DEAD)
1161  return;
1162 
1163 // regular death
1164  self->deadflag = DEAD_DEAD;
1165  self->takedamage = DAMAGE_YES;
1166  self->s.skinnum |= 1;
1167 
1168  if (self->s.skinnum == 1)
1169  gi.sound (self, CHAN_VOICE, sound_death_light, 1, ATTN_NORM, 0);
1170  else if (self->s.skinnum == 3)
1171  gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
1172  else // (self->s.skinnum == 5)
1173  gi.sound (self, CHAN_VOICE, sound_death_ss, 1, ATTN_NORM, 0);
1174 
1175  if (fabs((self->s.origin[2] + self->viewheight) - point[2]) <= 4)
1176  {
1177  // head shot
1178  self->monsterinfo.currentmove = &soldier_move_death3;
1179  return;
1180  }
1181 
1182  n = rand() % 5;
1183  if (n == 0)
1184  self->monsterinfo.currentmove = &soldier_move_death1;
1185  else if (n == 1)
1186  self->monsterinfo.currentmove = &soldier_move_death2;
1187  else if (n == 2)
1188  self->monsterinfo.currentmove = &soldier_move_death4;
1189  else if (n == 3)
1190  self->monsterinfo.currentmove = &soldier_move_death5;
1191  else
1192  self->monsterinfo.currentmove = &soldier_move_death6;
1193 }

Referenced by SP_monster_soldier_x().

◆ soldier_dodge()

void soldier_dodge ( edict_t self,
edict_t attacker,
float  eta 
)

Definition at line 828 of file m_soldier.c.

829 {
830  float r;
831 
832  r = random();
833  if (r > 0.25)
834  return;
835 
836  if (!self->enemy)
837  self->enemy = attacker;
838 
839  if (skill->value == 0)
840  {
842  return;
843  }
844 
845  self->monsterinfo.pausetime = level.time + eta + 0.3;
846  r = random();
847 
848  if (skill->value == 1)
849  {
850  if (r > 0.33)
851  self->monsterinfo.currentmove = &soldier_move_duck;
852  else
853  self->monsterinfo.currentmove = &soldier_move_attack3;
854  return;
855  }
856 
857  if (skill->value >= 2)
858  {
859  if (r > 0.66)
860  self->monsterinfo.currentmove = &soldier_move_duck;
861  else
862  self->monsterinfo.currentmove = &soldier_move_attack3;
863  return;
864  }
865 
866  self->monsterinfo.currentmove = &soldier_move_attack3;
867 }

Referenced by SP_monster_soldier_x().

◆ soldier_duck_down()

void soldier_duck_down ( edict_t self)

Definition at line 634 of file m_soldier.c.

635 {
636  if (self->monsterinfo.aiflags & AI_DUCKED)
637  return;
638  self->monsterinfo.aiflags |= AI_DUCKED;
639  self->maxs[2] -= 32;
640  self->takedamage = DAMAGE_YES;
641  self->monsterinfo.pausetime = level.time + 1;
642  gi.linkentity (self);
643 }

Referenced by soldier_fire3().

◆ soldier_duck_hold()

void soldier_duck_hold ( edict_t self)

Definition at line 810 of file m_soldier.c.

811 {
812  if (level.time >= self->monsterinfo.pausetime)
813  self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
814  else
815  self->monsterinfo.aiflags |= AI_HOLD_FRAME;
816 }

◆ soldier_duck_up()

void soldier_duck_up ( edict_t self)

Definition at line 645 of file m_soldier.c.

646 {
647  self->monsterinfo.aiflags &= ~AI_DUCKED;
648  self->maxs[2] += 32;
649  self->takedamage = DAMAGE_AIM;
650  gi.linkentity (self);
651 }

◆ soldier_fire()

void soldier_fire ( edict_t self,
int  flash_number 
)

Definition at line 462 of file m_soldier.c.

463 {
464  vec3_t start;
466  vec3_t aim;
467  vec3_t dir;
468  vec3_t end;
469  float r, u;
470  int flash_index;
471 
472  if (self->s.skinnum < 2)
473  flash_index = blaster_flash[flash_number];
474  else if (self->s.skinnum < 4)
475  flash_index = shotgun_flash[flash_number];
476  else
477  flash_index = machinegun_flash[flash_number];
478 
479  AngleVectors (self->s.angles, forward, right, NULL);
480  G_ProjectSource (self->s.origin, monster_flash_offset[flash_index], forward, right, start);
481 
482  if (flash_number == 5 || flash_number == 6)
483  {
484  VectorCopy (forward, aim);
485  }
486  else
487  {
488  VectorCopy (self->enemy->s.origin, end);
489  end[2] += self->enemy->viewheight;
490  VectorSubtract (end, start, aim);
491  vectoangles (aim, dir);
492  AngleVectors (dir, forward, right, up);
493 
494  r = crandom()*1000;
495  u = crandom()*500;
496  VectorMA (start, 8192, forward, end);
497  VectorMA (end, r, right, end);
498  VectorMA (end, u, up, end);
499 
500  VectorSubtract (end, start, aim);
501  VectorNormalize (aim);
502  }
503 
504  if (self->s.skinnum <= 1)
505  {
506  monster_fire_blaster (self, start, aim, 5, 600, flash_index, EF_BLASTER);
507  }
508  else if (self->s.skinnum <= 3)
509  {
511  }
512  else
513  {
514  if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
515  self->monsterinfo.pausetime = level.time + (3 + rand() % 8) * FRAMETIME;
516 
517  monster_fire_bullet (self, start, aim, 2, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_index);
518 
519  if (level.time >= self->monsterinfo.pausetime)
520  self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
521  else
522  self->monsterinfo.aiflags |= AI_HOLD_FRAME;
523  }
524 }

Referenced by soldier_fire1(), soldier_fire2(), soldier_fire3(), soldier_fire4(), soldier_fire6(), soldier_fire7(), and soldier_fire8().

◆ soldier_fire1()

void soldier_fire1 ( edict_t self)

Definition at line 528 of file m_soldier.c.

529 {
530  soldier_fire (self, 0);
531 }

◆ soldier_fire2()

void soldier_fire2 ( edict_t self)

Definition at line 578 of file m_soldier.c.

579 {
580  soldier_fire (self, 1);
581 }

◆ soldier_fire3()

void soldier_fire3 ( edict_t self)

Definition at line 653 of file m_soldier.c.

654 {
655  soldier_duck_down (self);
656  soldier_fire (self, 2);
657 }

◆ soldier_fire4()

void soldier_fire4 ( edict_t self)

Definition at line 681 of file m_soldier.c.

682 {
683  soldier_fire (self, 3);
684 //
685 // if (self->enemy->health <= 0)
686 // return;
687 //
688 // if ( ((skill->value == 3) && (random() < 0.5)) || (range(self, self->enemy) == RANGE_MELEE) )
689 // self->monsterinfo.nextframe = FRAME_attak402;
690 }

◆ soldier_fire6()

void soldier_fire6 ( edict_t self)

Definition at line 874 of file m_soldier.c.

875 {
876  soldier_fire (self, 5);
877 }

◆ soldier_fire7()

void soldier_fire7 ( edict_t self)

Definition at line 879 of file m_soldier.c.

880 {
881  soldier_fire (self, 6);
882 }

◆ soldier_fire8()

void soldier_fire8 ( edict_t self)

Definition at line 736 of file m_soldier.c.

737 {
738  soldier_fire (self, 7);
739 }

◆ soldier_idle()

void soldier_idle ( edict_t self)

Definition at line 44 of file m_soldier.c.

45 {
46  if (random() > 0.8)
47  gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
48 }

◆ soldier_pain()

void soldier_pain ( edict_t self,
edict_t other,
float  kick,
int  damage 
)

Definition at line 409 of file m_soldier.c.

410 {
411  float r;
412  int n;
413 
414  if (self->health < (self->max_health / 2))
415  self->s.skinnum |= 1;
416 
417  if (level.time < self->pain_debounce_time)
418  {
419  if ((self->velocity[2] > 100) && ( (self->monsterinfo.currentmove == &soldier_move_pain1) || (self->monsterinfo.currentmove == &soldier_move_pain2) || (self->monsterinfo.currentmove == &soldier_move_pain3)))
420  self->monsterinfo.currentmove = &soldier_move_pain4;
421  return;
422  }
423 
424  self->pain_debounce_time = level.time + 3;
425 
426  n = self->s.skinnum | 1;
427  if (n == 1)
428  gi.sound (self, CHAN_VOICE, sound_pain_light, 1, ATTN_NORM, 0);
429  else if (n == 3)
430  gi.sound (self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0);
431  else
432  gi.sound (self, CHAN_VOICE, sound_pain_ss, 1, ATTN_NORM, 0);
433 
434  if (self->velocity[2] > 100)
435  {
436  self->monsterinfo.currentmove = &soldier_move_pain4;
437  return;
438  }
439 
440  if (skill->value == 3)
441  return; // no pain anims in nightmare
442 
443  r = random();
444 
445  if (r < 0.33)
446  self->monsterinfo.currentmove = &soldier_move_pain1;
447  else if (r < 0.66)
448  self->monsterinfo.currentmove = &soldier_move_pain2;
449  else
450  self->monsterinfo.currentmove = &soldier_move_pain3;
451 }

Referenced by SP_monster_soldier_x().

◆ soldier_run()

void soldier_run ( edict_t self)

Definition at line 316 of file m_soldier.c.

317 {
318  if (self->monsterinfo.aiflags & AI_STAND_GROUND)
319  {
320  self->monsterinfo.currentmove = &soldier_move_stand1;
321  return;
322  }
323 
327  {
328  self->monsterinfo.currentmove = &soldier_move_run;
329  }
330  else
331  {
332  self->monsterinfo.currentmove = &soldier_move_start_run;
333  }
334 }

Referenced by SP_monster_soldier_x().

◆ soldier_sight()

void soldier_sight ( edict_t self,
edict_t other 
)

Definition at line 792 of file m_soldier.c.

793 {
794  if (random() < 0.5)
795  gi.sound (self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0);
796  else
797  gi.sound (self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0);
798 
799  if ((skill->value > 0) && (range(self, self->enemy) >= RANGE_MID))
800  {
801  if (random() > 0.5)
802  self->monsterinfo.currentmove = &soldier_move_attack6;
803  }
804 }

Referenced by SP_monster_soldier_x().

◆ soldier_stand()

void soldier_stand ( edict_t self)

Definition at line 211 of file m_soldier.c.

212 {
213  if ((self->monsterinfo.currentmove == &soldier_move_stand3) || (random() < 0.8))
214  self->monsterinfo.currentmove = &soldier_move_stand1;
215  else
216  self->monsterinfo.currentmove = &soldier_move_stand3;
217 }

Referenced by SP_monster_soldier_x().

◆ soldier_walk()

void soldier_walk ( edict_t self)

Definition at line 283 of file m_soldier.c.

284 {
285  if (random() < 0.5)
286  self->monsterinfo.currentmove = &soldier_move_walk1;
287  else
288  self->monsterinfo.currentmove = &soldier_move_walk2;
289 }

Referenced by SP_monster_soldier_x().

◆ soldier_walk1_random()

void soldier_walk1_random ( edict_t self)

Definition at line 224 of file m_soldier.c.

225 {
226  if (random() > 0.1)
227  self->monsterinfo.nextframe = FRAME_walk101;
228 }

◆ SP_monster_soldier()

void SP_monster_soldier ( edict_t self)

Definition at line 1261 of file m_soldier.c.

1262 {
1263  if (deathmatch->value)
1264  {
1265  G_FreeEdict (self);
1266  return;
1267  }
1268 
1269  SP_monster_soldier_x (self);
1270 
1271  sound_pain = gi.soundindex ("soldier/solpain1.wav");
1272  sound_death = gi.soundindex ("soldier/soldeth1.wav");
1273  gi.soundindex ("soldier/solatck1.wav");
1274 
1275  self->s.skinnum = 2;
1276  self->health = 30;
1277  self->gib_health = -30;
1278 }

◆ SP_monster_soldier_light()

void SP_monster_soldier_light ( edict_t self)

Definition at line 1238 of file m_soldier.c.

1239 {
1240  if (deathmatch->value)
1241  {
1242  G_FreeEdict (self);
1243  return;
1244  }
1245 
1246  SP_monster_soldier_x (self);
1247 
1248  sound_pain_light = gi.soundindex ("soldier/solpain2.wav");
1249  sound_death_light = gi.soundindex ("soldier/soldeth2.wav");
1250  gi.modelindex ("models/objects/laser/tris.md2");
1251  gi.soundindex ("misc/lasfly.wav");
1252  gi.soundindex ("soldier/solatck2.wav");
1253 
1254  self->s.skinnum = 0;
1255  self->health = 20;
1256  self->gib_health = -30;
1257 }

◆ SP_monster_soldier_ss()

void SP_monster_soldier_ss ( edict_t self)

Definition at line 1282 of file m_soldier.c.

1283 {
1284  if (deathmatch->value)
1285  {
1286  G_FreeEdict (self);
1287  return;
1288  }
1289 
1290  SP_monster_soldier_x (self);
1291 
1292  sound_pain_ss = gi.soundindex ("soldier/solpain3.wav");
1293  sound_death_ss = gi.soundindex ("soldier/soldeth3.wav");
1294  gi.soundindex ("soldier/solatck3.wav");
1295 
1296  self->s.skinnum = 4;
1297  self->health = 40;
1298  self->gib_health = -30;
1299 }

◆ SP_monster_soldier_x()

void SP_monster_soldier_x ( edict_t self)

Definition at line 1200 of file m_soldier.c.

1201 {
1202 
1203  self->s.modelindex = gi.modelindex ("models/monsters/soldier/tris.md2");
1204  self->monsterinfo.scale = MODEL_SCALE;
1205  VectorSet (self->mins, -16, -16, -24);
1206  VectorSet (self->maxs, 16, 16, 32);
1207  self->movetype = MOVETYPE_STEP;
1208  self->solid = SOLID_BBOX;
1209 
1210  sound_idle = gi.soundindex ("soldier/solidle1.wav");
1211  sound_sight1 = gi.soundindex ("soldier/solsght1.wav");
1212  sound_sight2 = gi.soundindex ("soldier/solsrch1.wav");
1213  sound_cock = gi.soundindex ("infantry/infatck3.wav");
1214 
1215  self->mass = 100;
1216 
1217  self->pain = soldier_pain;
1218  self->die = soldier_die;
1219 
1220  self->monsterinfo.stand = soldier_stand;
1221  self->monsterinfo.walk = soldier_walk;
1222  self->monsterinfo.run = soldier_run;
1223  self->monsterinfo.dodge = soldier_dodge;
1224  self->monsterinfo.attack = soldier_attack;
1225  self->monsterinfo.melee = NULL;
1226  self->monsterinfo.sight = soldier_sight;
1227 
1228  gi.linkentity (self);
1229 
1230  self->monsterinfo.stand (self);
1231 
1232  walkmonster_start (self);
1233 }

Referenced by SP_monster_soldier(), SP_monster_soldier_light(), and SP_monster_soldier_ss().

Variable Documentation

◆ blaster_flash

◆ machinegun_flash

◆ shotgun_flash

◆ soldier_frames_attack1

mframe_t soldier_frames_attack1[]

◆ soldier_frames_attack2

◆ soldier_frames_attack3

mframe_t soldier_frames_attack3[]
Initial value:

Definition at line 665 of file m_soldier.c.

◆ soldier_frames_attack4

mframe_t soldier_frames_attack4[]
Initial value:

Definition at line 692 of file m_soldier.c.

◆ soldier_frames_attack6

mframe_t soldier_frames_attack6[]
Initial value:

Definition at line 753 of file m_soldier.c.

◆ soldier_frames_death1

mframe_t soldier_frames_death1[]

Definition at line 894 of file m_soldier.c.

◆ soldier_frames_death2

mframe_t soldier_frames_death2[]

Definition at line 938 of file m_soldier.c.

◆ soldier_frames_death3

mframe_t soldier_frames_death3[]

Definition at line 981 of file m_soldier.c.

◆ soldier_frames_death4

mframe_t soldier_frames_death4[]

Definition at line 1035 of file m_soldier.c.

◆ soldier_frames_death5

mframe_t soldier_frames_death5[]
Initial value:
=
{
ai_move, -5, NULL,
ai_move, -5, NULL,
ai_move, -5, NULL,
}

Definition at line 1098 of file m_soldier.c.

◆ soldier_frames_death6

mframe_t soldier_frames_death6[]
Initial value:
=
{
}

Definition at line 1129 of file m_soldier.c.

◆ soldier_frames_duck

mframe_t soldier_frames_duck[]
Initial value:

Definition at line 818 of file m_soldier.c.

◆ soldier_frames_pain1

mframe_t soldier_frames_pain1[]
Initial value:
=
{
ai_move, -3, NULL,
}

Definition at line 341 of file m_soldier.c.

◆ soldier_frames_pain2

mframe_t soldier_frames_pain2[]
Initial value:
=
{
ai_move, -13, NULL,
ai_move, -1, NULL,
}

Definition at line 351 of file m_soldier.c.

◆ soldier_frames_pain3

mframe_t soldier_frames_pain3[]
Initial value:
=
{
ai_move, -8, NULL,
ai_move, 10, NULL,
ai_move, -4, NULL,
ai_move, -1, NULL,
ai_move, -3, NULL,
}

Definition at line 363 of file m_soldier.c.

◆ soldier_frames_pain4

mframe_t soldier_frames_pain4[]
Initial value:
=
{
ai_move, -10, NULL,
ai_move, -6, NULL,
ai_move, -1, NULL,
ai_move, -1, NULL,
}

Definition at line 386 of file m_soldier.c.

◆ soldier_frames_run

mframe_t soldier_frames_run[]
Initial value:
=
{
ai_run, 10, NULL,
ai_run, 11, NULL,
ai_run, 11, NULL,
ai_run, 16, NULL,
ai_run, 10, NULL,
ai_run, 15, NULL
}

Definition at line 305 of file m_soldier.c.

◆ soldier_frames_stand1

mframe_t soldier_frames_stand1[]

Definition at line 63 of file m_soldier.c.

◆ soldier_frames_stand3

mframe_t soldier_frames_stand3[]

Definition at line 100 of file m_soldier.c.

◆ soldier_frames_start_run

mframe_t soldier_frames_start_run[]
Initial value:
=
{
ai_run, 7, NULL,
}

Definition at line 298 of file m_soldier.c.

◆ soldier_frames_walk1

mframe_t soldier_frames_walk1[]

Definition at line 230 of file m_soldier.c.

◆ soldier_frames_walk2

mframe_t soldier_frames_walk2[]
Initial value:
=
{
}

Definition at line 268 of file m_soldier.c.

◆ soldier_move_attack1

Definition at line 574 of file m_soldier.c.

Referenced by soldier_attack().

◆ soldier_move_attack2

Definition at line 630 of file m_soldier.c.

Referenced by soldier_attack().

◆ soldier_move_attack3

Definition at line 677 of file m_soldier.c.

Referenced by soldier_dodge().

◆ soldier_move_attack4

Definition at line 701 of file m_soldier.c.

Referenced by soldier_attack().

◆ soldier_move_attack6

Definition at line 770 of file m_soldier.c.

Referenced by soldier_sight().

◆ soldier_move_death1

Definition at line 936 of file m_soldier.c.

Referenced by soldier_die().

◆ soldier_move_death2

Definition at line 979 of file m_soldier.c.

Referenced by soldier_die().

◆ soldier_move_death3

Definition at line 1033 of file m_soldier.c.

Referenced by soldier_die().

◆ soldier_move_death4

Definition at line 1096 of file m_soldier.c.

Referenced by soldier_die().

◆ soldier_move_death5

Definition at line 1127 of file m_soldier.c.

Referenced by soldier_die().

◆ soldier_move_death6

Definition at line 1142 of file m_soldier.c.

Referenced by soldier_die().

◆ soldier_move_duck

Definition at line 826 of file m_soldier.c.

Referenced by soldier_dodge().

◆ soldier_move_pain1

Definition at line 349 of file m_soldier.c.

Referenced by soldier_pain().

◆ soldier_move_pain2

Definition at line 361 of file m_soldier.c.

Referenced by soldier_pain().

◆ soldier_move_pain3

Definition at line 384 of file m_soldier.c.

Referenced by soldier_pain().

◆ soldier_move_pain4

Definition at line 406 of file m_soldier.c.

Referenced by soldier_pain().

◆ soldier_move_run

Definition at line 314 of file m_soldier.c.

Referenced by soldier_run().

◆ soldier_move_stand1

Definition at line 98 of file m_soldier.c.

Referenced by soldier_run(), and soldier_stand().

◆ soldier_move_stand3

Definition at line 145 of file m_soldier.c.

Referenced by soldier_stand().

◆ soldier_move_start_run

Definition at line 303 of file m_soldier.c.

Referenced by soldier_run().

◆ soldier_move_walk1

Definition at line 266 of file m_soldier.c.

Referenced by soldier_run(), and soldier_walk().

◆ soldier_move_walk2

Definition at line 281 of file m_soldier.c.

Referenced by soldier_run(), and soldier_walk().

◆ sound_cock

int sound_cock
static

Definition at line 41 of file m_soldier.c.

Referenced by soldier_cock(), and SP_monster_soldier_x().

◆ sound_death

int sound_death
static

Definition at line 39 of file m_soldier.c.

Referenced by soldier_die(), and SP_monster_soldier().

◆ sound_death_light

int sound_death_light
static

Definition at line 38 of file m_soldier.c.

Referenced by soldier_die(), and SP_monster_soldier_light().

◆ sound_death_ss

int sound_death_ss
static

Definition at line 40 of file m_soldier.c.

Referenced by soldier_die(), and SP_monster_soldier_ss().

◆ sound_idle

int sound_idle
static

Definition at line 32 of file m_soldier.c.

Referenced by soldier_idle(), and SP_monster_soldier_x().

◆ sound_pain

int sound_pain
static

Definition at line 36 of file m_soldier.c.

Referenced by soldier_pain(), and SP_monster_soldier().

◆ sound_pain_light

int sound_pain_light
static

Definition at line 35 of file m_soldier.c.

Referenced by soldier_pain(), and SP_monster_soldier_light().

◆ sound_pain_ss

int sound_pain_ss
static

Definition at line 37 of file m_soldier.c.

Referenced by soldier_pain(), and SP_monster_soldier_ss().

◆ sound_sight1

int sound_sight1
static

Definition at line 33 of file m_soldier.c.

Referenced by soldier_sight(), and SP_monster_soldier_x().

◆ sound_sight2

int sound_sight2
static

Definition at line 34 of file m_soldier.c.

Referenced by soldier_sight(), and SP_monster_soldier_x().

soldier_move_pain4
mmove_t soldier_move_pain4
Definition: m_soldier.c:406
gi
game_import_t gi
Definition: g_main.c:25
soldier_move_pain2
mmove_t soldier_move_pain2
Definition: m_soldier.c:361
G_ProjectSource
void G_ProjectSource(vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
Definition: g_utils.c:25
sound_cock
static int sound_cock
Definition: m_soldier.c:41
sound_sight2
static int sound_sight2
Definition: m_soldier.c:34
edict_s::s
entity_state_t s
Definition: g_local.h:970
deathmatch
cvar_t * deathmatch
Definition: g_main.c:35
soldier_move_attack4
mmove_t soldier_move_attack4
Definition: m_soldier.c:701
soldier_fire2
void soldier_fire2(edict_t *self)
Definition: m_soldier.c:578
DEAD_DEAD
#define DEAD_DEAD
Definition: g_local.h:115
soldier_duck_down
void soldier_duck_down(edict_t *self)
Definition: m_soldier.c:634
shotgun_flash
static int shotgun_flash[]
Definition: m_soldier.c:459
blaster_flash
static int blaster_flash[]
Definition: m_soldier.c:458
DEFAULT_BULLET_HSPREAD
#define DEFAULT_BULLET_HSPREAD
Definition: g_local.h:670
ThrowGib
void ThrowGib(edict_t *self, char *gibname, int damage, int type)
Definition: g_misc.c:135
edict_s::gib_health
int gib_health
Definition: g_local.h:1059
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
entity_state_s::frame
int frame
Definition: q_shared.h:1154
ai_charge
void ai_charge(edict_t *self, float dist)
Definition: g_ai.c:194
SOLID_BBOX
@ SOLID_BBOX
Definition: game.h:37
FRAME_attak102
#define FRAME_attak102
Definition: m_boss31.h:25
soldier_move_pain1
mmove_t soldier_move_pain1
Definition: m_soldier.c:349
soldier_die
void soldier_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
Definition: m_soldier.c:1144
soldier_attack3_refire
void soldier_attack3_refire(edict_t *self)
Definition: m_soldier.c:659
FRAMETIME
#define FRAMETIME
Definition: g_local.h:75
soldier_move_pain3
mmove_t soldier_move_pain3
Definition: m_soldier.c:384
sound_death
static int sound_death
Definition: m_soldier.c:39
FRAME_attak204
#define FRAME_attak204
Definition: m_boss31.h:45
machinegun_flash
static int machinegun_flash[]
Definition: m_soldier.c:460
soldier_attack2_refire2
void soldier_attack2_refire2(edict_t *self)
Definition: m_soldier.c:597
SP_monster_soldier_x
void SP_monster_soldier_x(edict_t *self)
Definition: m_soldier.c:1200
entity_state_s::origin
vec3_t origin
Definition: q_shared.h:1149
soldier_move_death2
mmove_t soldier_move_death2
Definition: m_soldier.c:979
sound_pain_ss
static int sound_pain_ss
Definition: m_soldier.c:37
AI_STAND_GROUND
#define AI_STAND_GROUND
Definition: g_local.h:129
MODEL_SCALE
#define MODEL_SCALE
Definition: m_actor.h:506
edict_s::max_health
int max_health
Definition: g_local.h:1058
sound_death_ss
static int sound_death_ss
Definition: m_soldier.c:40
DAMAGE_YES
@ DAMAGE_YES
Definition: g_local.h:89
game_import_t::sound
void(* sound)(edict_t *ent, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: game.h:109
ATTN_IDLE
#define ATTN_IDLE
Definition: q_shared.h:996
DEFAULT_SHOTGUN_COUNT
#define DEFAULT_SHOTGUN_COUNT
Definition: g_local.h:675
soldier_fire4
void soldier_fire4(edict_t *self)
Definition: m_soldier.c:681
FRAME_attak216
#define FRAME_attak216
Definition: m_brain.h:110
edict_s::mins
vec3_t mins
Definition: g_local.h:990
range
GLsizei range
Definition: qgl_win.c:121
monsterinfo_t::currentmove
mmove_t * currentmove
Definition: g_local.h:420
soldier_move_death3
mmove_t soldier_move_death3
Definition: m_soldier.c:1033
soldier_sight
void soldier_sight(edict_t *self, edict_t *other)
Definition: m_soldier.c:792
ATTN_NORM
#define ATTN_NORM
Definition: q_shared.h:995
walkmonster_start
void walkmonster_start(edict_t *self)
Definition: g_monster.c:692
MOVETYPE_STEP
@ MOVETYPE_STEP
Definition: g_local.h:196
soldier_attack6_refire
void soldier_attack6_refire(edict_t *self)
Definition: m_soldier.c:741
soldier_move_attack3
mmove_t soldier_move_attack3
Definition: m_soldier.c:677
soldier_move_walk1
mmove_t soldier_move_walk1
Definition: m_soldier.c:266
SVF_DEADMONSTER
#define SVF_DEADMONSTER
Definition: game.h:28
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
u
static int u
Definition: r_part.c:472
soldier_pain
void soldier_pain(edict_t *self, edict_t *other, float kick, int damage)
Definition: m_soldier.c:409
soldier_move_attack2
mmove_t soldier_move_attack2
Definition: m_soldier.c:630
monster_flash_offset
vec3_t monster_flash_offset[]
Definition: m_flash.c:27
CHAN_VOICE
#define CHAN_VOICE
Definition: q_shared.h:985
vectoangles
void vectoangles(vec3_t vec, vec3_t angles)
Definition: g_utils.c:356
DEFAULT_BULLET_VSPREAD
#define DEFAULT_BULLET_VSPREAD
Definition: g_local.h:671
soldier_cock
void soldier_cock(edict_t *self)
Definition: m_soldier.c:50
G_FreeEdict
void G_FreeEdict(edict_t *e)
Definition: g_utils.c:452
monsterinfo_t::pausetime
float pausetime
Definition: g_local.h:436
r
GLdouble GLdouble r
Definition: qgl_win.c:336
FRAME_attak110
#define FRAME_attak110
Definition: m_boss31.h:33
soldier_move_attack1
mmove_t soldier_move_attack1
Definition: m_soldier.c:574
soldier_move_start_run
mmove_t soldier_move_start_run
Definition: m_soldier.c:303
sound_death_light
static int sound_death_light
Definition: m_soldier.c:38
edict_s::viewheight
int viewheight
Definition: g_local.h:1067
soldier_move_duck
mmove_t soldier_move_duck
Definition: m_soldier.c:826
game_import_t::soundindex
int(* soundindex)(char *name)
Definition: game.h:122
forward
static vec3_t forward
Definition: p_view.c:29
EF_BLASTER
#define EF_BLASTER
Definition: q_shared.h:564
crandom
#define crandom()
Definition: g_local.h:516
AI_HOLD_FRAME
#define AI_HOLD_FRAME
Definition: g_local.h:136
game_import_t::modelindex
int(* modelindex)(char *name)
Definition: game.h:121
edict_s::deadflag
int deadflag
Definition: g_local.h:1060
soldier_move_death6
mmove_t soldier_move_death6
Definition: m_soldier.c:1142
soldier_fire3
void soldier_fire3(edict_t *self)
Definition: m_soldier.c:653
sound_sight1
static int sound_sight1
Definition: m_soldier.c:33
cvar_s::value
float value
Definition: q_shared.h:331
ai_walk
void ai_walk(edict_t *self, float dist)
Definition: g_ai.c:163
random
#define random()
Definition: g_local.h:515
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: q_shared.c:681
NULL
#define NULL
Definition: q_shared.h:67
soldier_duck_up
void soldier_duck_up(edict_t *self)
Definition: m_soldier.c:645
soldier_attack2_refire1
void soldier_attack2_refire1(edict_t *self)
Definition: m_soldier.c:583
monsterinfo_t::aiflags
int aiflags
Definition: g_local.h:421
soldier_stand
void soldier_stand(edict_t *self)
Definition: m_soldier.c:211
monster_fire_bullet
void monster_fire_bullet(edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype)
Definition: g_monster.c:31
soldier_run
void soldier_run(edict_t *self)
Definition: m_soldier.c:316
skill
cvar_t * skill
Definition: g_main.c:38
FRAME_runs03
#define FRAME_runs03
Definition: m_actor.h:130
edict_s::velocity
vec3_t velocity
Definition: g_local.h:1030
soldier_move_death1
mmove_t soldier_move_death1
Definition: m_soldier.c:936
soldier_move_run
mmove_t soldier_move_run
Definition: m_soldier.c:314
ai_move
void ai_move(edict_t *self, float dist)
Definition: g_ai.c:92
soldier_move_stand3
mmove_t soldier_move_stand3
Definition: m_soldier.c:145
monster_fire_blaster
void monster_fire_blaster(edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect)
Definition: g_monster.c:51
entity_state_s::skinnum
int skinnum
Definition: q_shared.h:1155
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
edict_s::pain_debounce_time
float pain_debounce_time
Definition: g_local.h:1052
FRAME_attak303
#define FRAME_attak303
Definition: m_boss32.h:227
edict_s::monsterinfo
monsterinfo_t monsterinfo
Definition: g_local.h:1114
RANGE_MELEE
#define RANGE_MELEE
Definition: g_local.h:119
DAMAGE_AIM
@ DAMAGE_AIM
Definition: g_local.h:90
up
static vec3_t up
Definition: p_view.c:29
CHAN_WEAPON
#define CHAN_WEAPON
Definition: q_shared.h:984
DEFAULT_SHOTGUN_HSPREAD
#define DEFAULT_SHOTGUN_HSPREAD
Definition: g_local.h:672
level
GLint level
Definition: qgl_win.c:116
ai_run
void ai_run(edict_t *self, float dist)
Definition: g_ai.c:914
soldier_move_attack6
mmove_t soldier_move_attack6
Definition: m_soldier.c:770
GIB_ORGANIC
#define GIB_ORGANIC
Definition: g_local.h:125
VectorMA
void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
Definition: q_shared.c:719
edict_s::maxs
vec3_t maxs
Definition: g_local.h:990
DEFAULT_SHOTGUN_VSPREAD
#define DEFAULT_SHOTGUN_VSPREAD
Definition: g_local.h:673
RANGE_MID
#define RANGE_MID
Definition: g_local.h:121
soldier_move_death4
mmove_t soldier_move_death4
Definition: m_soldier.c:1096
soldier_attack1_refire1
void soldier_attack1_refire1(edict_t *self)
Definition: m_soldier.c:533
soldier_attack1_refire2
void soldier_attack1_refire2(edict_t *self)
Definition: m_soldier.c:547
ThrowHead
void ThrowHead(edict_t *self, char *gibname, int damage, int type)
Definition: g_misc.c:183
soldier_fire1
void soldier_fire1(edict_t *self)
Definition: m_soldier.c:528
soldier_fire8
void soldier_fire8(edict_t *self)
Definition: m_soldier.c:736
soldier_attack
void soldier_attack(edict_t *self)
Definition: m_soldier.c:772
MOVETYPE_TOSS
@ MOVETYPE_TOSS
Definition: g_local.h:198
VectorSet
#define VectorSet(v, x, y, z)
Definition: q_shared.h:168
right
GLdouble right
Definition: qgl_win.c:159
soldier_walk
void soldier_walk(edict_t *self)
Definition: m_soldier.c:283
FRAME_stand322
#define FRAME_stand322
Definition: m_soldier.h:221
soldier_move_death5
mmove_t soldier_move_death5
Definition: m_soldier.c:1127
edict_s::enemy
edict_t * enemy
Definition: g_local.h:1076
AI_DUCKED
#define AI_DUCKED
Definition: g_local.h:140
game_import_t::linkentity
void(* linkentity)(edict_t *ent)
Definition: game.h:138
soldier_dodge
void soldier_dodge(edict_t *self, edict_t *attacker, float eta)
Definition: m_soldier.c:828
monster_fire_shotgun
void monster_fire_shotgun(edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype)
Definition: g_monster.c:41
entity_state_s::angles
vec3_t angles
Definition: q_shared.h:1150
soldier_fire
void soldier_fire(edict_t *self, int flash_number)
Definition: m_soldier.c:462
soldier_duck_hold
void soldier_duck_hold(edict_t *self)
Definition: m_soldier.c:810
sound_pain_light
static int sound_pain_light
Definition: m_soldier.c:35
sound_idle
static int sound_idle
Definition: m_soldier.c:32
FRAME_walk101
#define FRAME_walk101
Definition: m_brain.h:24
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
soldier_move_stand1
mmove_t soldier_move_stand1
Definition: m_soldier.c:98
soldier_move_walk2
mmove_t soldier_move_walk2
Definition: m_soldier.c:281
sound_pain
static int sound_pain
Definition: m_soldier.c:36
edict_s::health
int health
Definition: g_local.h:1057