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

📄 m_float.pas

📁 delphi编的不错的贪吃蛇
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil) );
  floater_move_walk : mmove_t = (firstframe: FRAME_stand101;  lastframe: FRAME_stand152;  frame: @floater_frames_walk;  endfunc: Nil);

  floater_frames_run : array [0..51] of mframe_t = (
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 13;  thinkfunc: Nil)
);
  floater_move_run : mmove_t = (firstframe: FRAME_stand101;  lastframe: FRAME_stand152;  frame: @floater_frames_run;  endfunc: Nil);

procedure floater_run (self : edict_p); cdecl;
begin
  if (self^.monsterinfo.aiflags AND AI_STAND_GROUND) <> 0 then
    self^.monsterinfo.currentmove := @floater_move_stand1
  else
    self^.monsterinfo.currentmove := @floater_move_run;
end;

procedure floater_walk (self : edict_p); cdecl;
begin
  self^.monsterinfo.currentmove := @floater_move_walk;
end;

procedure floater_wham (self : edict_p); cdecl;
//	static	vec3_t	aim = {MELEE_DISTANCE, 0, 0};
{$IFDEF COMPILER6_UP}{$WRITEABLECONST ON}{$ENDIF}
const
  aim : vec3_t = (MELEE_DISTANCE, 0, 0);
{$IFDEF COMPILER6_UP}{$WRITEABLECONST OFF}{$ENDIF}
begin
  gi.sound (self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
  fire_hit (Self, aim, 5 + rand() mod 6, -50);
end;

procedure floater_zap (self : edict_p); cdecl;
var
  forward_, right,
  origin,
  dir,
  offset  : vec3_t;
begin
  VectorSubtract (self^.enemy^.s.origin, self^.s.origin, dir);

  AngleVectors (self^.s.angles, @forward_, @right, Nil);
  //FIXME use a flash and replace these two lines with the commented one
  VectorSet (offset, 18.5, -0.9, 10);
  G_ProjectSource (self^.s.origin, offset, forward_, right, origin);
//idsoft	G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, origin);

  gi.sound (self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0);

  //FIXME use the flash, Luke
  gi.WriteByte (svc_temp_entity);
  gi.WriteByte (Ord(TE_SPLASH));
  gi.WriteByte (32);
  gi.WritePosition (origin);
  gi.WriteDir (dir);
  gi.WriteByte (1);   //sparks
  gi.multicast (@origin, MULTICAST_PVS);

  T_Damage (self^.enemy, self, self, dir, self^.enemy^.s.origin, vec3_origin, 5 + rand() mod 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN);
end;

procedure floater_attack (self : edict_p); cdecl;
begin
  self^.monsterinfo.currentmove := @floater_move_attack1;
end;


procedure floater_melee (self : edict_p); cdecl;
begin
  if (_random() < 0.5) then
    self^.monsterinfo.currentmove := @floater_move_attack3
  else
    self^.monsterinfo.currentmove := @floater_move_attack2;
end;


procedure floater_pain (self, other : edict_p; kick : single; damage : integer); cdecl;
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() + 1) mod 3;
  if (n = 0) then
  begin
    gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
    self^.monsterinfo.currentmove := @floater_move_pain1;
  end
  else
  begin
    gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
    self^.monsterinfo.currentmove := @floater_move_pain2;
  end;
end;

procedure floater_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;

procedure floater_die (self, inflictor, attacker : edict_p; damage : integer; const point : vec3_t); cdecl;
begin
  gi.sound (self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
  BecomeExplosion1(self);
end;

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

  sound_attack2 := gi.soundindex ('floater/fltatck2.wav');
  sound_attack3 := gi.soundindex ('floater/fltatck3.wav');
  sound_death1 := gi.soundindex ('floater/fltdeth1.wav');
  sound_idle := gi.soundindex ('floater/fltidle1.wav');
  sound_pain1 := gi.soundindex ('floater/fltpain1.wav');
  sound_pain2 := gi.soundindex ('floater/fltpain2.wav');
  sound_sight := gi.soundindex ('floater/fltsght1.wav');

  gi.soundindex ('floater/fltatck1.wav');

  self^.s.sound := gi.soundindex ('floater/fltsrch1.wav');

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

  self^.health := 200;
  self^.gib_health := -80;
  self^.mass := 300;

  self^.pain := floater_pain;
  self^.die := floater_die;

  self^.monsterinfo.stand := floater_stand;
  self^.monsterinfo.walk := floater_walk;
  self^.monsterinfo.run := floater_run;
//idsoft	self->monsterinfo.dodge = floater_dodge;
  self^.monsterinfo.attack := floater_attack;
  self^.monsterinfo.melee := floater_melee;
  self^.monsterinfo.sight := floater_sight;
  self^.monsterinfo.idle := floater_idle;

  gi.linkentity (self);

  if (_random() <= 0.5) then
    self^.monsterinfo.currentmove := @floater_move_stand1
  else
    self^.monsterinfo.currentmove := @floater_move_stand2;

  self^.monsterinfo.scale := MODEL_SCALE;

  flymonster_start (self);
end;

end.

⌨️ 快捷键说明

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