mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-22 20:31:50 +00:00
Cleanup flipper and add sanity checks
This commit is contained in:
parent
d3710d28e1
commit
e2edf54062
2 changed files with 349 additions and 211 deletions
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
FLIPPER
|
||||
|
||||
==============================================================================
|
||||
/* =======================================================================
|
||||
*
|
||||
* Baracuda Shark.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include "../../header/local.h"
|
||||
#include "flipper.h"
|
||||
|
||||
#define FLIPPER_RUN_SPEED 24
|
||||
|
||||
static int sound_chomp;
|
||||
static int sound_attack;
|
||||
|
@ -19,30 +19,36 @@ static int sound_idle;
|
|||
static int sound_search;
|
||||
static int sound_sight;
|
||||
|
||||
|
||||
void flipper_stand(edict_t *self);
|
||||
|
||||
mframe_t flipper_frames_stand [] =
|
||||
{
|
||||
mframe_t flipper_frames_stand[] = {
|
||||
{ai_stand, 0, NULL}
|
||||
};
|
||||
|
||||
mmove_t flipper_move_stand = {FRAME_flphor01, FRAME_flphor01, flipper_frames_stand, NULL};
|
||||
mmove_t flipper_move_stand = {
|
||||
FRAME_flphor01,
|
||||
FRAME_flphor01,
|
||||
flipper_frames_stand,
|
||||
NULL
|
||||
};
|
||||
|
||||
void flipper_stand (edict_t *self)
|
||||
void
|
||||
flipper_stand(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &flipper_move_stand;
|
||||
}
|
||||
|
||||
#define FLIPPER_RUN_SPEED 24
|
||||
|
||||
mframe_t flipper_frames_run [] =
|
||||
{
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL}, // 6
|
||||
mframe_t flipper_frames_run[] = {
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL}, /* 6 */
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL}, // 10
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL}, /* 10 */
|
||||
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
|
@ -53,7 +59,7 @@ mframe_t flipper_frames_run [] =
|
|||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL}, // 20
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL}, /* 20 */
|
||||
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
|
@ -63,17 +69,28 @@ mframe_t flipper_frames_run [] =
|
|||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL},
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL} // 29
|
||||
{ai_run, FLIPPER_RUN_SPEED, NULL} /* 29 */
|
||||
};
|
||||
mmove_t flipper_move_run_loop = {FRAME_flpver06, FRAME_flpver29, flipper_frames_run, NULL};
|
||||
|
||||
void flipper_run_loop (edict_t *self)
|
||||
mmove_t flipper_move_run_loop = {
|
||||
FRAME_flpver06,
|
||||
FRAME_flpver29,
|
||||
flipper_frames_run,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
flipper_run_loop(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &flipper_move_run_loop;
|
||||
}
|
||||
|
||||
mframe_t flipper_frames_run_start [] =
|
||||
{
|
||||
mframe_t flipper_frames_run_start[] = {
|
||||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, NULL},
|
||||
|
@ -81,16 +98,27 @@ mframe_t flipper_frames_run_start [] =
|
|||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, NULL}
|
||||
};
|
||||
mmove_t flipper_move_run_start = {FRAME_flpver01, FRAME_flpver06, flipper_frames_run_start, flipper_run_loop};
|
||||
|
||||
void flipper_run (edict_t *self)
|
||||
mmove_t flipper_move_run_start = {
|
||||
FRAME_flpver01,
|
||||
FRAME_flpver06,
|
||||
flipper_frames_run_start,
|
||||
flipper_run_loop
|
||||
};
|
||||
|
||||
void
|
||||
flipper_run(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &flipper_move_run_start;
|
||||
}
|
||||
|
||||
/* Standard Swimming */
|
||||
mframe_t flipper_frames_walk [] =
|
||||
{
|
||||
mframe_t flipper_frames_walk[] = {
|
||||
{ai_walk, 4, NULL},
|
||||
{ai_walk, 4, NULL},
|
||||
{ai_walk, 4, NULL},
|
||||
|
@ -116,63 +144,107 @@ mframe_t flipper_frames_walk [] =
|
|||
{ai_walk, 4, NULL},
|
||||
{ai_walk, 4, NULL}
|
||||
};
|
||||
mmove_t flipper_move_walk = {FRAME_flphor01, FRAME_flphor24, flipper_frames_walk, NULL};
|
||||
|
||||
void flipper_walk (edict_t *self)
|
||||
mmove_t flipper_move_walk = {
|
||||
FRAME_flphor01,
|
||||
FRAME_flphor24,
|
||||
flipper_frames_walk,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
flipper_walk(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &flipper_move_walk;
|
||||
}
|
||||
|
||||
mframe_t flipper_frames_start_run [] =
|
||||
{
|
||||
mframe_t flipper_frames_start_run[] = {
|
||||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, NULL},
|
||||
{ai_run, 8, flipper_run}
|
||||
};
|
||||
mmove_t flipper_move_start_run = {FRAME_flphor01, FRAME_flphor05, flipper_frames_start_run, NULL};
|
||||
|
||||
void flipper_start_run (edict_t *self)
|
||||
mmove_t flipper_move_start_run = {
|
||||
FRAME_flphor01,
|
||||
FRAME_flphor05,
|
||||
flipper_frames_start_run,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
flipper_start_run(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &flipper_move_start_run;
|
||||
}
|
||||
|
||||
mframe_t flipper_frames_pain2 [] =
|
||||
{
|
||||
mframe_t flipper_frames_pain2[] = {
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL}
|
||||
};
|
||||
mmove_t flipper_move_pain2 = {FRAME_flppn101, FRAME_flppn105, flipper_frames_pain2, flipper_run};
|
||||
|
||||
mframe_t flipper_frames_pain1 [] =
|
||||
{
|
||||
mmove_t flipper_move_pain2 = {
|
||||
FRAME_flppn101,
|
||||
FRAME_flppn105,
|
||||
flipper_frames_pain2,
|
||||
flipper_run
|
||||
};
|
||||
|
||||
mframe_t flipper_frames_pain1[] = {
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL}
|
||||
};
|
||||
mmove_t flipper_move_pain1 = {FRAME_flppn201, FRAME_flppn205, flipper_frames_pain1, flipper_run};
|
||||
|
||||
void flipper_bite (edict_t *self)
|
||||
mmove_t flipper_move_pain1 = {
|
||||
FRAME_flppn201,
|
||||
FRAME_flppn205,
|
||||
flipper_frames_pain1,
|
||||
flipper_run
|
||||
};
|
||||
|
||||
void
|
||||
flipper_bite(edict_t *self)
|
||||
{
|
||||
vec3_t aim;
|
||||
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VectorSet(aim, MELEE_DISTANCE, 0, 0);
|
||||
fire_hit(self, aim, 5, 0);
|
||||
}
|
||||
|
||||
void flipper_preattack (edict_t *self)
|
||||
void
|
||||
flipper_preattack(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gi.sound(self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
||||
mframe_t flipper_frames_attack [] =
|
||||
{
|
||||
mframe_t flipper_frames_attack[] = {
|
||||
{ai_charge, 0, flipper_preattack},
|
||||
{ai_charge, 0, NULL},
|
||||
{ai_charge, 0, NULL},
|
||||
|
@ -194,29 +266,54 @@ mframe_t flipper_frames_attack [] =
|
|||
{ai_charge, 0, flipper_bite},
|
||||
{ai_charge, 0, NULL}
|
||||
};
|
||||
mmove_t flipper_move_attack = {FRAME_flpbit01, FRAME_flpbit20, flipper_frames_attack, flipper_run};
|
||||
|
||||
void flipper_melee(edict_t *self)
|
||||
mmove_t flipper_move_attack = {
|
||||
FRAME_flpbit01,
|
||||
FRAME_flpbit20,
|
||||
flipper_frames_attack,
|
||||
flipper_run
|
||||
};
|
||||
|
||||
void
|
||||
flipper_melee(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->monsterinfo.currentmove = &flipper_move_attack;
|
||||
}
|
||||
|
||||
void flipper_pain (edict_t *self, edict_t *other, float kick, int damage)
|
||||
void
|
||||
flipper_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->health < (self->max_health / 2))
|
||||
{
|
||||
self->s.skinnum = 1;
|
||||
}
|
||||
|
||||
if (level.time < self->pain_debounce_time)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self->pain_debounce_time = level.time + 3;
|
||||
|
||||
if (skill->value == 3)
|
||||
return; // no pain anims in nightmare
|
||||
{
|
||||
return; /* no pain anims in nightmare */
|
||||
}
|
||||
|
||||
n = (rand() + 1) % 2;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
|
||||
|
@ -229,8 +326,14 @@ void flipper_pain (edict_t *self, edict_t *other, float kick, int damage)
|
|||
}
|
||||
}
|
||||
|
||||
void flipper_dead (edict_t *self)
|
||||
void
|
||||
flipper_dead(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VectorSet(self->mins, -16, -16, -24);
|
||||
VectorSet(self->maxs, 16, 16, -8);
|
||||
self->movetype = MOVETYPE_TOSS;
|
||||
|
@ -239,8 +342,7 @@ void flipper_dead (edict_t *self)
|
|||
gi.linkentity(self);
|
||||
}
|
||||
|
||||
mframe_t flipper_frames_death [] =
|
||||
{
|
||||
mframe_t flipper_frames_death[] = {
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL},
|
||||
|
@ -303,44 +405,79 @@ mframe_t flipper_frames_death [] =
|
|||
{ai_move, 0, NULL},
|
||||
{ai_move, 0, NULL}
|
||||
};
|
||||
mmove_t flipper_move_death = {FRAME_flpdth01, FRAME_flpdth56, flipper_frames_death, flipper_dead};
|
||||
|
||||
void flipper_sight (edict_t *self, edict_t *other)
|
||||
mmove_t flipper_move_death = {
|
||||
FRAME_flpdth01,
|
||||
FRAME_flpdth56,
|
||||
flipper_frames_death,
|
||||
flipper_dead
|
||||
};
|
||||
|
||||
void
|
||||
flipper_sight(edict_t *self, edict_t *other /* unused */)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
||||
void flipper_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
|
||||
void
|
||||
flipper_die(edict_t *self, edict_t *inflictor /* unused */, edict_t *attacker /* unused */,
|
||||
int damage, vec3_t point /* unused */)
|
||||
{
|
||||
int n;
|
||||
|
||||
// check for gib
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for gib */
|
||||
if (self->health <= self->gib_health)
|
||||
{
|
||||
gi.sound(self, CHAN_VOICE, gi.soundindex("misc/udeath.wav"), 1, ATTN_NORM, 0);
|
||||
|
||||
for (n = 0; n < 2; n++)
|
||||
{
|
||||
ThrowGib(self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC);
|
||||
}
|
||||
|
||||
for (n = 0; n < 2; n++)
|
||||
{
|
||||
ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
|
||||
}
|
||||
|
||||
ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
|
||||
self->deadflag = DEAD_DEAD;
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->deadflag == DEAD_DEAD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// regular death
|
||||
/* regular death */
|
||||
gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
|
||||
self->deadflag = DEAD_DEAD;
|
||||
self->takedamage = DAMAGE_YES;
|
||||
self->monsterinfo.currentmove = &flipper_move_death;
|
||||
}
|
||||
|
||||
/*QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
|
||||
/*
|
||||
* QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
|
||||
*/
|
||||
void SP_monster_flipper (edict_t *self)
|
||||
void
|
||||
SP_monster_flipper(edict_t *self)
|
||||
{
|
||||
if (!self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (deathmatch->value)
|
||||
{
|
||||
G_FreeEdict(self);
|
||||
|
@ -382,4 +519,3 @@ void SP_monster_flipper (edict_t *self)
|
|||
|
||||
swimmonster_start(self);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// G:\quake2\baseq2\models/monsters/flipper
|
||||
|
||||
// This file generated by ModelGen - Do NOT Modify
|
||||
/* =======================================================================
|
||||
*
|
||||
* Baracuda Shark animations.
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#define FRAME_flpbit01 0
|
||||
#define FRAME_flpbit02 1
|
||||
|
@ -162,5 +165,4 @@
|
|||
#define FRAME_flpdth54 157
|
||||
#define FRAME_flpdth55 158
|
||||
#define FRAME_flpdth56 159
|
||||
|
||||
#define MODEL_SCALE 1.000000
|
||||
|
|
Loading…
Reference in a new issue