📄 m_flipper.pas
字号:
flipper_move_pain1 : mmove_t =
(firstframe:FRAME_flppn201; lastframe:FRAME_flppn205; frame:@flipper_frames_pain1; endfunc:flipper_run);
procedure flipper_bite(self : edict_p);
var
aim : vec3_t;
begin
VectorSet(aim, MELEE_DISTANCE, 0, 0);
fire_hit(Self, aim, 5, 0);
end;
procedure flipper_preattack(self : edict_p);
begin
gi.sound(self, CHAN_WEAPON, sound_chomp, 1, ATTN_NORM, 0);
end;
const
flipper_frames_attack : array[0..19] of mframe_t =
((aifunc:ai_charge; dist:0; thinkfunc:flipper_preattack),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:flipper_bite),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:flipper_bite),
(aifunc:ai_charge; dist:0; thinkfunc:nil));
flipper_move_attack : mmove_t =
(firstframe:FRAME_flpbit01; lastframe:FRAME_flpbit20; frame:@flipper_frames_attack; endfunc:flipper_run);
procedure flipper_melee(self : edict_p);
begin
self^.monsterinfo.currentmove := @flipper_move_attack;
end;
procedure flipper_pain(self, other : edict_p; kick : single; damage : integer);
var
n : Integer;
begin
if self^.health < (self^.max_health / 2) then
self^.s.skinnum := 1;
if level.time < self^.pain_debounce_time then
Exit;
self^.pain_debounce_time := level.time + 3;
if skill^.value = 3 then
Exit; // no pain anims in nightmare
n := (rand() + 1) mod 2;
if n = 0 then
begin
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
self^.monsterinfo.currentmove := @flipper_move_pain1;
end
else
begin
gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
self^.monsterinfo.currentmove := @flipper_move_pain2;
end;
end;
procedure flipper_dead(self : edict_p);
begin
VectorSet(self^.mins, -16, -16, -24);
VectorSet(self^.maxs, 16, 16, -8);
self^.movetype := MOVETYPE_TOSS;
self^.svflags := (self^.svflags or SVF_DEADMONSTER);
self^.nextthink := 0;
gi.linkentity(self);
end;
const
flipper_frames_death : array[0..55] of mframe_t =
((aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:nil));
flipper_move_death : mmove_t =
(firstframe:FRAME_flpdth01; lastframe:FRAME_flpdth56; frame:@flipper_frames_death; endfunc:flipper_dead);
procedure flipper_sight(self, other : edict_p);
begin
gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
end;
procedure flipper_die(self, inflictor, attacker : edict_p; damage : integer; const point : vec3_t);
var
n : integer;
begin
// check for gib
if self^.health <= self^.gib_health then
begin
gi.sound(self, CHAN_VOICE, gi.soundindex('misc/udeath.wav'), 1, ATTN_NORM, 0);
for n := 0 to 1 do
ThrowGib(self, 'models/objects/gibs/bone/tris.md2', damage, GIB_ORGANIC);
for n := 0 to 1 do
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;
Exit;
end;
if self^.deadflag = DEAD_DEAD then
Exit;
// 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;
end;
{QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
}
procedure SP_monster_flipper(self : edict_p);
begin
if (deathmatch^.Value <> 0) then
begin
G_FreeEdict (self);
Exit;
end;
sound_pain1 := gi.soundindex ('flipper/flppain1.wav');
sound_pain2 := gi.soundindex ('flipper/flppain2.wav');
sound_death := gi.soundindex ('flipper/flpdeth1.wav');
sound_chomp := gi.soundindex ('flipper/flpatck1.wav');
sound_attack := gi.soundindex ('flipper/flpatck2.wav');
sound_idle := gi.soundindex ('flipper/flpidle1.wav');
sound_search := gi.soundindex ('flipper/flpsrch1.wav');
sound_sight := gi.soundindex ('flipper/flpsght1.wav');
self^.movetype := MOVETYPE_STEP;
self^.solid := SOLID_BBOX;
self^.s.modelindex := gi.modelindex('models/monsters/flipper/tris.md2');
VectorSet(self^.mins, -16, -16, 0);
VectorSet(self^.maxs, 16, 16, 32);
self^.health := 50;
self^.gib_health := -30;
self^.mass := 100;
self^.pain := flipper_pain;
self^.die := flipper_die;
self^.monsterinfo.stand := flipper_stand;
self^.monsterinfo.walk := flipper_walk;
self^.monsterinfo.run := flipper_start_run;
self^.monsterinfo.melee := flipper_melee;
self^.monsterinfo.sight := flipper_sight;
gi.linkentity(self);
self^.monsterinfo.currentmove := @flipper_move_stand;
self^.monsterinfo.scale := MODEL_SCALE;
swimmonster_start(self);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -