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

📄 m_tank.pas

📁 雷神之锤2(Quake2)Delphi源码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
// PLEASE, don't modify this file
// 99% complete

{----------------------------------------------------------------------------}
{                                                                            }
{ File(s): m_tank.c                                                          }
{                                                                            }
{ Initial conversion by : YgriK (Igor Karpov) - glYgriK@hotbox.ru            }
{ Initial conversion on : 25-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) unit: g_local                                                           }
{ 2) unit: q_shared                                                          }
{ 3) unit: game                                                              }
{ 4) unit: m_flash                                                           }
{                                                                            }
{ .) unit: g_ai                                                              }
{                                                                            }
{ 1) inc:  m_tank                                                            }
{                                                                            }
{----------------------------------------------------------------------------}
{ * TODO:                                                                    }
{ 1) Do more tests                                                           }
{                                                                            }
{----------------------------------------------------------------------------}


{*
==============================================================================

TANK

==============================================================================
*}


unit m_tank;

interface

uses g_local;

procedure SP_monster_tank (self : edict_p);

implementation

uses q_shared, game, m_flash{, g_ai};

{$I m_tank.inc}




//REMOVE!!!
var
  gi : game_import_t;  //from G_LOCAL or G_MAIN;

type
  float = single;

//from G_AI
procedure ai_stand (self : edict_p; dist : float); cdecl;
begin
end;
procedure ai_walk (self : edict_p; dist : float); cdecl;
begin
end;
procedure ai_move (self : edict_p; dist : float); cdecl;
begin
end;
procedure ai_charge(self : edict_p; dist : float); cdecl;
begin
end;
procedure ai_run(self : edict_p; dist : float); cdecl;
begin
end;

//function fire_hit - from G_WEAPON or G_LOCAL

//from G_MISC or G_LOCAL
//proc ThrowHead
//proc ThrowGib

//from G_MONSTER or G_LOCAL
//proc walkmonster_start

//REMOVE!!!





procedure tank_walk (self : edict_p); cdecl; forward;
procedure tank_run (self : edict_p); cdecl; forward;

procedure tank_refire_rocket (self : edict_p); cdecl; forward;
procedure tank_doattack_rocket (self : edict_p); cdecl; forward;
procedure tank_reattack_blaster (self : edict_p);cdecl; forward;


//static int	sound_strike;
var
  sound_thud,
  sound_pain,
  sound_idle,
  sound_die,
  sound_step,
  sound_sight,
  sound_windup,
  sound_strike : integer;


//
// misc
//

procedure tank_sight (self, other : edict_p);
begin
  gi.sound (self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
end;//procedure

procedure tank_footstep (self : edict_p); cdecl;
begin
  gi.sound (self, CHAN_BODY, sound_step, 1, ATTN_NORM, 0);
end;//procedure

procedure tank_thud (self : edict_p); cdecl;
begin
  gi.sound (self, CHAN_BODY, sound_thud, 1, ATTN_NORM, 0);
end;//procedure

procedure tank_windup (self : edict_p); cdecl;
begin
  gi.sound (self, CHAN_WEAPON, sound_windup, 1, ATTN_NORM, 0);
end;//procedure

procedure tank_idle (self : edict_p);
begin
  gi.sound (self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
end;//procedure


//
// stand
//
const
  tank_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: 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) );
  tank_move_stand : mmove_t =
    (firstframe: FRAME_stand01;  lastframe: FRAME_stand30;  frame: @tank_frames_stand;  endfunc: Nil);

procedure tank_stand (self : edict_p); cdecl;
begin
  self.monsterinfo.currentmove := @tank_move_stand;
end;//procedure


//
// walk
//
(*void tank_walk (edict_t *self);*)

const
  tank_frames_start_walk : array [0..3] of mframe_t = (
    (aifunc: ai_walk;  dist:  0;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist:  6;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist:  6;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 11;  thinkfunc: tank_footstep) );
  tank_move_start_walk : mmove_t =
    (firstframe: FRAME_walk01;  lastframe: FRAME_walk04;  frame: @tank_frames_start_walk;  endfunc: tank_walk);

  tank_frames_walk : array [0..15] of mframe_t = (
    (aifunc: ai_walk;  dist: 4;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 3;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 2;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 4;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 4;  thinkfunc: tank_footstep),
    (aifunc: ai_walk;  dist: 3;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 5;  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: 7;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 6;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 6;  thinkfunc: tank_footstep) );
  tank_move_walk : mmove_t =
    (firstframe: FRAME_walk05;  lastframe: FRAME_walk20;  frame: @tank_frames_walk;  endfunc: Nil);

  tank_frames_stop_walk : array [0..4] of mframe_t = (
    (aifunc: ai_walk;  dist: 3;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 3;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 2;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 2;  thinkfunc: Nil),
    (aifunc: ai_walk;  dist: 4;  thinkfunc: tank_footstep) );
  tank_move_stop_walk : mmove_t =
    (firstframe: FRAME_walk21;  lastframe: FRAME_walk25;  frame: @tank_frames_stop_walk;  endfunc: tank_stand);

procedure tank_walk (self : edict_p); cdecl;
begin
  self.monsterinfo.currentmove := @tank_move_walk;
end;//procedure


//
// run
//
const
  tank_frames_start_run : array [0..3] of mframe_t = (
    (aifunc: ai_run;  dist:  0;  thinkfunc: Nil),
    (aifunc: ai_run;  dist:  6;  thinkfunc: Nil),
    (aifunc: ai_run;  dist:  6;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 11;  thinkfunc: tank_footstep) );
  tank_move_start_run : mmove_t =
    (firstframe: FRAME_walk01;  lastframe: FRAME_walk04;  frame: @tank_frames_start_run;  endfunc: tank_run);

  tank_frames_run : array [0..15] of mframe_t = (
    (aifunc: ai_run;  dist: 4;  thinkfunc: Nil),      
    (aifunc: ai_run;  dist: 5;  thinkfunc: Nil),      
    (aifunc: ai_run;  dist: 3;  thinkfunc: Nil),      
    (aifunc: ai_run;  dist: 2;  thinkfunc: Nil),      
    (aifunc: ai_run;  dist: 5;  thinkfunc: Nil),      
    (aifunc: ai_run;  dist: 5;  thinkfunc: Nil),      
    (aifunc: ai_run;  dist: 4;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 4;  thinkfunc: tank_footstep),
    (aifunc: ai_run;  dist: 3;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 4;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 5;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 7;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 7;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 6;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 6;  thinkfunc: tank_footstep) );
  tank_move_run : mmove_t =
    (firstframe: FRAME_walk05;  lastframe: FRAME_walk20;  frame: @tank_frames_run;  endfunc: Nil);

  tank_frames_stop_run : array [0..4] of mframe_t = (
    (aifunc: ai_run;  dist: 3;  thinkfunc: Nil), 
    (aifunc: ai_run;  dist: 3;  thinkfunc: Nil), 
    (aifunc: ai_run;  dist: 2;  thinkfunc: Nil), 
    (aifunc: ai_run;  dist: 2;  thinkfunc: Nil),
    (aifunc: ai_run;  dist: 4;  thinkfunc: tank_footstep) );
  tank_move_stop_run : mmove_t =
    (firstframe: FRAME_walk21;  lastframe: FRAME_walk25;  frame: @tank_frames_stop_run;  endfunc: tank_walk);

procedure tank_run (self : edict_p); cdecl;
begin
  if (self.enemy <> Nil) AND (self.enemy.client <> Nil)
  then self.monsterinfo.aiflags := self.monsterinfo.aiflags OR AI_BRUTAL
  else self.monsterinfo.aiflags := self.monsterinfo.aiflags AND (NOT AI_BRUTAL);

  if (self.monsterinfo.aiflags AND AI_STAND_GROUND) <> 0 then
  begin
    self.monsterinfo.currentmove := @tank_move_stand;
    Exit;
  end;

⌨️ 快捷键说明

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