icculus quake2 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 56 of file m_flipper.c.

Function Documentation

◆ flipper_bite()

void flipper_bite ( edict_t self)

Definition at line 180 of file m_flipper.c.

181 {
182  vec3_t aim;
183 
184  VectorSet (aim, MELEE_DISTANCE, 0, 0);
185  fire_hit (self, aim, 5, 0);
186 }

◆ flipper_dead()

void flipper_dead ( edict_t self)

Definition at line 251 of file m_flipper.c.

252 {
253  VectorSet (self->mins, -16, -16, -24);
254  VectorSet (self->maxs, 16, 16, -8);
255  self->movetype = MOVETYPE_TOSS;
256  self->svflags |= SVF_DEADMONSTER;
257  self->nextthink = 0;
258  gi.linkentity (self);
259 }

◆ flipper_die()

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

Definition at line 332 of file m_flipper.c.

333 {
334  int n;
335 
336 // check for gib
337  if (self->health <= self->gib_health)
338  {
339  gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/udeath.wav"), 1, ATTN_NORM, 0);
340  for (n= 0; n < 2; n++)
341  ThrowGib (self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC);
342  for (n= 0; n < 2; n++)
343  ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
344  ThrowHead (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
345  self->deadflag = DEAD_DEAD;
346  return;
347  }
348 
349  if (self->deadflag == DEAD_DEAD)
350  return;
351 
352 // regular death
353  gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
354  self->deadflag = DEAD_DEAD;
355  self->takedamage = DAMAGE_YES;
356  self->monsterinfo.currentmove = &flipper_move_death;
357 }

Referenced by SP_monster_flipper().

◆ flipper_melee()

void flipper_melee ( edict_t self)

Definition at line 218 of file m_flipper.c.

219 {
220  self->monsterinfo.currentmove = &flipper_move_attack;
221 }

Referenced by SP_monster_flipper().

◆ flipper_pain()

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

Definition at line 223 of file m_flipper.c.

224 {
225  int n;
226 
227  if (self->health < (self->max_health / 2))
228  self->s.skinnum = 1;
229 
230  if (level.time < self->pain_debounce_time)
231  return;
232 
233  self->pain_debounce_time = level.time + 3;
234 
235  if (skill->value == 3)
236  return; // no pain anims in nightmare
237 
238  n = (rand() + 1) % 2;
239  if (n == 0)
240  {
241  gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
242  self->monsterinfo.currentmove = &flipper_move_pain1;
243  }
244  else
245  {
246  gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
247  self->monsterinfo.currentmove = &flipper_move_pain2;
248  }
249 }

Referenced by SP_monster_flipper().

◆ flipper_preattack()

void flipper_preattack ( edict_t self)

Definition at line 188 of file m_flipper.c.

189 {
190  gi.sound (self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0);
191 }

◆ flipper_run()

void flipper_run ( edict_t self)

Definition at line 105 of file m_flipper.c.

106 {
107  self->monsterinfo.currentmove = &flipper_move_run_start;
108 }

◆ flipper_run_loop()

void flipper_run_loop ( edict_t self)

Definition at line 89 of file m_flipper.c.

90 {
91  self->monsterinfo.currentmove = &flipper_move_run_loop;
92 }

◆ flipper_sight()

void flipper_sight ( edict_t self,
edict_t other 
)

Definition at line 327 of file m_flipper.c.

328 {
329  gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
330 }

Referenced by SP_monster_flipper().

◆ flipper_stand()

void flipper_stand ( edict_t self)

Definition at line 51 of file m_flipper.c.

52 {
53  self->monsterinfo.currentmove = &flipper_move_stand;
54 }

Referenced by SP_monster_flipper().

◆ flipper_start_run()

void flipper_start_run ( edict_t self)

Definition at line 155 of file m_flipper.c.

156 {
157  self->monsterinfo.currentmove = &flipper_move_start_run;
158 }

Referenced by SP_monster_flipper().

◆ flipper_walk()

void flipper_walk ( edict_t self)

Definition at line 140 of file m_flipper.c.

141 {
142  self->monsterinfo.currentmove = &flipper_move_walk;
143 }

Referenced by SP_monster_flipper().

◆ SP_monster_flipper()

void SP_monster_flipper ( edict_t self)

Definition at line 361 of file m_flipper.c.

362 {
363  if (deathmatch->value)
364  {
365  G_FreeEdict (self);
366  return;
367  }
368 
369  sound_pain1 = gi.soundindex ("flipper/flppain1.wav");
370  sound_pain2 = gi.soundindex ("flipper/flppain2.wav");
371  sound_death = gi.soundindex ("flipper/flpdeth1.wav");
372  sound_chomp = gi.soundindex ("flipper/flpatck1.wav");
373  sound_attack = gi.soundindex ("flipper/flpatck2.wav");
374  sound_idle = gi.soundindex ("flipper/flpidle1.wav");
375  sound_search = gi.soundindex ("flipper/flpsrch1.wav");
376  sound_sight = gi.soundindex ("flipper/flpsght1.wav");
377 
378  self->movetype = MOVETYPE_STEP;
379  self->solid = SOLID_BBOX;
380  self->s.modelindex = gi.modelindex ("models/monsters/flipper/tris.md2");
381  VectorSet (self->mins, -16, -16, 0);
382  VectorSet (self->maxs, 16, 16, 32);
383 
384  self->health = 50;
385  self->gib_health = -30;
386  self->mass = 100;
387 
388  self->pain = flipper_pain;
389  self->die = flipper_die;
390 
391  self->monsterinfo.stand = flipper_stand;
392  self->monsterinfo.walk = flipper_walk;
393  self->monsterinfo.run = flipper_start_run;
394  self->monsterinfo.melee = flipper_melee;
395  self->monsterinfo.sight = flipper_sight;
396 
397  gi.linkentity (self);
398 
399  self->monsterinfo.currentmove = &flipper_move_stand;
400  self->monsterinfo.scale = MODEL_SCALE;
401 
402  swimmonster_start (self);
403 }

Variable Documentation

◆ flipper_frames_attack

mframe_t flipper_frames_attack[]
Initial value:

Definition at line 193 of file m_flipper.c.

◆ flipper_frames_death

mframe_t flipper_frames_death[]

Definition at line 261 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 170 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 160 of file m_flipper.c.

◆ flipper_frames_run

◆ 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 94 of file m_flipper.c.

◆ flipper_frames_stand

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

Definition at line 44 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 145 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 111 of file m_flipper.c.

◆ flipper_move_attack

Definition at line 216 of file m_flipper.c.

Referenced by flipper_melee().

◆ flipper_move_death

Definition at line 325 of file m_flipper.c.

Referenced by flipper_die().

◆ flipper_move_pain1

Definition at line 178 of file m_flipper.c.

Referenced by flipper_pain().

◆ flipper_move_pain2

Definition at line 168 of file m_flipper.c.

Referenced by flipper_pain().

◆ flipper_move_run_loop

Definition at line 87 of file m_flipper.c.

Referenced by flipper_run_loop().

◆ flipper_move_run_start

Definition at line 103 of file m_flipper.c.

Referenced by flipper_run().

◆ flipper_move_stand

Definition at line 49 of file m_flipper.c.

Referenced by flipper_stand(), and SP_monster_flipper().

◆ flipper_move_start_run

Definition at line 153 of file m_flipper.c.

Referenced by flipper_start_run().

◆ flipper_move_walk

Definition at line 138 of file m_flipper.c.

Referenced by flipper_walk().

◆ sound_attack

int sound_attack
static

Definition at line 33 of file m_flipper.c.

Referenced by SP_monster_flipper().

◆ sound_chomp

int sound_chomp
static

Definition at line 32 of file m_flipper.c.

Referenced by flipper_preattack(), and SP_monster_flipper().

◆ sound_death

int sound_death
static

Definition at line 36 of file m_flipper.c.

Referenced by flipper_die(), and SP_monster_flipper().

◆ sound_idle

int sound_idle
static

Definition at line 37 of file m_flipper.c.

Referenced by SP_monster_flipper().

◆ sound_pain1

int sound_pain1
static

Definition at line 34 of file m_flipper.c.

Referenced by flipper_pain(), and SP_monster_flipper().

◆ sound_pain2

int sound_pain2
static

Definition at line 35 of file m_flipper.c.

Referenced by flipper_pain(), and SP_monster_flipper().

◆ sound_search

int sound_search
static

Definition at line 38 of file m_flipper.c.

Referenced by SP_monster_flipper().

◆ sound_sight

int sound_sight
static

Definition at line 39 of file m_flipper.c.

Referenced by flipper_sight(), and SP_monster_flipper().

gi
game_import_t gi
Definition: g_main.c:25
sound_sight
static int sound_sight
Definition: m_flipper.c:39
flipper_move_run_loop
mmove_t flipper_move_run_loop
Definition: m_flipper.c:87
deathmatch
cvar_t * deathmatch
Definition: g_main.c:35
flipper_melee
void flipper_melee(edict_t *self)
Definition: m_flipper.c:218
sound_chomp
static int sound_chomp
Definition: m_flipper.c:32
DEAD_DEAD
#define DEAD_DEAD
Definition: g_local.h:113
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:1053
MELEE_DISTANCE
#define MELEE_DISTANCE
Definition: g_local.h:80
ai_charge
void ai_charge(edict_t *self, float dist)
Definition: g_ai.c:194
flipper_move_stand
mmove_t flipper_move_stand
Definition: m_flipper.c:49
SOLID_BBOX
@ SOLID_BBOX
Definition: game.h:37
flipper_stand
void flipper_stand(edict_t *self)
Definition: m_flipper.c:51
flipper_preattack
void flipper_preattack(edict_t *self)
Definition: m_flipper.c:188
flipper_move_walk
mmove_t flipper_move_walk
Definition: m_flipper.c:138
sound_idle
static int sound_idle
Definition: m_flipper.c:37
flipper_move_attack
mmove_t flipper_move_attack
Definition: m_flipper.c:216
flipper_walk
void flipper_walk(edict_t *self)
Definition: m_flipper.c:140
MODEL_SCALE
#define MODEL_SCALE
Definition: m_actor.h:506
edict_s::max_health
int max_health
Definition: g_local.h:1052
DAMAGE_YES
@ DAMAGE_YES
Definition: g_local.h:87
game_import_t::sound
void(* sound)(edict_t *ent, int channel, int soundindex, float volume, float attenuation, float timeofs)
Definition: game.h:109
flipper_move_death
mmove_t flipper_move_death
Definition: m_flipper.c:325
flipper_move_start_run
mmove_t flipper_move_start_run
Definition: m_flipper.c:153
edict_s::mins
vec3_t mins
Definition: g_local.h:984
fire_hit
qboolean fire_hit(edict_t *self, vec3_t aim, int damage, int kick)
Definition: g_weapon.c:63
ATTN_NORM
#define ATTN_NORM
Definition: q_shared.h:1019
sound_attack
static int sound_attack
Definition: m_flipper.c:33
MOVETYPE_STEP
@ MOVETYPE_STEP
Definition: g_local.h:194
flipper_start_run
void flipper_start_run(edict_t *self)
Definition: m_flipper.c:155
flipper_move_pain2
mmove_t flipper_move_pain2
Definition: m_flipper.c:168
flipper_bite
void flipper_bite(edict_t *self)
Definition: m_flipper.c:180
SVF_DEADMONSTER
#define SVF_DEADMONSTER
Definition: game.h:28
CHAN_VOICE
#define CHAN_VOICE
Definition: q_shared.h:1009
flipper_sight
void flipper_sight(edict_t *self, edict_t *other)
Definition: m_flipper.c:327
G_FreeEdict
void G_FreeEdict(edict_t *e)
Definition: g_utils.c:452
game_import_t::soundindex
int(* soundindex)(char *name)
Definition: game.h:122
sound_pain1
static int sound_pain1
Definition: m_flipper.c:34
game_import_t::modelindex
int(* modelindex)(char *name)
Definition: game.h:121
sound_search
static int sound_search
Definition: m_flipper.c:38
swimmonster_start
void swimmonster_start(edict_t *self)
Definition: g_monster.c:735
edict_s::deadflag
int deadflag
Definition: g_local.h:1054
cvar_s::value
float value
Definition: q_shared.h:324
FLIPPER_RUN_SPEED
#define FLIPPER_RUN_SPEED
Definition: m_flipper.c:56
ai_walk
void ai_walk(edict_t *self, float dist)
Definition: g_ai.c:163
NULL
#define NULL
Definition: q_shared.h:60
flipper_pain
void flipper_pain(edict_t *self, edict_t *other, float kick, int damage)
Definition: m_flipper.c:223
flipper_die
void flipper_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
Definition: m_flipper.c:332
skill
cvar_t * skill
Definition: g_main.c:38
ai_move
void ai_move(edict_t *self, float dist)
Definition: g_ai.c:92
edict_s::pain_debounce_time
float pain_debounce_time
Definition: g_local.h:1046
CHAN_WEAPON
#define CHAN_WEAPON
Definition: q_shared.h:1008
level
GLint level
Definition: qgl_win.c:116
ai_run
void ai_run(edict_t *self, float dist)
Definition: g_ai.c:915
flipper_move_run_start
mmove_t flipper_move_run_start
Definition: m_flipper.c:103
GIB_ORGANIC
#define GIB_ORGANIC
Definition: g_local.h:123
flipper_run
void flipper_run(edict_t *self)
Definition: m_flipper.c:105
sound_pain2
static int sound_pain2
Definition: m_flipper.c:35
flipper_move_pain1
mmove_t flipper_move_pain1
Definition: m_flipper.c:178
sound_death
static int sound_death
Definition: m_flipper.c:36
edict_s::maxs
vec3_t maxs
Definition: g_local.h:984
ThrowHead
void ThrowHead(edict_t *self, char *gibname, int damage, int type)
Definition: g_misc.c:183
MOVETYPE_TOSS
@ MOVETYPE_TOSS
Definition: g_local.h:196
VectorSet
#define VectorSet(v, x, y, z)
Definition: q_shared.h:161
game_import_t::linkentity
void(* linkentity)(edict_t *ent)
Definition: game.h:138
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
ai_stand
void ai_stand(edict_t *self, float dist)
Definition: g_ai.c:106
edict_s::health
int health
Definition: g_local.h:1051