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

📄 m_flyer.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
📖 第 1 页 / 共 2 页
字号:
end;//procedure

const
  flyer_frames_rollright : array [0..8] 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) );
  flyer_move_rollright : mmove_t = (firstframe: FRAME_rollr01;  lastframe: FRAME_rollr09;  frame: @flyer_frames_rollright;  endfunc: Nil);

  flyer_frames_rollleft : array [0..8] 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) );
  flyer_move_rollleft : mmove_t = (firstframe: FRAME_rollf01;  lastframe: FRAME_rollf09;  frame: @flyer_frames_rollleft;  endfunc: Nil);

  flyer_frames_pain3 : array [0..3] 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) );
  flyer_move_pain3 : mmove_t = (firstframe: FRAME_pain301;  lastframe: FRAME_pain304;  frame: @flyer_frames_pain3; endfunc: flyer_run);

  flyer_frames_pain2 : array [0..3] 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) );
  flyer_move_pain2 : mmove_t = (firstframe: FRAME_pain201;  lastframe: FRAME_pain204; frame: @flyer_frames_pain2; endfunc: flyer_run);

  flyer_frames_pain1 : array [0..8] 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) );
  flyer_move_pain1 : mmove_t = (firstframe: FRAME_pain101;  lastframe: FRAME_pain109;  frame: @flyer_frames_pain1;  endfunc: flyer_run);

  flyer_frames_defense : 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),		// Hold this frame
    (aifunc: ai_move;  dist: 0;  thinkfunc: Nil),
    (aifunc: ai_move;  dist: 0;  thinkfunc: Nil),
    (aifunc: ai_move;  dist: 0;  thinkfunc: Nil) );
  flyer_move_defense : mmove_t = (firstframe: FRAME_defens01;  lastframe: FRAME_defens06;  frame: @flyer_frames_defense;  endfunc: Nil);

  flyer_frames_bankright : 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) );
  flyer_move_bankright : mmove_t = (firstframe: FRAME_bankr01;  lastframe: FRAME_bankr07;  frame: @flyer_frames_bankright;  endfunc: Nil);

  flyer_frames_bankleft : 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) );
  flyer_move_bankleft : mmove_t = (firstframe: FRAME_bankl01;  lastframe: FRAME_bankl07;  frame: @flyer_frames_bankleft;  endfunc: Nil);

procedure flyer_fire (self : edict_p; flash_number : integer);
var
  start,
  forward_, right,
  end_,
  dir    : vec3_t;
  effect : integer;
begin
  if ( (self.s.frame = FRAME_attak204) OR
       (self.s.frame = FRAME_attak207) OR
       (self.s.frame = FRAME_attak210) )
  then effect := EF_HYPERBLASTER
  else effect := 0;
  AngleVectors (self.s.angles, @forward_, @right, Nil);
//Y  G_ProjectSource (self.s.origin, monster_flash_offset[flash_number], forward_, right, start);

  VectorCopy (self.enemy.s.origin, end_);
  end_[2] := end_[2] +self.enemy.viewheight;
  VectorSubtract (end_, start, dir);

//Y  monster_fire_blaster (self, start, dir, 1, 1000, flash_number, effect);
end;//procedure

procedure flyer_fireleft (self : edict_p); cdecl;
begin
  flyer_fire (self, MZ2_FLYER_BLASTER_1);
end;//procedure

procedure flyer_fireright (self : edict_p); cdecl;
begin
  flyer_fire (self, MZ2_FLYER_BLASTER_2);
end;//procedure

const
  flyer_frames_attack2 : 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: -10;  thinkfunc: flyer_fireleft),   // left gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireright),  // right gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireleft),   // left gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireright),  // right gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireleft),   // left gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireright),  // right gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireleft),   // left gun
    (aifunc: ai_charge;  dist: -10;  thinkfunc: flyer_fireright),  // right gun
    (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) );
  flyer_move_attack2 : mmove_t = (firstframe: FRAME_attak201;  lastframe: FRAME_attak217;  frame: @flyer_frames_attack2;  endfunc: flyer_run);

procedure flyer_slash_left (self : edict_p); cdecl;
var
  aim : vec3_t;
begin
  VectorSet (aim, MELEE_DISTANCE, self.mins[0], 0);
//Y  fire_hit (self, aim, 5, 0);
  gi.sound (self, CHAN_WEAPON, sound_slash, 1, ATTN_NORM, 0);
end;//procedure

procedure flyer_slash_right (self : edict_p); cdecl;
var
  aim : vec3_t;
begin
  VectorSet (aim, MELEE_DISTANCE, self.maxs[0], 0);
//Y  fire_hit (self, aim, 5, 0);
  gi.sound (self, CHAN_WEAPON, sound_slash, 1, ATTN_NORM, 0);
end;//procedure

const
  flyer_frames_start_melee : array [0..5] of mframe_t = (
    (aifunc: ai_charge;  dist: 0;  thinkfunc: flyer_pop_blades),
    (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) );
  flyer_move_start_melee : mmove_t = (firstframe: FRAME_attak101;  lastframe: FRAME_attak106;  frame: @flyer_frames_start_melee;  endfunc: flyer_loop_melee);

  flyer_frames_end_melee : array [0..2] of mframe_t = (
    (aifunc: ai_charge;  dist: 0;  thinkfunc: Nil), 
    (aifunc: ai_charge;  dist: 0;  thinkfunc: Nil), 
    (aifunc: ai_charge;  dist: 0;  thinkfunc: Nil) );
  flyer_move_end_melee : mmove_t = (firstframe: FRAME_attak119;  lastframe: FRAME_attak121;  frame: @flyer_frames_end_melee;  endfunc: flyer_run);

  flyer_frames_loop_melee : array [0..11] of mframe_t = (
    (aifunc: ai_charge;  dist: 0;  thinkfunc: Nil), 	          // Loop Start
    (aifunc: ai_charge;  dist: 0;  thinkfunc: Nil),
    (aifunc: ai_charge;  dist: 0;  thinkfunc: flyer_slash_left),  // Left Wing Strike
    (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: flyer_slash_right), // Right Wing Strike
    (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) ); 		  // Loop Ends
  flyer_move_loop_melee : mmove_t = (firstframe: FRAME_attak107;  lastframe: FRAME_attak118;  frame: @flyer_frames_loop_melee;  endfunc: flyer_check_melee);

procedure flyer_loop_melee (self : edict_p); cdecl;
begin
{ifsoft/*	if (random() <= 0.5)
		self->monsterinfo.currentmove = &flyer_move_attack1;
	else */}
  self.monsterinfo.currentmove := @flyer_move_loop_melee;
end;//procedure

procedure flyer_attack (self : edict_p);
begin
{idsoft/*	if (random() <= 0.5)
		self->monsterinfo.currentmove = &flyer_move_attack1;
	else */}
  self.monsterinfo.currentmove := @flyer_move_attack2;
end;//procedure

procedure flyer_setstart (self : edict_p);
begin
  nextmove := ACTION_run;
  self.monsterinfo.currentmove := @flyer_move_start;
end;//procedure

procedure flyer_nextmove (self : edict_p); cdecl; 
begin
  if (nextmove = ACTION_attack1)
  then self.monsterinfo.currentmove := @flyer_move_start_melee
  else
    if (nextmove = ACTION_attack2)
    then self.monsterinfo.currentmove := @flyer_move_attack2
    else
      if (nextmove = ACTION_run) then
        self.monsterinfo.currentmove := @flyer_move_run;
end;//procedure

procedure flyer_melee (self : edict_p);
begin
(*idsoft	flyer.nextmove = ACTION_attack1;
	self->monsterinfo.currentmove = &flyer_move_stop;*)
  self.monsterinfo.currentmove := @flyer_move_start_melee;
end;//procedure

procedure flyer_check_melee (self : edict_p); cdecl;
begin
(*Y  if (range (self, self.enemy) = RANGE_MELEE)
  then
    if (random <= 0.8)
    then self.monsterinfo.currentmove := @flyer_move_loop_melee
    else self.monsterinfo.currentmove := @flyer_move_end_melee
  else*)
    self.monsterinfo.currentmove := @flyer_move_end_melee;
end;//procedure

//procedure flyer_pain (edict_t *self, edict_t *other, float kick, int damage);
procedure flyer_pain (self, other : edict_p; kick : float; 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() % 3;
  n := random(3);
  if (n = 0)
  then begin
    gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
    self.monsterinfo.currentmove := @flyer_move_pain1;
  end
  else
    if (n = 1)
    then begin
      gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
      self.monsterinfo.currentmove := @flyer_move_pain2;
    end
    else begin
      gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
      self.monsterinfo.currentmove := @flyer_move_pain3;
    end;
end;//procedure


//procedure flyer_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
procedure flyer_die (self, inflictor, attacker : edict_p; damage : integer; point : vec3_t);
begin
  gi.sound (self, CHAN_VOICE, sound_die, 1, ATTN_NORM, 0);
//Y  BecomeExplosion1(self);
end;//procedure


//*QUAKED monster_flyer (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
procedure SP_monster_flyer (self : edict_p);
begin
  if (deathmatch.value <> 0) then
  begin
//Y    G_FreeEdict (self);
    Exit;
  end;

  // fix a map bug in jail5.bsp
//Y  if ( !Q_stricmp(level.mapname, 'jail5') AND (self.s.origin[2] = -104) ) then
  begin
    self.targetname := self.target;
    self.target := Nil;
  end;

  sound_sight := gi.soundindex ('flyer/flysght1.wav');
  sound_idle := gi.soundindex ('flyer/flysrch1.wav');
  sound_pain1 := gi.soundindex ('flyer/flypain1.wav');
  sound_pain2 := gi.soundindex ('flyer/flypain2.wav');
  sound_slash := gi.soundindex ('flyer/flyatck2.wav');
  sound_sproing := gi.soundindex ('flyer/flyatck1.wav');
  sound_die := gi.soundindex ('flyer/flydeth1.wav');

  gi.soundindex ('flyer/flyatck3.wav');

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

  self.s.sound := gi.soundindex ('flyer/flyidle1.wav');

  self.health := 50;
  self.mass := 50;

  self.pain := @flyer_pain;
  self.die := @flyer_die;

  self.monsterinfo.stand := @flyer_stand;
  self.monsterinfo.walk := @flyer_walk;
  self.monsterinfo.run := @flyer_run;
  self.monsterinfo.attack := @flyer_attack;
  self.monsterinfo.melee := @flyer_melee;
  self.monsterinfo.sight := @flyer_sight;
  self.monsterinfo.idle := @flyer_idle;

  gi.linkentity (self);

  self.monsterinfo.currentmove := @flyer_move_stand;
  self.monsterinfo.scale := MODEL_SCALE;

//Y  flymonster_start (self);
end;//procedure

// End of file
end.

⌨️ 快捷键说明

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