⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_gunner.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 3 页
字号:
end;

{visible := function(self, other: edict_t): qboolean; cdecl;
GunnerGrenade := procedure(self: edict_t); cdecl;
GunnerFire := procedure(self: edict_t); cdecl;
gunner_fire_chain := procedure(self: edict_t); cdecl;
gunner_refire_chain := procedure(self: edict_t); cdecl;


gunner_stand := procedure(self: edict_t); cdecl;}
const
gunner_frames_fidget: array[0..48] of mframe_t =
(
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:gunner_idlesound),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),

  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),

  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),

  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),

  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil),
  (aifunc: ai_stand; dist: 0; thinkfunc:nil)
);

const
  gunner_move_fidget: mmove_t = (firstframe:FRAME_stand31; lastframe: FRAME_stand70; frame:@gunner_frames_fidget; endfunc: gunner_stand);

procedure gunner_fidget (self: edict_p); cdecl;
begin
  if (self.monsterinfo.aiflags and AI_STAND_GROUND) <> 0 then
    exit;
  if (_random() <= 0.05) then
    self.monsterinfo.currentmove := @gunner_move_fidget;
end;

const
  gunner_frames_stand: array[0..29] of mframe_t =
(
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: gunner_fidget),

  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: gunner_fidget),

  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: nil),
  (aifunc: ai_stand; dist: 0; thinkfunc: gunner_fidget)
);

const
  gunner_move_stand: mmove_t = (firstframe:FRAME_stand01; lastframe: FRAME_stand30; frame:@gunner_frames_stand; endfunc:nil);

procedure gunner_stand (self: edict_p);
begin
    self.monsterinfo.currentmove := @gunner_move_stand;
end;

const
  gunner_frames_walk: array[0..12] of mframe_t =
(
  (aifunc: ai_walk; dist: 0; thinkfunc: nil),
  (aifunc: ai_walk; dist: 3; thinkfunc: nil),
  (aifunc: ai_walk; dist: 4; thinkfunc: nil),
  (aifunc: ai_walk; dist: 5; thinkfunc: nil),
  (aifunc: ai_walk; dist: 7; thinkfunc: nil),
  (aifunc: ai_walk; dist: 2; thinkfunc: nil),
  (aifunc: ai_walk; dist: 6; thinkfunc: nil),
  (aifunc: ai_walk; dist: 4; thinkfunc: nil),
  (aifunc: ai_walk; dist: 2; thinkfunc: nil),
  (aifunc: ai_walk; dist: 7; thinkfunc: nil),
  (aifunc: ai_walk; dist: 5; thinkfunc: nil),
  (aifunc: ai_walk; dist: 7; thinkfunc: nil),
  (aifunc: ai_walk; dist: 4; thinkfunc: nil)
);

const
  gunner_move_walk: mmove_t = (firstframe:FRAME_walk07; lastframe: FRAME_walk19; frame:@gunner_frames_walk; endfunc:nil);

procedure gunner_walk (self: edict_p); cdecl;
begin
  self.monsterinfo.currentmove := @gunner_move_walk;
end;

const
  gunner_frames_run: array[0..7] of mframe_t =
(
  (aifunc: ai_run; dist: 26; thinkfunc: nil),
  (aifunc: ai_run; dist: 9; thinkfunc: nil),
  (aifunc: ai_run; dist: 9; thinkfunc: nil),
  (aifunc: ai_run; dist: 9; thinkfunc: nil),
  (aifunc: ai_run; dist: 15; thinkfunc: nil),
  (aifunc: ai_run; dist: 10; thinkfunc: nil),
  (aifunc: ai_run; dist: 13; thinkfunc: nil),
  (aifunc: ai_run; dist: 6; thinkfunc: nil)
);

const
  gunner_move_run: mmove_t = (firstframe:FRAME_run01; lastframe: FRAME_run08; frame: @gunner_frames_run; endfunc:nil);

procedure gunner_run (self: edict_p); cdecl;
begin
  if (self.monsterinfo.aiflags and AI_STAND_GROUND) <> 0 then
    self.monsterinfo.currentmove := @gunner_move_stand
  else
    self.monsterinfo.currentmove := @gunner_move_run;
end;

const
  gunner_frames_runandshoot: array[0..5] of mframe_t =
(
  (aifunc: ai_run; dist: 32; thinkfunc: nil),
  (aifunc: ai_run; dist: 15; thinkfunc: nil),
  (aifunc: ai_run; dist: 10; thinkfunc: nil),
  (aifunc: ai_run; dist: 18; thinkfunc: nil),
  (aifunc: ai_run; dist: 8; thinkfunc: nil),
  (aifunc: ai_run; dist: 20; thinkfunc: nil)
);

const
  gunner_move_runandshoot: mmove_t = (firstframe:FRAME_runs01; lastframe: FRAME_runs06; frame:@gunner_frames_runandshoot; endfunc:nil);

procedure gunner_runandshoot (self: edict_p);
begin
  self.monsterinfo.currentmove := @gunner_move_runandshoot;
end;

const
  gunner_frames_pain3: array[0..4] of mframe_t =
(
  (aifunc: ai_move; dist: -3; thinkfunc: nil),
  (aifunc: ai_move; dist: 1; thinkfunc: nil),
  (aifunc: ai_move; dist: 1; thinkfunc: nil),
  (aifunc: ai_move; dist: 0; thinkfunc: nil),
  (aifunc: ai_move; dist: 1; thinkfunc: nil)
);

const
  gunner_move_pain3: mmove_t = (firstframe:FRAME_pain301; lastframe:FRAME_pain305; frame:@gunner_frames_pain3; endfunc:gunner_run);

const
  gunner_frames_pain2: array[0..7] of mframe_t =
(
  (aifunc: ai_move; dist: -2; thinkfunc: nil),
  (aifunc: ai_move; dist: 11; thinkfunc: nil),
  (aifunc: ai_move; dist: 6; thinkfunc: nil),
  (aifunc: ai_move; dist: 2; thinkfunc: nil),
  (aifunc: ai_move; dist: -1; thinkfunc: nil),
  (aifunc: ai_move; dist: -7; thinkfunc: nil),
  (aifunc: ai_move; dist: -2; thinkfunc: nil),
  (aifunc: ai_move; dist: -7; thinkfunc: nil)
);

const
  gunner_move_pain2: mmove_t = (firstframe:FRAME_pain201; lastframe:FRAME_pain208; frame:@gunner_frames_pain2; endfunc:gunner_run);

const
  gunner_frames_pain1: array[0..17] of mframe_t =
(
  (aifunc:ai_move; dist: 2; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil),
  (aifunc:ai_move; dist: -5; thinkfunc:nil),
  (aifunc:ai_move; dist: 3; thinkfunc:nil),
  (aifunc:ai_move; dist: -1; 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: 1; thinkfunc:nil),
  (aifunc:ai_move; dist: 1; thinkfunc:nil),
  (aifunc:ai_move; dist: 2; thinkfunc:nil),
  (aifunc:ai_move; dist: 1; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil),
  (aifunc:ai_move; dist: -2; thinkfunc:nil),
  (aifunc:ai_move; dist: -2; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil)
);

gunner_move_pain1: mmove_t = (firstframe:FRAME_pain101; lastframe:FRAME_pain118; frame:@gunner_frames_pain1; endfunc:gunner_run);

procedure gunner_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
    exit;

  self.pain_debounce_time := level.time + 3;

  if (rand() and 1) <> 0 then
    gi.sound (self, CHAN_VOICE, sound_pain, 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 damage <= 10 then
    self.monsterinfo.currentmove := @gunner_move_pain3
  else if damage <= 25 then
    self.monsterinfo.currentmove := @gunner_move_pain2
  else
    self.monsterinfo.currentmove := @gunner_move_pain1;
end;

procedure gunner_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
  gunner_frames_death: array[0..10] 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: -7; thinkfunc:nil),
  (aifunc:ai_move; dist: -3; thinkfunc:nil),
  (aifunc:ai_move; dist: -5; thinkfunc:nil),
  (aifunc:ai_move; dist: 8; thinkfunc:nil),
  (aifunc:ai_move; dist: 6; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil),
  (aifunc:ai_move; dist: 0; thinkfunc:nil)
);

const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -