📄 m_boss2.pas
字号:
{----------------------------------------------------------------------------}
{ }
{ File(s): m_boss2.h }
{ }
{ Initial conversion by : Ben Watt (ben@delphigamedev.com) }
{ Initial conversion on : 05-March-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 }
{----------------------------------------------------------------------------}
{
==============================================================================
boss2
==============================================================================
}
unit m_boss2;
interface
const MODEL_SCALE = 1.000000;
var
sound_pain1,
sound_pain2,
sound_pain3,
sound_death,
sound_search1 : Integer;
{$I g_local.inc}
{$I m_boss2.inc}
function infront(self, other : edict_t): qboolean;
procedure boss2_search(self : edict_t);
begin
if (random() < 0.5) then
gi.sound(self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0);
end;
procedure Boss2Rocket(self : edict_t);
var
fwrd, right : vec3_t;
start : vec3_t;
dir : vec3_t;
vec : vec3_t;
begin
AngleVectors(self.s.angles, fwrd, right, nil);
//1
G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_1], fwrd, right, start);
VectorCopy(self.enemy.s.origin, vec);
vec[2] := vec[2] + self.enemy.viewheight;
VectorSubtract(vec, start, dir);
VectorNormalize(dir);
monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_1);
//2
G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_2], fwrd, right, start);
VectorCopy(self.enemy.s.origin, vec);
vec[2] := vec[2] + self.enemy.viewheight;
VectorSubtract(vec, start, dir);
VectorNormalize(dir);
monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_2);
//3
G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_3], fwrd, right, start);
VectorCopy(self.enemy.s.origin, vec);
vec[2] := vec[2] + self.enemy.viewheight;
VectorSubtract(vec, start, dir);
VectorNormalize(dir);
monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_3);
//4
G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_4], fwrd, right, start);
VectorCopy(self.enemy.s.origin, vec);
vec[2] := vec[2] + self.enemy.viewheight;
VectorSubtract(vec, start, dir);
VectorNormalize(dir);
monster_fire_rocket(self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_4);
end;
procedure boss2_firebullet_right(self : edict_t);
var
fwrd, right, target : vec3_t;
start : vec3_t;
begin
AngleVectors(self.s.angles, fwrd, right, nil);
G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_R1], fwrd, right, start);
VectorMA(self.enemy.s.origin, -0.2, self.enemy.velocity, target);
target[2] := target[2] + self.enemy.viewheight;
VectorSubtract(target, start, fwrd);
VectorNormalize(fwrd);
monster_fire_bullet(self, start, fwrd, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_R1);
end;
procedure boss2_firebullet_left(self : edict_t);
var
fwrd, right, target : vec3_t;
start : vec3_t;
begin
AngleVectors(self.s.angles, fwrd, right, nil);
G_ProjectSource(self.s.origin, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_L1], fwrd, right, start);
VectorMA(self.enemy.s.origin, -0.2, self.enemy.velocity, target);
target[2] := target[2] + self.enemy.viewheight;
VectorSubtract(target, start, fwrd);
VectorNormalize(fwrd);
monster_fire_bullet(self, start, fwrd, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_L1);
end;
procedure Boss2MachineGun(self : edict_t);
{var
fwrd, right : vec3_t;
start : vec3_t;
dir : vec3_t;
vec : vec3_t;
flash_number : integer; }
begin
{ AngleVectors(self.s.angles, forward, right, nil);
flash_number := MZ2_BOSS2_MACHINEGUN_1 + (self.s.frame - FRAME_attack10);
G_ProjectSource(self.s.origin, monster_flash_offset[flash_number], forward, right, start);
VectorCopy(self.enemy.s.origin, vec);
vec[2] := vec[2] + self.enemy.viewheight;
VectorSubtract(vec, start, dir);
VectorNormalize(dir);
monster_fire_bullet(self, start, dir, 3, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
}
boss2_firebullet_left(self);
boss2_firebullet_right(self);
end;
const
boss2_frames_stand : Array[0..20] 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));
boss2_move_stand : mmove_t =
(firstframe:FRAME_stand30; lastframe:FRAME_stand50; frame:boss2_frames_stand; endfunc:nil);
boss2_frames_fidget : 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));
boss2_move_fidget : mmove_t =
(firstframe:FRAME_stand1; lastframe:FRAME_stand30; frame:boss2_frames_fidget; endfunc:nil);
boss2_frames_walk : Array[0..19] of mframe_t =
((aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil),
(aifunc:ai_walk; dist:8; thinkfunc:nil));
boss2_move_walk : mmove_t =
(firstframe:FRAME_walk1; lastframe:FRAME_walk20; frame:boss2_frames_walk; endfunc:nil);
boss2_frames_run : Array[0..19] 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),
(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),
(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),
(aifunc:ai_run; dist:8; thinkfunc:nil),
(aifunc:ai_run; dist:8; thinkfunc:nil));
boss2_move_run : mmove_t =
(firstframe:FRAME_walk1; lastframe:FRAME_walk20; frame:boss2_frames_run; endfunc:nil);
boss2_frames_attack_pre_mg : Array[0..8] of mframe_t =
((aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:boss2_attack_mg));
boss2_move_attack_pre_mg : mmove_t =
(firstframe:FRAME_attack1; lastframe:FRAME_attack9; frame:boss2_frames_attack_pre_mg; endfunc:nil);
// Loop this
boss2_frames_attack_mg : Array[0..5] of mframe_t =
((aifunc:ai_charge; dist:1; thinkfunc:Boss2MachineGun),
(aifunc:ai_charge; dist:1; thinkfunc:Boss2MachineGun),
(aifunc:ai_charge; dist:1; thinkfunc:Boss2MachineGun),
(aifunc:ai_charge; dist:1; thinkfunc:Boss2MachineGun),
(aifunc:ai_charge; dist:1; thinkfunc:Boss2MachineGun),
(aifunc:ai_charge; dist:1; thinkfunc:boss2_reattack_mg));
boss2_move_attack_mg : mmove_t =
(firstframe:FRAME_attack10; lastframe:FRAME_attack15; frame:boss2_frames_attack_mg; endfunc:nil);
boss2_frames_attack_post_mg : Array[0..3] of mframe_t =
((aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil));
boss2_move_attack_post_mg : mmove_t =
(firstframe:FRAME_attack16; lastframe:FRAME_attack19; frame:boss2_frames_attack_post_mg; endfunc:boss2_run);
boss2_frames_attack_rocket : Array[0..20] of mframe_t =
((aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_move; dist:-20; thinkfunc:Boss2Rocket),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil),
(aifunc:ai_charge; dist:1; thinkfunc:nil));
boss2_move_attack_rocket : mmove_t =
(firstframe:FRAME_attack20; lastframe:FRAME_attack40; frame:boss2_frames_attack_rocket; endfunc:boss2_run);
boss2_frames_pain_heavy : Array[0..17] 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),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -