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

📄 m_soldier.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 5 页
字号:
     (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:soldier_fire6),
     (aifunc:ai_move; dist:0;   thinkfunc:nil),
     (aifunc:ai_move; dist:0;   thinkfunc:nil),
     (aifunc:ai_move; dist:0;   thinkfunc:soldier_fire7),
     (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));

  soldier_move_death1 : mmove_t =
    (firstframe:FRAME_death101; lastframe:FRAME_death136; frame:@soldier_frames_death1; endfunc:soldier_dead);

  soldier_frames_death2 : Array[0..34] of mframe_t =
    ((aifunc:ai_move; dist:-5; thinkfunc:nil),
     (aifunc:ai_move; dist:-5; 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),
     (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));

  soldier_move_death2 : mmove_t =
    (firstframe:FRAME_death201; lastframe:FRAME_death235; frame:@soldier_frames_death2; endfunc:soldier_dead);

  soldier_frames_death3 : Array[0..44] of mframe_t =
    ((aifunc:ai_move; dist:-5; thinkfunc:nil),
     (aifunc:ai_move; dist:-5; 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),
     (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));

  soldier_move_death3 : mmove_t =
    (firstframe:FRAME_death301; lastframe:FRAME_death345; frame:@soldier_frames_death3; endfunc:soldier_dead);

  soldier_frames_death4 : Array[0..52] 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));

  soldier_move_death4 : mmove_t =
    (firstframe:FRAME_death401; lastframe:FRAME_death453; frame:@soldier_frames_death4; endfunc:soldier_dead);

  soldier_frames_death5 : Array[0..23] of mframe_t =
    ((aifunc:ai_move; dist:-5; thinkfunc:nil),
     (aifunc:ai_move; dist:-5; 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),
     (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));

  soldier_move_death5 : mmove_t =
    (firstframe:FRAME_death501; lastframe:FRAME_death524; frame:@soldier_frames_death5; endfunc:soldier_dead);

  soldier_frames_death6 : Array[0..9] 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));

  soldier_move_death6 : mmove_t =
    (firstframe:FRAME_death601; lastframe:FRAME_death610; frame:@soldier_frames_death6; endfunc:soldier_dead);

procedure soldier_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 2 do
      ThrowGib(self, 'models/objects/gibs/sm_meat/tris.md2', damage, GIB_ORGANIC);
    ThrowGib(self, 'models/objects/gibs/chest/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
  self.deadflag := DEAD_DEAD;
  self.takedamage := DAMAGE_YES;
  self.s.skinnum := (self.s.skinnum or 1);

  if self.s.skinnum = 1 then
    gi.sound(self, CHAN_VOICE, sound_death_light, 1, ATTN_NORM, 0)
  else if self.s.skinnum = 3 then
    gi.sound(self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0)
  else// if self.s.skinnum = 5 then
    gi.sound(self, CHAN_VOICE, sound_death_ss, 1, ATTN_NORM, 0);

  if fabs((self.s.origin[2] + self.viewheight) - point[2]) <= 4 then
  begin
    // head shot
    self.monsterinfo.currentmove := @soldier_move_death3;
    exit;
  end;

  n := rand() mod 5;
  if n = 0 then
    self.monsterinfo.currentmove := @soldier_move_death1
  else if n = 1 then
    self.monsterinfo.currentmove := @soldier_move_death2
  else if n = 2 then
    self.monsterinfo.currentmove := @soldier_move_death4
  else if n = 3 then
    self.monsterinfo.currentmove := @soldier_move_death5
  else
    self.monsterinfo.currentmove := @soldier_move_death6;
end;


//
// SPAWN
//

procedure SP_monster_soldier_x(self : edict_p);
begin

  self.s.modelindex := gi.modelindex('models/monsters/soldier/tris.md2');
  self.monsterinfo.scale := MODEL_SCALE;
  VectorSet(self.mins, -16, -16, -24);
  VectorSet(self.maxs, 16, 16, 32);
  self.movetype := MOVETYPE_STEP;
  self.solid := SOLID_BBOX;

  sound_idle   :=	gi.soundindex('soldier/solidle1.wav');
  sound_sight1 :=	gi.soundindex('soldier/solsght1.wav');
  sound_sight2 :=	gi.soundindex('soldier/solsrch1.wav');
  sound_cock   :=	gi.soundindex('infantry/infatck3.wav');

  self.mass := 100;

  self.pain := soldier_pain;
  self.die  := soldier_die;

  self.monsterinfo.stand  := soldier_stand;
  self.monsterinfo.walk   := soldier_walk;
  self.monsterinfo.run    := soldier_run;
  self.monsterinfo.dodge  := soldier_dodge;
  self.monsterinfo.attack := soldier_attack;
  self.monsterinfo.melee  := nil;
  self.monsterinfo.sight  := soldier_sight;

  gi.linkentity(self);

  self.monsterinfo.stand(self);

  walkmonster_start(self);
end;


{QUAKED monster_soldier_light (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
}
procedure SP_monster_soldier_light(self : edict_p);
begin
  if deathmatch.value <> 0 then
  begin
    G_FreeEdict(self);
    exit;
  end;

  SP_monster_soldier_x(self);

  sound_pain_light  := gi.soundindex('soldier/solpain2.wav');
  sound_death_light := gi.soundindex('soldier/soldeth2.wav');
  gi.modelindex('models/objects/laser/tris.md2');
  gi.soundindex('misc/lasfly.wav');
  gi.soundindex('soldier/solatck2.wav');

  self.s.skinnum  := 0;
  self.health     := 20;
  self.gib_health := -30;
end;

{QUAKED monster_soldier (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
}
procedure SP_monster_soldier(self : edict_p);
begin
  if deathmatch.value <> 0 then
  begin
    G_FreeEdict(self);
    exit;
  end;

  SP_monster_soldier_x(self);
  sound_pain  := gi.soundindex('soldier/solpain1.wav');
  sound_death := gi.soundindex('soldier/soldet

⌨️ 快捷键说明

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