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

Go to the source code of this file.

Macros

#define FLIPPER_RUN_SPEED   24
 

Functions

void flipper_stand (edict_t *self)
 
void flipper_run_loop (edict_t *self)
 
void flipper_run (edict_t *self)
 
void flipper_walk (edict_t *self)
 
void flipper_start_run (edict_t *self)
 
void flipper_bite (edict_t *self)
 
void flipper_preattack (edict_t *self)
 
void flipper_melee (edict_t *self)
 
void flipper_pain (edict_t *self, edict_t *other, float kick, int damage)
 
void flipper_dead (edict_t *self)
 
void flipper_sight (edict_t *self, edict_t *other)
 
void flipper_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
 
void SP_monster_flipper (edict_t *self)
 

Variables

static int sound_chomp
 
static int sound_attack
 
static int sound_pain1
 
static int sound_pain2
 
static int sound_death
 
static int sound_idle
 
static int sound_search
 
static int sound_sight
 
mframe_t flipper_frames_stand []
 
mmove_t flipper_move_stand = {FRAME_flphor01, FRAME_flphor01, flipper_frames_stand, NULL}
 
mframe_t flipper_frames_run []
 
mmove_t flipper_move_run_loop = {FRAME_flpver06, FRAME_flpver29, flipper_frames_run, NULL}
 
mframe_t flipper_frames_run_start []
 
mmove_t flipper_move_run_start = {FRAME_flpver01, FRAME_flpver06, flipper_frames_run_start, flipper_run_loop}
 
mframe_t flipper_frames_walk []
 
mmove_t flipper_move_walk = {FRAME_flphor01, FRAME_flphor24, flipper_frames_walk, NULL}
 
mframe_t flipper_frames_start_run []
 
mmove_t flipper_move_start_run = {FRAME_flphor01, FRAME_flphor05, flipper_frames_start_run, NULL}
 
mframe_t flipper_frames_pain2 []
 
mmove_t flipper_move_pain2 = {FRAME_flppn101, FRAME_flppn105, flipper_frames_pain2, flipper_run}
 
mframe_t flipper_frames_pain1 []
 
mmove_t flipper_move_pain1 = {FRAME_flppn201, FRAME_flppn205, flipper_frames_pain1, flipper_run}
 
mframe_t flipper_frames_attack []
 
mmove_t flipper_move_attack = {FRAME_flpbit01, FRAME_flpbit20, flipper_frames_attack, flipper_run}
 
mframe_t flipper_frames_death []
 
mmove_t flipper_move_death = {FRAME_flpdth01, FRAME_flpdth56, flipper_frames_death, flipper_dead}
 

Macro Definition Documentation

◆ FLIPPER_RUN_SPEED

#define FLIPPER_RUN_SPEED   24

Definition at line 53 of file m_flipper.c.

Function Documentation

◆ flipper_bite()

void flipper_bite ( edict_t *  self)

Definition at line 171 of file m_flipper.c.

172 {
173  vec3_t aim;
174 
175  VectorSet(aim, MELEE_DISTANCE, 0, 0);
176  fire_hit(self, aim, 5, 0);
177 }

◆ flipper_dead()

void flipper_dead ( edict_t *  self)

Definition at line 238 of file m_flipper.c.

239 {
240  VectorSet(self->mins, -16, -16, -24);
241  VectorSet(self->maxs, 16, 16, -8);
242  self->movetype = MOVETYPE_TOSS;
243  self->svflags |= SVF_DEADMONSTER;
244  self->nextthink = 0;
245  gi.linkentity(self);
246 }

◆ flipper_die()

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

Definition at line 318 of file m_flipper.c.

319 {
320  int n;
321 
322 // check for gib
323  if (self->health <= self->gib_health) {
324  gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0);
325  for (n = 0; n < 2; n++)
326  ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC);
327  for (n = 0; n < 2; n++)
328  ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
329  ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
330  self->deadflag = DEAD_DEAD;
331  return;
332  }
333 
334  if (self->deadflag == DEAD_DEAD)
335  return;
336 
337 // regular death
338  gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
339  self->deadflag = DEAD_DEAD;
340  self->takedamage = DAMAGE_YES;
341  self->monsterinfo.currentmove = &flipper_move_death;
342 }

Referenced by SP_monster_flipper().

◆ flipper_melee()

void flipper_melee ( edict_t *  self)

Definition at line 208 of file m_flipper.c.

209 {
210  self->monsterinfo.currentmove = &flipper_move_attack;
211 }

Referenced by SP_monster_flipper().

◆ flipper_pain()

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

Definition at line 213 of file m_flipper.c.

214 {
215  int n;
216 
217  if (self->health < (self->max_health / 2))
218  self->s.skinnum = 1;
219 
220  if (level.time < self->pain_debounce_time)
221  return;
222 
223  self->pain_debounce_time = level.time + 3;
224 
225  if (skill->value == 3)
226  return; // no pain anims in nightmare
227 
228  n = (rand() + 1) % 2;
229  if (n == 0) {
230  gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
231  self->monsterinfo.currentmove = &flipper_move_pain1;
232  } else {
233  gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
234  self->monsterinfo.currentmove = &flipper_move_pain2;
235  }
236 }

Referenced by SP_monster_flipper().

◆ flipper_preattack()

void flipper_preattack ( edict_t *  self)

Definition at line 179 of file m_flipper.c.

180 {
181  gi.sound(self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0);
182 }

◆ flipper_run()

void flipper_run ( edict_t *  self)

Definition at line 100 of file m_flipper.c.

101 {
102  self->monsterinfo.currentmove = &flipper_move_run_start;
103 }

◆ flipper_run_loop()

void flipper_run_loop ( edict_t *  self)

Definition at line 85 of file m_flipper.c.

86 {
87  self->monsterinfo.currentmove = &flipper_move_run_loop;
88 }

◆ flipper_sight()

void flipper_sight ( edict_t *  self,
edict_t *  other 
)

Definition at line 313 of file m_flipper.c.

314 {
315  gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
316 }

Referenced by SP_monster_flipper().

◆ flipper_stand()

void flipper_stand ( edict_t *  self)

Definition at line 48 of file m_flipper.c.

49 {
50  self->monsterinfo.currentmove = &flipper_move_stand;
51 }

Referenced by SP_monster_flipper().

◆ flipper_start_run()

void flipper_start_run ( edict_t *  self)

Definition at line 148 of file m_flipper.c.

149 {
150  self->monsterinfo.currentmove = &flipper_move_start_run;
151 }

Referenced by SP_monster_flipper().

◆ flipper_walk()

void flipper_walk ( edict_t *  self)

Definition at line 134 of file m_flipper.c.

135 {
136  self->monsterinfo.currentmove = &flipper_move_walk;
137 }

Referenced by SP_monster_flipper().

◆ SP_monster_flipper()

void SP_monster_flipper ( edict_t *  self)

Definition at line 346 of file m_flipper.c.

347 {
348  if (deathmatch->value) {
349  G_FreeEdict(self);
350  return;
351  }
352 
353  sound_pain1 = gi.soundindex("flipper/flppain1.wav");
354  sound_pain2 = gi.soundindex("flipper/flppain2.wav");
355  sound_death = gi.soundindex("flipper/flpdeth1.wav");
356  sound_chomp = gi.soundindex("flipper/flpatck1.wav");
357  sound_attack = gi.soundindex("flipper/flpatck2.wav");
358  sound_idle = gi.soundindex("flipper/flpidle1.wav");
359  sound_search = gi.soundindex("flipper/flpsrch1.wav");
360  sound_sight = gi.soundindex("flipper/flpsght1.wav");
361 
362  self->movetype = MOVETYPE_STEP;
363  self->solid = SOLID_BBOX;
364  self->s.modelindex = gi.modelindex("models/monsters/flipper/tris.md2");
365  VectorSet(self->mins, -16, -16, 0);
366  VectorSet(self->maxs, 16, 16, 32);
367 
368  self->health = 50;
369  self->gib_health = -30;
370  self->mass = 100;
371 
372  self->pain = flipper_pain;
373  self->die = flipper_die;
374 
375  self->monsterinfo.stand = flipper_stand;
376  self->monsterinfo.walk = flipper_walk;
377  self->monsterinfo.run = flipper_start_run;
378  self->monsterinfo.melee = flipper_melee;
379  self->monsterinfo.sight = flipper_sight;
380 
381  gi.linkentity(self);
382 
383  self->monsterinfo.currentmove = &flipper_move_stand;
384  self->monsterinfo.scale = MODEL_SCALE;
385 
386  swimmonster_start(self);
387 }

Variable Documentation

◆ flipper_frames_attack

mframe_t flipper_frames_attack[]
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 }
}

Definition at line 184 of file m_flipper.c.

◆ flipper_frames_death

mframe_t flipper_frames_death[]

Definition at line 248 of file m_flipper.c.

◆ flipper_frames_pain1

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

Definition at line 162 of file m_flipper.c.

◆ flipper_frames_pain2

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

Definition at line 153 of file m_flipper.c.

◆ flipper_frames_run

mframe_t flipper_frames_run[]
Initial value:

Definition at line 55 of file m_flipper.c.

◆ flipper_frames_run_start

mframe_t flipper_frames_run_start[]
Initial value:
= {
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
{ ai_run, 8, NULL }
}

Definition at line 90 of file m_flipper.c.

◆ flipper_frames_stand

mframe_t flipper_frames_stand[]
Initial value:
= {
{ ai_stand, 0, NULL }
}

Definition at line 42 of file m_flipper.c.

◆ flipper_frames_start_run

mframe_t flipper_frames_start_run[]
Initial value:
= {
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
{ ai_run, 8, NULL },
}

Definition at line 139 of file m_flipper.c.

◆ flipper_frames_walk

mframe_t flipper_frames_walk[]
Initial value:
= {
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL },
{ ai_walk, 4, NULL }
}

Definition at line 106 of file m_flipper.c.

◆ flipper_move_attack

Definition at line 206 of file m_flipper.c.

Referenced by flipper_melee().

◆ flipper_move_death

Definition at line 311 of file m_flipper.c.

Referenced by flipper_die().

◆ flipper_move_pain1

Definition at line 169 of file m_flipper.c.

Referenced by flipper_pain().

◆ flipper_move_pain2

Definition at line 160 of file m_flipper.c.

Referenced by flipper_pain().

◆ flipper_move_run_loop

mmove_t flipper_move_run_loop = {FRAME_flpver06, FRAME_flpver29, flipper_frames_run, NULL}

Definition at line 83 of file m_flipper.c.

Referenced by flipper_run_loop().

◆ flipper_move_run_start

Definition at line 98 of file m_flipper.c.

Referenced by flipper_run().

◆ flipper_move_stand

Definition at line 46 of file m_flipper.c.

Referenced by flipper_stand(), and SP_monster_flipper().

◆ flipper_move_start_run

mmove_t flipper_move_start_run = {FRAME_flphor01, FRAME_flphor05, flipper_frames_start_run, NULL}

Definition at line 146 of file m_flipper.c.

Referenced by flipper_start_run().

◆ flipper_move_walk

Definition at line 132 of file m_flipper.c.

Referenced by flipper_walk().

◆ sound_attack

int sound_attack
static

Definition at line 31 of file m_flipper.c.

Referenced by SP_monster_flipper().

◆ sound_chomp

int sound_chomp
static

Definition at line 30 of file m_flipper.c.

Referenced by flipper_preattack(), and SP_monster_flipper().

◆ sound_death

int sound_death
static

Definition at line 34 of file m_flipper.c.

Referenced by flipper_die(), and SP_monster_flipper().

◆ sound_idle

int sound_idle
static

Definition at line 35 of file m_flipper.c.

Referenced by SP_monster_flipper().

◆ sound_pain1

int sound_pain1
static

Definition at line 32 of file m_flipper.c.

Referenced by flipper_pain(), and SP_monster_flipper().

◆ sound_pain2

int sound_pain2
static

Definition at line 33 of file m_flipper.c.

Referenced by flipper_pain(), and SP_monster_flipper().

◆ sound_search

int sound_search
static

Definition at line 36 of file m_flipper.c.

Referenced by SP_monster_flipper().

◆ sound_sight

int sound_sight
static

Definition at line 37 of file m_flipper.c.

Referenced by flipper_sight(), and SP_monster_flipper().

gi
game_import_t gi
Definition: g_main.c:23
sound_sight
static int sound_sight
Definition: m_flipper.c:37
flipper_move_run_loop
mmove_t flipper_move_run_loop
Definition: m_flipper.c:83
deathmatch
cvar_t * deathmatch
Definition: g_main.c:33
flipper_melee
void flipper_melee(edict_t *self)
Definition: m_flipper.c:208
sound_chomp
static int sound_chomp
Definition: m_flipper.c:30
DEAD_DEAD
#define DEAD_DEAD
Definition: g_local.h:112
ThrowGib
void ThrowGib(edict_t *self, char *gibname, int damage, int type)
Definition: g_misc.c:130
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
flipper_move_stand
mmove_t flipper_move_stand
Definition: m_flipper.c:46
flipper_stand
void flipper_stand(edict_t *self)
Definition: m_flipper.c:48
flipper_preattack
void flipper_preattack(edict_t *self)
Definition: m_flipper.c:179
flipper_move_walk
mmove_t flipper_move_walk
Definition: m_flipper.c:132
sound_idle
static int sound_idle
Definition: m_flipper.c:35
flipper_move_attack
mmove_t flipper_move_attack
Definition: m_flipper.c:206
flipper_walk
void flipper_walk(edict_t *self)
Definition: m_flipper.c:134
MODEL_SCALE
#define MODEL_SCALE
Definition: m_actor.h:504
DAMAGE_YES
@ DAMAGE_YES
Definition: g_local.h:88
flipper_move_death
mmove_t flipper_move_death
Definition: m_flipper.c:311
flipper_move_start_run
mmove_t flipper_move_start_run
Definition: m_flipper.c:146
fire_hit
qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick)
Definition: g_weapon.c:59
sound_attack
static int sound_attack
Definition: m_flipper.c:31
MOVETYPE_STEP
@ MOVETYPE_STEP
Definition: g_local.h:192
flipper_start_run
void flipper_start_run(edict_t *self)
Definition: m_flipper.c:148
flipper_move_pain2
mmove_t flipper_move_pain2
Definition: m_flipper.c:160
flipper_bite
void flipper_bite(edict_t *self)
Definition: m_flipper.c:171
flipper_sight
void flipper_sight(edict_t *self, edict_t *other)
Definition: m_flipper.c:313
G_FreeEdict
void G_FreeEdict(edict_t *e)
Definition: g_utils.c:421
sound_pain1
static int sound_pain1
Definition: m_flipper.c:32
sound_search
static int sound_search
Definition: m_flipper.c:36
swimmonster_start
void swimmonster_start(edict_t *self)
Definition: g_monster.c:673
FLIPPER_RUN_SPEED
#define FLIPPER_RUN_SPEED
Definition: m_flipper.c:53
ai_walk
void ai_walk(edict_t *self, float dist)
Definition: g_ai.c:148
flipper_pain
void flipper_pain(edict_t *self, edict_t *other, float kick, int damage)
Definition: m_flipper.c:213
flipper_die
void flipper_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
Definition: m_flipper.c:318
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
ai_run
void ai_run(edict_t *self, float dist)
Definition: g_ai.c:821
flipper_move_run_start
mmove_t flipper_move_run_start
Definition: m_flipper.c:98
GIB_ORGANIC
#define GIB_ORGANIC
Definition: g_local.h:122
flipper_run
void flipper_run(edict_t *self)
Definition: m_flipper.c:100
sound_pain2
static int sound_pain2
Definition: m_flipper.c:33
level
level_locals_t level
Definition: g_main.c:22
flipper_move_pain1
mmove_t flipper_move_pain1
Definition: m_flipper.c:169
sound_death
static int sound_death
Definition: m_flipper.c:34
ThrowHead
void ThrowHead(edict_t *self, char *gibname, int damage, int type)
Definition: g_misc.c:175
MOVETYPE_TOSS
@ MOVETYPE_TOSS
Definition: g_local.h:194
ai_stand
void ai_stand(edict_t *self, float dist)
Definition: g_ai.c:100