Quake II RTX doxygen  1.0 dev
m_float.c File Reference
#include "g_local.h"
#include "m_float.h"

Go to the source code of this file.

Functions

void floater_sight (edict_t *self, edict_t *other)
 
void floater_idle (edict_t *self)
 
void floater_dead (edict_t *self)
 
void floater_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
 
void floater_run (edict_t *self)
 
void floater_wham (edict_t *self)
 
void floater_zap (edict_t *self)
 
void floater_fire_blaster (edict_t *self)
 
void floater_stand (edict_t *self)
 
void floater_walk (edict_t *self)
 
void floater_attack (edict_t *self)
 
void floater_melee (edict_t *self)
 
void floater_pain (edict_t *self, edict_t *other, float kick, int damage)
 
void SP_monster_floater (edict_t *self)
 

Variables

static int sound_attack2
 
static int sound_attack3
 
static int sound_death1
 
static int sound_idle
 
static int sound_pain1
 
static int sound_pain2
 
static int sound_sight
 
mframe_t floater_frames_stand1 []
 
mmove_t floater_move_stand1 = {FRAME_stand101, FRAME_stand152, floater_frames_stand1, NULL}
 
mframe_t floater_frames_stand2 []
 
mmove_t floater_move_stand2 = {FRAME_stand201, FRAME_stand252, floater_frames_stand2, NULL}
 
mframe_t floater_frames_activate []
 
mmove_t floater_move_activate = {FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL}
 
mframe_t floater_frames_attack1 []
 
mmove_t floater_move_attack1 = {FRAME_attak101, FRAME_attak114, floater_frames_attack1, floater_run}
 
mframe_t floater_frames_attack2 []
 
mmove_t floater_move_attack2 = {FRAME_attak201, FRAME_attak225, floater_frames_attack2, floater_run}
 
mframe_t floater_frames_attack3 []
 
mmove_t floater_move_attack3 = {FRAME_attak301, FRAME_attak334, floater_frames_attack3, floater_run}
 
mframe_t floater_frames_death []
 
mmove_t floater_move_death = {FRAME_death01, FRAME_death13, floater_frames_death, floater_dead}
 
mframe_t floater_frames_pain1 []
 
mmove_t floater_move_pain1 = {FRAME_pain101, FRAME_pain107, floater_frames_pain1, floater_run}
 
mframe_t floater_frames_pain2 []
 
mmove_t floater_move_pain2 = {FRAME_pain201, FRAME_pain208, floater_frames_pain2, floater_run}
 
mframe_t floater_frames_pain3 []
 
mmove_t floater_move_pain3 = {FRAME_pain301, FRAME_pain312, floater_frames_pain3, floater_run}
 
mframe_t floater_frames_walk []
 
mmove_t floater_move_walk = {FRAME_stand101, FRAME_stand152, floater_frames_walk, NULL}
 
mframe_t floater_frames_run []
 
mmove_t floater_move_run = {FRAME_stand101, FRAME_stand152, floater_frames_run, NULL}
 

Function Documentation

◆ floater_attack()

void floater_attack ( edict_t *  self)

Definition at line 537 of file m_float.c.

538 {
539  self->monsterinfo.currentmove = &floater_move_attack1;
540 }

Referenced by SP_monster_floater().

◆ floater_dead()

void floater_dead ( edict_t *  self)

Definition at line 576 of file m_float.c.

577 {
578  VectorSet(self->mins, -16, -16, -24);
579  VectorSet(self->maxs, 16, 16, -8);
580  self->movetype = MOVETYPE_TOSS;
581  self->svflags |= SVF_DEADMONSTER;
582  self->nextthink = 0;
583  gi.linkentity(self);
584 }

◆ floater_die()

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

Definition at line 586 of file m_float.c.

587 {
588  gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
589  BecomeExplosion1(self);
590 }

Referenced by SP_monster_floater().

◆ floater_fire_blaster()

void floater_fire_blaster ( edict_t *  self)

Definition at line 58 of file m_float.c.

59 {
60  vec3_t start;
61  vec3_t forward, right;
62  vec3_t end;
63  vec3_t dir;
64  int effect;
65 
66  if ((self->s.frame == FRAME_attak104) || (self->s.frame == FRAME_attak107))
67  effect = EF_HYPERBLASTER;
68  else
69  effect = 0;
70  AngleVectors(self->s.angles, forward, right, NULL);
71  G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_FLOAT_BLASTER_1], forward, right, start);
72 
73  VectorCopy(self->enemy->s.origin, end);
74  end[2] += self->enemy->viewheight;
75  VectorSubtract(end, start, dir);
76 
77  monster_fire_blaster(self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect);
78 }

◆ floater_idle()

void floater_idle ( edict_t *  self)

Definition at line 44 of file m_float.c.

45 {
46  gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
47 }

Referenced by SP_monster_floater().

◆ floater_melee()

void floater_melee ( edict_t *  self)

Definition at line 543 of file m_float.c.

544 {
545  if (random() < 0.5)
546  self->monsterinfo.currentmove = &floater_move_attack3;
547  else
548  self->monsterinfo.currentmove = &floater_move_attack2;
549 }

Referenced by SP_monster_floater().

◆ floater_pain()

void floater_pain ( edict_t *  self,
edict_t *  other,
float  kick,
int  damage 
)

Definition at line 552 of file m_float.c.

553 {
554  int n;
555 
556  if (self->health < (self->max_health / 2))
557  self->s.skinnum = 1;
558 
559  if (level.time < self->pain_debounce_time)
560  return;
561 
562  self->pain_debounce_time = level.time + 3;
563  if (skill->value == 3)
564  return; // no pain anims in nightmare
565 
566  n = (rand() + 1) % 3;
567  if (n == 0) {
568  gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
569  self->monsterinfo.currentmove = &floater_move_pain1;
570  } else {
571  gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
572  self->monsterinfo.currentmove = &floater_move_pain2;
573  }
574 }

Referenced by SP_monster_floater().

◆ floater_run()

void floater_run ( edict_t *  self)

Definition at line 488 of file m_float.c.

489 {
490  if (self->monsterinfo.aiflags & AI_STAND_GROUND)
491  self->monsterinfo.currentmove = &floater_move_stand1;
492  else
493  self->monsterinfo.currentmove = &floater_move_run;
494 }

Referenced by SP_monster_floater().

◆ floater_sight()

void floater_sight ( edict_t *  self,
edict_t *  other 
)

Definition at line 39 of file m_float.c.

40 {
41  gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
42 }

Referenced by SP_monster_floater().

◆ floater_stand()

void floater_stand ( edict_t *  self)

Definition at line 193 of file m_float.c.

194 {
195  if (random() <= 0.5)
196  self->monsterinfo.currentmove = &floater_move_stand1;
197  else
198  self->monsterinfo.currentmove = &floater_move_stand2;
199 }

Referenced by SP_monster_floater().

◆ floater_walk()

void floater_walk ( edict_t *  self)

Definition at line 496 of file m_float.c.

497 {
498  self->monsterinfo.currentmove = &floater_move_walk;
499 }

Referenced by SP_monster_floater().

◆ floater_wham()

void floater_wham ( edict_t *  self)

Definition at line 501 of file m_float.c.

502 {
503  static vec3_t aim = {MELEE_DISTANCE, 0, 0};
504  gi.sound(self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
505  fire_hit(self, aim, 5 + rand() % 6, -50);
506 }

◆ floater_zap()

void floater_zap ( edict_t *  self)

Definition at line 508 of file m_float.c.

509 {
510  vec3_t forward, right;
511  vec3_t origin;
512  vec3_t dir;
513  vec3_t offset;
514 
515  VectorSubtract(self->enemy->s.origin, self->s.origin, dir);
516 
517  AngleVectors(self->s.angles, forward, right, NULL);
518  //FIXME use a flash and replace these two lines with the commented one
519  VectorSet(offset, 18.5, -0.9, 10);
520  G_ProjectSource(self->s.origin, offset, forward, right, origin);
521 // G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, origin);
522 
523  gi.sound(self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0);
524 
525  //FIXME use the flash, Luke
526  gi.WriteByte(svc_temp_entity);
527  gi.WriteByte(TE_SPLASH);
528  gi.WriteByte(32);
529  gi.WritePosition(origin);
530  gi.WriteDir(dir);
531  gi.WriteByte(1); //sparks
532  gi.multicast(origin, MULTICAST_PVS);
533 
534  T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN);
535 }

◆ SP_monster_floater()

void SP_monster_floater ( edict_t *  self)

Definition at line 594 of file m_float.c.

595 {
596  if (deathmatch->value) {
597  G_FreeEdict(self);
598  return;
599  }
600 
601  sound_attack2 = gi.soundindex("floater/fltatck2.wav");
602  sound_attack3 = gi.soundindex("floater/fltatck3.wav");
603  sound_death1 = gi.soundindex("floater/fltdeth1.wav");
604  sound_idle = gi.soundindex("floater/fltidle1.wav");
605  sound_pain1 = gi.soundindex("floater/fltpain1.wav");
606  sound_pain2 = gi.soundindex("floater/fltpain2.wav");
607  sound_sight = gi.soundindex("floater/fltsght1.wav");
608 
609  gi.soundindex("floater/fltatck1.wav");
610 
611  self->s.sound = gi.soundindex("floater/fltsrch1.wav");
612 
613  self->movetype = MOVETYPE_STEP;
614  self->solid = SOLID_BBOX;
615  self->s.modelindex = gi.modelindex("models/monsters/float/tris.md2");
616  VectorSet(self->mins, -24, -24, -24);
617  VectorSet(self->maxs, 24, 24, 32);
618 
619  self->health = 200;
620  self->gib_health = -80;
621  self->mass = 300;
622 
623  self->pain = floater_pain;
624  self->die = floater_die;
625 
626  self->monsterinfo.stand = floater_stand;
627  self->monsterinfo.walk = floater_walk;
628  self->monsterinfo.run = floater_run;
629 // self->monsterinfo.dodge = floater_dodge;
630  self->monsterinfo.attack = floater_attack;
631  self->monsterinfo.melee = floater_melee;
632  self->monsterinfo.sight = floater_sight;
633  self->monsterinfo.idle = floater_idle;
634 
635  gi.linkentity(self);
636 
637  if (random() <= 0.5)
638  self->monsterinfo.currentmove = &floater_move_stand1;
639  else
640  self->monsterinfo.currentmove = &floater_move_stand2;
641 
642  self->monsterinfo.scale = MODEL_SCALE;
643 
644  flymonster_start(self);
645 }

Variable Documentation

◆ floater_frames_activate

mframe_t floater_frames_activate[]

Definition at line 201 of file m_float.c.

◆ floater_frames_attack1

mframe_t floater_frames_attack1[]
Initial value:
= {
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL }
}

Definition at line 235 of file m_float.c.

◆ floater_frames_attack2

mframe_t floater_frames_attack2[]
Initial value:
= {
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL },
{ ai_charge, 0, NULL }
}

Definition at line 253 of file m_float.c.

◆ floater_frames_attack3

mframe_t floater_frames_attack3[]

Definition at line 282 of file m_float.c.

◆ floater_frames_death

mframe_t floater_frames_death[]
Initial value:
= {
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL }
}

Definition at line 320 of file m_float.c.

◆ floater_frames_pain1

mframe_t floater_frames_pain1[]
Initial value:
= {
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL }
}

Definition at line 337 of file m_float.c.

◆ floater_frames_pain2

mframe_t floater_frames_pain2[]
Initial value:
= {
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL }
}

Definition at line 348 of file m_float.c.

◆ floater_frames_pain3

mframe_t floater_frames_pain3[]
Initial value:
= {
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL },
{ ai_move, 0, NULL }
}

Definition at line 360 of file m_float.c.

◆ floater_frames_run

mframe_t floater_frames_run[]

Definition at line 432 of file m_float.c.

◆ floater_frames_stand1

mframe_t floater_frames_stand1[]

Definition at line 81 of file m_float.c.

◆ floater_frames_stand2

mframe_t floater_frames_stand2[]

Definition at line 137 of file m_float.c.

◆ floater_frames_walk

mframe_t floater_frames_walk[]

Definition at line 376 of file m_float.c.

◆ floater_move_activate

mmove_t floater_move_activate = {FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL}

Definition at line 233 of file m_float.c.

◆ floater_move_attack1

Definition at line 251 of file m_float.c.

Referenced by floater_attack().

◆ floater_move_attack2

Definition at line 280 of file m_float.c.

Referenced by floater_melee().

◆ floater_move_attack3

Definition at line 318 of file m_float.c.

Referenced by floater_melee().

◆ floater_move_death

Definition at line 335 of file m_float.c.

◆ floater_move_pain1

Definition at line 346 of file m_float.c.

Referenced by floater_pain().

◆ floater_move_pain2

Definition at line 358 of file m_float.c.

Referenced by floater_pain().

◆ floater_move_pain3

Definition at line 374 of file m_float.c.

◆ floater_move_run

Definition at line 486 of file m_float.c.

Referenced by floater_run().

◆ floater_move_stand1

Definition at line 135 of file m_float.c.

Referenced by floater_run(), floater_stand(), and SP_monster_floater().

◆ floater_move_stand2

Definition at line 191 of file m_float.c.

Referenced by floater_stand(), and SP_monster_floater().

◆ floater_move_walk

Definition at line 430 of file m_float.c.

Referenced by floater_walk().

◆ sound_attack2

int sound_attack2
static

Definition at line 30 of file m_float.c.

Referenced by floater_zap(), and SP_monster_floater().

◆ sound_attack3

int sound_attack3
static

Definition at line 31 of file m_float.c.

Referenced by floater_wham(), and SP_monster_floater().

◆ sound_death1

int sound_death1
static

Definition at line 32 of file m_float.c.

Referenced by floater_die(), and SP_monster_floater().

◆ sound_idle

int sound_idle
static

Definition at line 33 of file m_float.c.

Referenced by floater_idle(), and SP_monster_floater().

◆ sound_pain1

int sound_pain1
static

Definition at line 34 of file m_float.c.

Referenced by floater_pain(), and SP_monster_floater().

◆ sound_pain2

int sound_pain2
static

Definition at line 35 of file m_float.c.

Referenced by floater_pain(), and SP_monster_floater().

◆ sound_sight

int sound_sight
static

Definition at line 36 of file m_float.c.

Referenced by floater_sight(), and SP_monster_floater().

gi
game_import_t gi
Definition: g_main.c:23
deathmatch
cvar_t * deathmatch
Definition: g_main.c:33
G_ProjectSource
void G_ProjectSource(const vec3_t point, const vec3_t distance, const vec3_t forward, const vec3_t right, vec3_t result)
Definition: g_utils.c:23
sound_pain1
static int sound_pain1
Definition: m_float.c:34
MELEE_DISTANCE
#define MELEE_DISTANCE
Definition: g_local.h:82
ai_charge
void ai_charge(edict_t *self, float dist)
Definition: g_ai.c:175
sound_death1
static int sound_death1
Definition: m_float.c:32
floater_move_stand2
mmove_t floater_move_stand2
Definition: m_float.c:191
floater_stand
void floater_stand(edict_t *self)
Definition: m_float.c:193
sound_attack3
static int sound_attack3
Definition: m_float.c:31
floater_walk
void floater_walk(edict_t *self)
Definition: m_float.c:496
DAMAGE_ENERGY
#define DAMAGE_ENERGY
Definition: g_local.h:649
AI_STAND_GROUND
#define AI_STAND_GROUND
Definition: g_local.h:126
MODEL_SCALE
#define MODEL_SCALE
Definition: m_actor.h:504
BecomeExplosion1
void BecomeExplosion1(edict_t *self)
Definition: g_misc.c:297
floater_idle
void floater_idle(edict_t *self)
Definition: m_float.c:44
floater_move_run
mmove_t floater_move_run
Definition: m_float.c:486
fire_hit
qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick)
Definition: g_weapon.c:59
T_Damage
void T_Damage(edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod)
Definition: g_combat.c:358
MOVETYPE_STEP
@ MOVETYPE_STEP
Definition: g_local.h:192
floater_move_attack3
mmove_t floater_move_attack3
Definition: m_float.c:318
floater_wham
void floater_wham(edict_t *self)
Definition: m_float.c:501
FRAME_attak107
#define FRAME_attak107
Definition: m_boss31.h:28
floater_move_pain1
mmove_t floater_move_pain1
Definition: m_float.c:346
sound_idle
static int sound_idle
Definition: m_float.c:33
vec3_origin
vec3_t vec3_origin
Definition: shared.c:21
G_FreeEdict
void G_FreeEdict(edict_t *e)
Definition: g_utils.c:421
floater_attack
void floater_attack(edict_t *self)
Definition: m_float.c:537
floater_run
void floater_run(edict_t *self)
Definition: m_float.c:488
FRAME_attak104
#define FRAME_attak104
Definition: m_boss31.h:25
forward
static vec3_t forward
Definition: p_view.c:27
svc_temp_entity
#define svc_temp_entity
Definition: g_local.h:38
sound_sight
static int sound_sight
Definition: m_float.c:36
floater_move_attack1
mmove_t floater_move_attack1
Definition: m_float.c:251
origin
static vec3_t origin
Definition: mesh.c:27
random
#define random()
Definition: g_local.h:504
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: shared.c:23
floater_pain
void floater_pain(edict_t *self, edict_t *other, float kick, int damage)
Definition: m_float.c:552
floater_sight
void floater_sight(edict_t *self, edict_t *other)
Definition: m_float.c:39
floater_move_pain2
mmove_t floater_move_pain2
Definition: m_float.c:358
skill
cvar_t * skill
Definition: g_main.c:36
ai_move
void ai_move(edict_t *self, float dist)
Definition: g_ai.c:86
level_locals_t::time
float time
Definition: g_local.h:299
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:49
right
static vec3_t right
Definition: p_view.c:27
level
level_locals_t level
Definition: g_main.c:22
MOD_UNKNOWN
#define MOD_UNKNOWN
Definition: g_local.h:457
monster_flash_offset
const vec3_t monster_flash_offset[256]
Definition: m_flash.c:25
sound_pain2
static int sound_pain2
Definition: m_float.c:35
MOVETYPE_TOSS
@ MOVETYPE_TOSS
Definition: g_local.h:194
floater_melee
void floater_melee(edict_t *self)
Definition: m_float.c:543
floater_move_attack2
mmove_t floater_move_attack2
Definition: m_float.c:280
floater_die
void floater_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
Definition: m_float.c:586
floater_fire_blaster
void floater_fire_blaster(edict_t *self)
Definition: m_float.c:58
floater_move_stand1
mmove_t floater_move_stand1
Definition: m_float.c:135
sound_attack2
static int sound_attack2
Definition: m_float.c:30
floater_move_walk
mmove_t floater_move_walk
Definition: m_float.c:430
flymonster_start
void flymonster_start(edict_t *self)
Definition: g_monster.c:653