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

📄 m_flipper.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{----------------------------------------------------------------------------}
{                                                                            }
{ File(s): m_flipper.h                                                       }
{                                                                            }
{ Initial conversion by : Ben Watt (ben@delphigamedev.com)                   }
{ Initial conversion on : 29-Jan-2002                                        }
{                                                                            }
{ This File contains part of convertion of Quake2 source to ObjectPascal.    }
{ More information about this project can be found at:                       }
{ http://www.sulaco.co.za/quake2/                                            }
{                                                                            }
{ Copyright (C) 1997-2001 Id Software, Inc.                                  }
{                                                                            }
{ This program is free software; you can redistribute it and/or              }
{ modify it under the terms of the GNU General Public License                }
{ as published by the Free Software Foundation; either version 2             }
{ of the License, or (at your option) any later version.                     }
{                                                                            }
{ This program is distributed in the hope that it will be useful,            }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of             }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                       }
{                                                                            }
{ See the GNU General Public License for more details.                       }
{                                                                            }
{----------------------------------------------------------------------------}
{ Updated on :                                                               }
{ Updated by :                                                               }
{                                                                            }
{----------------------------------------------------------------------------}
{ * Still dependent (to compile correctly) on:                               }
{ 1.) g_local.h and game.h                                                   }
{----------------------------------------------------------------------------}
{ * TODO:                                                                    }
{ 1.) test compilation with the above two units                              }
{----------------------------------------------------------------------------}
{
==============================================================================

FLIPPER

==============================================================================
}

unit m_flipper;

interface

const MODEL_SCALE     = 1.000000;

var
  sound_chomp,
  sound_attack,
  sound_pain1,
  sound_pain2,
  sound_death,
  sound_idle,
  sound_search,
  sound_sight   : Integer;

{$I g_local.inc}
{$I m_flipper.inc}

procedure flipper_stand(self : edict_t);
procedure flipper_run_loop(self : edict_t);
procedure flipper_run(self : edict_t);
procedure flipper_walk(self : edict_t);
procedure flipper_start_run(self : edict_t);
procedure flipper_bite(self : edict_t);
procedure flipper_preattack(self : edict_t);
procedure flipper_melee(self : edict_t);
procedure flipper_pain(self, other : edict_t; kick : single; damage : integer);
procedure flipper_dead(self : edict_t);
procedure flipper_sight(self, other : edict_t);
procedure flipper_die(self, inflictor, attacker : edict_t; damage : integer; point : vec3_t);
procedure SP_monster_flipper(self : edict_t);

const
  flipper_frames_stand : Array[0..0] of mframe_t =
    ((aifunc:ai_stand; dist:0; thinkfunc:nil));

  flipper_move_stand : mmove_t =
    (firstframe:FRAME_flphor01; lastframe:FRAME_flphor01; frame:flipper_frames_stand; endfunc:nil);

procedure flipper_stand(self : edict_t);
begin
  self.monsterinfo.currentmove := flipper_move_stand;
end;

const
  FLIPPER_RUN_SPEED = 24;
  flipper_frames_run : Array[0..23] of mframe_t =
    ((aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),   // 6
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),   // 10

     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),   // 20

     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil),
     (aifunc:ai_run; dist:FLIPPER_RUN_SPEED; thinkfunc:nil));  // 29

  flipper_move_run_loop : mmove_t =
    (firstframe:FRAME_flpver06; lastframe:FRAME_flpver29; frame:flipper_frames_run; endfunc:nil);

procedure flipper_run_loop(self : edict_t);
begin
  self.monsterinfo.currentmove := flipper_move_run_loop;
end;

const
  flipper_frames_run_start : Array[0..5] of mframe_t =
    ((aifunc:ai_run; dist:8;  thinkfunc:nil),
     (aifunc:ai_run; dist:8;  thinkfunc:nil),
     (aifunc:ai_run; dist:8;  thinkfunc:nil),
     (aifunc:ai_run; dist:8;  thinkfunc:nil),
     (aifunc:ai_run; dist:8;  thinkfunc:nil),
     (aifunc:ai_run; dist:8;  thinkfunc:nil));

  flipper_move_run_start : mmove_t =
    (firstframe:FRAME_flpver01; lastframe:FRAME_flpver06; frame:flipper_frames_run_start; endfunc:flipper_run_loop);

procedure flipper_run(self : edict_t);
begin
  self.monsterinfo.currentmove := flipper_move_run_start;
end;

const
  { Standard Swimming }
  flipper_frames_walk : Array[0..23] of mframe_t =
    ((aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil),
     (aifunc:ai_walk; dist:4; thinkfunc:nil));

  flipper_move_walk : mmove_t =
    (firstframe:FRAME_flphor01; lastframe:FRAME_flphor24; frame:flipper_frames_walk; endfunc:nil);

procedure flipper_walk(self : edict_t);
begin
  self.monsterinfo.currentmove := flipper_move_walk;
end;

const
  flipper_frames_start_run : Array[0..4] of mframe_t =
    ((aifunc:ai_run; dist:8; thinkfunc:nil),
     (aifunc:ai_run; dist:8; thinkfunc:nil),
     (aifunc:ai_run; dist:8; thinkfunc:nil),
     (aifunc:ai_run; dist:8; thinkfunc:nil),
     (aifunc:ai_run; dist:8; thinkfunc:flipper_run));

  flipper_move_start_run : mmove_t =
    (firstframe:FRAME_flphor01; lastframe:FRAME_flphor05; frame:flipper_frames_start_run; endfunc:nil);

procedure flipper_start_run(self : edict_t);
begin
  self.monsterinfo.currentmove := flipper_move_start_run;
end;

const
  flipper_frames_pain2 : Array[0..4] 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));

  flipper_move_pain2 : mmove_t =
    (firstframe:FRAME_flppn101; lastframe:FRAME_flppn105; frame:flipper_frames_pain2; endfunc:flipper_run);

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

  flipper_move_pain1 : mmove_t =
    (firstframe:FRAME_flppn201; lastframe:FRAME_flppn205; frame:flipper_frames_pain1; endfunc:flipper_run);

procedure flipper_bite(self : edict_t);
var
  aim : vec3_t;
begin
  VectorSet(aim, MELEE_DISTANCE, 0, 0);
  fire_hit(self, aim, 5, 0);
end;

⌨️ 快捷键说明

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