📄 m_soldier.pas
字号:
else
self.monsterinfo.nextframe := FRAME_attak110;
end;
procedure soldier_attack1_refire2(self : edict_p);
begin
if self.s.skinnum < 2 then
exit;
if self.enemy.health <= 0 then
exit;
if ((skill.value = 3) and (_random() < 0.5)) or (range(self, self.enemy) = RANGE_MELEE) then
self.monsterinfo.nextframe := FRAME_attak102;
end;
const
soldier_frames_attack1 : Array[0..11] of mframe_t =
((aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_fire1),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_attack1_refire1),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_cock),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_attack1_refire2),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil));
soldier_move_attack1 : mmove_t =
(firstframe:FRAME_attak101; lastframe:FRAME_attak112; frame:@soldier_frames_attack1; endfunc:soldier_run);
// ATTACK2 (blaster/shotgun)
procedure soldier_fire2(self : edict_p);
begin
soldier_fire (self, 1);
end;
procedure soldier_attack2_refire1(self : edict_p);
begin
if self.s.skinnum > 1 then
exit;
if self.enemy.health <= 0 then
exit;
if ((skill.value = 3) and (_random() < 0.5)) or (range(self, self.enemy) = RANGE_MELEE) then
self.monsterinfo.nextframe := FRAME_attak204
else
self.monsterinfo.nextframe := FRAME_attak216;
end;
procedure soldier_attack2_refire2(self : edict_p);
begin
if self.s.skinnum < 2 then
exit;
if self.enemy.health <= 0 then
exit;
if ((skill.value = 3) and (_random() < 0.5)) or (range(self, self.enemy) = RANGE_MELEE) then
self.monsterinfo.nextframe := FRAME_attak204;
end;
const
soldier_frames_attack2 : Array[0..17] 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:soldier_fire2),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_attack2_refire1),
(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:soldier_cock),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_attack2_refire2),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil));
soldier_move_attack2 : mmove_t =
(firstframe:FRAME_attak201; lastframe:FRAME_attak218; frame:@soldier_frames_attack2; endfunc:soldier_run);
// ATTACK3 (duck and shoot)
procedure soldier_duck_down(self : edict_p);
begin
if (self.monsterinfo.aiflags and AI_DUCKED) <> 0 then
exit;
self.monsterinfo.aiflags := (self.monsterinfo.aiflags or AI_DUCKED);
self.maxs[2] := self.maxs[2] - 32;
self.takedamage := DAMAGE_YES;
self.monsterinfo.pausetime := level.time + 1;
gi.linkentity(self);
end;
procedure soldier_duck_up(self : edict_p);
begin
self.monsterinfo.aiflags := (self.monsterinfo.aiflags and AI_DUCKED);
self.maxs[2] := self.maxs[2] + 32;
self.takedamage := DAMAGE_AIM;
gi.linkentity(self);
end;
procedure soldier_fire3(self : edict_p);
begin
soldier_duck_down(self);
soldier_fire(self, 2);
end;
procedure soldier_attack3_refire(self : edict_p);
begin
if (level.time + 0.4) < self.monsterinfo.pausetime then
self.monsterinfo.nextframe := FRAME_attak303;
end;
const
soldier_frames_attack3 : 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:soldier_fire3),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_attack3_refire),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_duck_up),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil));
soldier_move_attack3 : mmove_t =
(firstframe:FRAME_attak301; lastframe:FRAME_attak309; frame:@soldier_frames_attack3; endfunc:soldier_run);
// ATTACK4 (machinegun)
procedure soldier_fire4(self : edict_p);
begin
soldier_fire(self, 3);
//
// if self.enemy.health <= 0 then
// exit;
//
// if ((skill.value = 3) and (_random() < 0.5)) or (range(self, self.enemy) = RANGE_MELEE) then
// self.monsterinfo.nextframe := FRAME_attak402;
end;
const
soldier_frames_attack4 : Array[0..5] of mframe_t =
((aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_fire4),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil));
soldier_move_attack4 : mmove_t =
(firstframe:FRAME_attak401; lastframe:FRAME_attak406; frame:@soldier_frames_attack4; endfunc:soldier_run);
{$IF false}
// ATTACK5 (prone)
procedure soldier_fire5(self : edict_p);
begin
soldier_fire(self, 4);
end;
procedure soldier_attack5_refire(self : edict_p);
begin
if self.enemy.health <= 0 then
exit;
if ((skill.value = 3) and (_random() < 0.5)) or (range(self, self.enemy) = RANGE_MELEE) then
self.monsterinfo.nextframe := FRAME_attak505;
end;
const
soldier_frames_attack5 : Array[0..7] of mframe_t =
((aifunc:ai_charge; dist:8; thinkfunc:nil),
(aifunc:ai_charge; dist:8; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_fire5),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:nil),
(aifunc:ai_charge; dist:0; thinkfunc:soldier_attack5_refire));
soldier_move_attack5 : mmove_t =
(firstframe:FRAME_attak501; lastframe:FRAME_attak508; frame:@soldier_frames_attack5; endfunc:soldier_run);
{$IFEND}
// ATTACK6 (run & shoot)
procedure soldier_fire8(self : edict_p);
begin
soldier_fire(self, 7);
end;
procedure soldier_attack6_refire(self : edict_p);
begin
if self.enemy.health <= 0 then
exit;
if range(self, self.enemy) < RANGE_MID then
exit;
if skill.value = 3 then
self.monsterinfo.nextframe := FRAME_runs03;
end;
const
soldier_frames_attack6 : Array[0..13] of mframe_t =
((aifunc:ai_charge; dist:10; thinkfunc:nil),
(aifunc:ai_charge; dist:4; thinkfunc:nil),
(aifunc:ai_charge; dist:12; thinkfunc:nil),
(aifunc:ai_charge; dist:11; thinkfunc:soldier_fire8),
(aifunc:ai_charge; dist:13; thinkfunc:nil),
(aifunc:ai_charge; dist:18; thinkfunc:nil),
(aifunc:ai_charge; dist:15; thinkfunc:nil),
(aifunc:ai_charge; dist:14; thinkfunc:nil),
(aifunc:ai_charge; dist:11; thinkfunc:nil),
(aifunc:ai_charge; dist:8; thinkfunc:nil),
(aifunc:ai_charge; dist:11; thinkfunc:nil),
(aifunc:ai_charge; dist:12; thinkfunc:nil),
(aifunc:ai_charge; dist:12; thinkfunc:nil),
(aifunc:ai_charge; dist:17; thinkfunc:soldier_attack6_refire));
soldier_move_attack6 : mmove_t =
(firstframe:FRAME_runs01; lastframe:FRAME_runs14; frame:@soldier_frames_attack6; endfunc:soldier_run);
procedure soldier_attack(self : edict_p);
begin
if self.s.skinnum < 4 then
begin
if _random() < 0.5 then
self.monsterinfo.currentmove := @soldier_move_attack1
else
self.monsterinfo.currentmove := @soldier_move_attack2;
end
else
self.monsterinfo.currentmove := @soldier_move_attack4;
end;
//
// SIGHT
//
procedure soldier_sight(self, other : edict_p);
begin
if _random() < 0.5 then
gi.sound (self, CHAN_VOICE, sound_sight1, 1, ATTN_NORM, 0)
else
gi.sound (self, CHAN_VOICE, sound_sight2, 1, ATTN_NORM, 0);
if (skill.value > 0) and (range(self, self.enemy) >= RANGE_MID) then
begin
if _random() > 0.5 then
self.monsterinfo.currentmove := @soldier_move_attack6;
end;
end;
//
// DUCK
//
procedure soldier_duck_hold(self : edict_p);
begin
if level.time >= self.monsterinfo.pausetime then
self.monsterinfo.aiflags := (self.monsterinfo.aiflags and not AI_HOLD_FRAME)
else
self.monsterinfo.aiflags := (self.monsterinfo.aiflags or AI_HOLD_FRAME);
end;
const
soldier_frames_duck : Array[0..4] of mframe_t =
((aifunc:ai_move; dist:5; thinkfunc:soldier_duck_down),
(aifunc:ai_move; dist:-1; thinkfunc:soldier_duck_hold),
(aifunc:ai_move; dist:1; thinkfunc:nil),
(aifunc:ai_move; dist:0; thinkfunc:soldier_duck_up),
(aifunc:ai_move; dist:5; thinkfunc:nil));
soldier_move_duck : mmove_t =
(firstframe:FRAME_duck01; lastframe:FRAME_duck05; frame:@soldier_frames_duck; endfunc:soldier_run);
procedure soldier_dodge(self, attacker : edict_p; eta : single);
var
r : single;
begin
r := _random();
if r > 0.25 then
exit;
if (self.enemy = nil) then
self.enemy := attacker;
if skill.value = 0 then
begin
self.monsterinfo.currentmove := @soldier_move_duck;
exit;
end;
self.monsterinfo.pausetime := level.time + eta + 0.3;
r := _random();
if skill.value = 1 then
begin
if r > 0.33 then
self.monsterinfo.currentmove := @soldier_move_duck
else
self.monsterinfo.currentmove := @soldier_move_attack3;
exit;
end;
if skill.value >= 2 then
begin
if r > 0.66 then
self.monsterinfo.currentmove := @soldier_move_duck
else
self.monsterinfo.currentmove := @soldier_move_attack3;
exit;
end;
self.monsterinfo.currentmove := @soldier_move_attack3;
end;
//
// DEATH
//
procedure soldier_fire6(self : edict_p);
begin
soldier_fire(self, 5);
end;
procedure soldier_fire7(self : edict_p);
begin
soldier_fire(self, 6);
end;
procedure soldier_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
soldier_frames_death1 : Array[0..35] of mframe_t =
((aifunc:ai_move; dist:0; thinkfunc:nil),
(aifunc:ai_move; dist:-10; thinkfunc:nil),
(aifunc:ai_move; dist:-10; thinkfunc:nil),
(aifunc:ai_move; dist:-10; thinkfunc:nil),
(aifunc:ai_move; dist:-5; 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),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -