📄 m_gladiator.pas
字号:
end;
procedure GaldiatorMelee(self : edict_p); cdecl;
var
aim : vec3_t;
begin
VectorSet(aim, MELEE_DISTANCE, self^.mins[0], -4);
if (fire_hit(Self, aim, (20 + (rand() mod 5)), 300)) then
gi.sound(self, CHAN_AUTO, sound_cleaver_hit, 1, ATTN_NORM, 0)
else
gi.sound(self, CHAN_AUTO, sound_cleaver_miss, 1, ATTN_NORM, 0);
end;
const
gladiator_frames_attack_melee : Array[0..16] of mframe_t =
((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:gladiator_cleaver_swing),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:GaldiatorMelee),
(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:gladiator_cleaver_swing),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:GaldiatorMelee),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil));
gladiator_move_attack_melee : mmove_t =
(firstframe:FRAME_melee1; lastframe:FRAME_melee17; frame:@gladiator_frames_attack_melee; endfunc:gladiator_run);
procedure gladiator_melee(self : edict_p); cdecl;
begin
self^.monsterinfo.currentmove := @gladiator_move_attack_melee;
end;
procedure GladiatorGun(self : edict_p); cdecl;
var
start : vec3_t;
dir : vec3_t;
fwrd, right : vec3_t;
begin
AngleVectors(self^.s.angles, @fwrd, @right, nil);
G_ProjectSource(self^.s.origin, monster_flash_offset[MZ2_GLADIATOR_RAILGUN_1], fwrd, right, start);
// calc direction to where we targted
VectorSubtract(self^.pos1, start, dir);
VectorNormalize(dir);
monster_fire_railgun(self, start, dir, 50, 100, MZ2_GLADIATOR_RAILGUN_1);
end;
const
gladiator_frames_attack_gun : Array[0..8] of mframe_t =
((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:GladiatorGun),
(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));
gladiator_move_attack_gun : mmove_t =
(firstframe:FRAME_attack1; lastframe:FRAME_attack9; frame:@gladiator_frames_attack_gun; endfunc:gladiator_run);
procedure gladiator_attack(self : edict_p); cdecl;
var
range : single;
v : vec3_t;
begin
// a small safe zone
VectorSubtract(self^.s.origin, self^.enemy^.s.origin, v);
range := VectorLength(v);
if(range <= (MELEE_DISTANCE + 32)) then
Exit;
// charge up the railgun
gi.sound(self, CHAN_WEAPON, sound_gun, 1, ATTN_NORM, 0);
VectorCopy(self^.enemy^.s.origin, self^.pos1); //save for aiming the shot
self^.pos1[2] := self^.pos1[2] + self^.enemy^.viewheight;
self^.monsterinfo.currentmove := @gladiator_move_attack_gun;
end;
const
gladiator_frames_pain : Array[0..5] 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));
gladiator_move_pain : mmove_t =
(firstframe:FRAME_pain1; lastframe:FRAME_pain6; frame:@gladiator_frames_pain; endfunc:gladiator_run);
gladiator_frames_pain_air : Array[0..6] 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));
gladiator_move_pain_air : mmove_t =
(firstframe:FRAME_painup1; lastframe:FRAME_painup7; frame:@gladiator_frames_pain_air; endfunc:gladiator_run);
procedure gladiator_pain(self, other : edict_p; kick : single; damage : integer); cdecl;
begin
if (self^.health < (self^.max_health / 2)) then
self^.s.skinnum := 1;
if (level.time < self^.pain_debounce_time) then
begin
if ((self^.velocity[2] > 100) and (self^.monsterinfo.currentmove = @gladiator_move_pain)) then
self^.monsterinfo.currentmove := @gladiator_move_pain_air;
Exit;
end;
self^.pain_debounce_time := level.time + 3;
if (_random() < 0.5) then
gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0)
else
gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
if skill^.value = 3 then
Exit; // no pain anims in nightmare
if (self^.velocity[2] > 100) then
self^.monsterinfo.currentmove := @gladiator_move_pain_air
else
self^.monsterinfo.currentmove := @gladiator_move_pain;
end;
procedure gladiator_dead(self : edict_p); cdecl;
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
gladiator_frames_death : Array[0..21] 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));
gladiator_move_death : mmove_t =
(firstframe:FRAME_death1; lastframe:FRAME_death22; frame:@gladiator_frames_death; endfunc:gladiator_dead);
procedure gladiator_die(self, inflictor, attacker : edict_p; damage : integer; const point : vec3_t); cdecl;
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 3 do
ThrowGib(self, 'models/objects/gibs/sm_meat/tris.md2', damage, GIB_ORGANIC);
ThrowHead(self, 'models/objects/gibs/head2/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_die, 1, ATTN_NORM, 0);
self^.deadflag := DEAD_DEAD;
self^.takedamage := DAMAGE_YES;
self^.monsterinfo.currentmove := @gladiator_move_death;
end;
{QUAKED monster_gladiator (1 .5 0) (-32 -32 -24) (32 32 64) Ambush Trigger_Spawn Sight
}
procedure SP_monster_gladiator(self : edict_p);
begin
if (deathmatch^.Value <> 0) then
begin
G_FreeEdict(self);
Exit;
end;
sound_pain1 := gi.soundindex('gladiator/pain.wav');
sound_pain2 := gi.soundindex('gladiator/gldpain2.wav');
sound_die := gi.soundindex('gladiator/glddeth2.wav');
sound_gun := gi.soundindex('gladiator/railgun.wav');
sound_cleaver_swing := gi.soundindex('gladiator/melee1.wav');
sound_cleaver_hit := gi.soundindex('gladiator/melee2.wav');
sound_cleaver_miss := gi.soundindex('gladiator/melee3.wav');
sound_idle := gi.soundindex('gladiator/gldidle1.wav');
sound_search := gi.soundindex('gladiator/gldsrch1.wav');
sound_sight := gi.soundindex('gladiator/sight.wav');
self^.movetype := MOVETYPE_STEP;
self^.solid := SOLID_BBOX;
self^.s.modelindex := gi.modelindex('models/monsters/gladiatr/tris.md2');
VectorSet(self^.mins, -32, -32, -24);
VectorSet(self^.maxs, 32, 32, 64);
self^.health := 400;
self^.gib_health := -175;
self^.mass := 400;
self^.pain := gladiator_pain;
self^.die := gladiator_die;
self^.monsterinfo.stand := gladiator_stand;
self^.monsterinfo.walk := gladiator_walk;
self^.monsterinfo.run := gladiator_run;
self^.monsterinfo.dodge := nil;
self^.monsterinfo.attack := gladiator_attack;
self^.monsterinfo.melee := gladiator_melee;
self^.monsterinfo.sight := gladiator_sight;
self^.monsterinfo.idle := gladiator_idle;
self^.monsterinfo.search := gladiator_search;
gi.linkentity(self);
self^.monsterinfo.currentmove := @gladiator_move_stand;
self^.monsterinfo.scale := MODEL_SCALE;
walkmonster_start(self);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -