📄 m_tank.pas
字号:
if (self.monsterinfo.currentmove = @tank_move_walk) OR
(self.monsterinfo.currentmove = @tank_move_start_run)
then self.monsterinfo.currentmove := @tank_move_run
else self.monsterinfo.currentmove := @tank_move_start_run;
end;//procedure
//
// pain
//
const
tank_frames_pain1 : 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) );
tank_move_pain1 : mmove_t =
(firstframe: FRAME_pain101; lastframe: FRAME_pain104; frame: @tank_frames_pain1; endfunc: tank_run);
tank_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) );
tank_move_pain2 : mmove_t =
(firstframe: FRAME_pain201; lastframe: FRAME_pain205; frame: @tank_frames_pain2; endfunc: tank_run);
tank_frames_pain3 : array [0..15] of mframe_t = (
(aifunc: ai_move; dist: -7; 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: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: 3; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; 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: tank_footstep) );
tank_move_pain3 : mmove_t =
(firstframe: FRAME_pain301; lastframe: FRAME_pain316; frame: @tank_frames_pain3; endfunc: tank_run);
procedure tank_pain (self, other : edict_p; kick : float; damage : integer);
begin
if (self.health < self.max_health / 2) then
self.s.skinnum := self.s.skinnum OR 1;
if (damage <= 10) then
Exit;
if (level.time < self.pain_debounce_time) then
Exit;
if (damage <= 30) then
if (random > 0.2) then
Exit;
// If hard or nightmare, don't go into pain while attacking
if (skill.value >= 2) then
begin
if (self.s.frame >= FRAME_attak301) AND (self.s.frame <= FRAME_attak330) then
Exit;
if (self.s.frame >= FRAME_attak101) AND (self.s.frame <= FRAME_attak116) then
Exit;
end;
self.pain_debounce_time := level.time + 3;
gi.sound (self, CHAN_VOICE, sound_pain, 1, ATTN_NORM, 0);
if (skill.value = 3) then
Exit; // no pain anims in nightmare
if (damage <= 30)
then self.monsterinfo.currentmove := @tank_move_pain1
else
if (damage <= 60)
then self.monsterinfo.currentmove := @tank_move_pain2
else self.monsterinfo.currentmove := @tank_move_pain3;
end;//procedure
//
// attacks
//
procedure TankBlaster (self : edict_p); cdecl;
var
forward_, right,
start,
end_,
dir : vec3_t;
flash_number : integer;
begin
if (self.s.frame = FRAME_attak110)
then flash_number := MZ2_TANK_BLASTER_1
else
if (self.s.frame = FRAME_attak113)
then flash_number := MZ2_TANK_BLASTER_2
else begin
//idsoft (self->s.frame == FRAME_attak116)
flash_number := MZ2_TANK_BLASTER_3;
end;
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, 30, 800, flash_number, EF_BLASTER);
end;//procedure
procedure TankStrike (self : edict_p); cdecl;
begin
gi.sound (self, CHAN_WEAPON, sound_strike, 1, ATTN_NORM, 0);
end;//procedure
procedure TankRocket (self : edict_p); cdecl;
var
forward_, right,
start,
dir,
vec : vec3_t;
flash_number : integer;
begin
if (self.s.frame = FRAME_attak324)
then flash_number := MZ2_TANK_ROCKET_1
else
if (self.s.frame = FRAME_attak327)
then flash_number := MZ2_TANK_ROCKET_2
else begin
//idsoft (self->s.frame == FRAME_attak330)
flash_number := MZ2_TANK_ROCKET_3;
end;
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, vec);
vec[2] := vec[2] +self.enemy.viewheight;
VectorSubtract (vec, start, dir);
VectorNormalize (dir);
//Y monster_fire_rocket (self, start, dir, 50, 550, flash_number);
end;//procedure
procedure TankMachineGun (self : edict_p); cdecl;
var
dir,
vec,
start,
forward_, right : vec3_t;
flash_number : integer;
begin
flash_number := MZ2_TANK_MACHINEGUN_1 + (self.s.frame - FRAME_attak406);
AngleVectors (self.s.angles, @forward_, @right, Nil);
//Y G_ProjectSource (self.s.origin, monster_flash_offset[flash_number], forward_, right, start);
if (self.enemy <> Nil)
then begin
VectorCopy (self.enemy.s.origin, vec);
vec[2] := vec[2] +self.enemy.viewheight;
VectorSubtract (vec, start, vec);
//Y vectoangles (vec, vec);
dir[0] := vec[0];
end
else dir[0] := 0;
if (self.s.frame <= FRAME_attak415)
then dir[1] := self.s.angles[1] - 8 * (self.s.frame - FRAME_attak411)
else dir[1] := self.s.angles[1] + 8 * (self.s.frame - FRAME_attak419);
dir[2] := 0;
AngleVectors (dir, @forward_, Nil, Nil);
//Y monster_fire_bullet (self, start, forward_, 20, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
end;//procedure
const
tank_frames_attack_blast : array [0..15] 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: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: -1; thinkfunc: Nil),
(aifunc: ai_charge; dist: -2; thinkfunc: Nil),
(aifunc: ai_charge; dist: -1; thinkfunc: Nil),
(aifunc: ai_charge; dist: -1; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: TankBlaster), // 10
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: TankBlaster),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: TankBlaster) ); // 16
tank_move_attack_blast : mmove_t =
(firstframe: FRAME_attak101; lastframe: FRAME_attak116; frame: @tank_frames_attack_blast; endfunc: tank_reattack_blaster);
tank_frames_reattack_blast : array [0..5] of mframe_t = (
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: TankBlaster),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: TankBlaster) ); // 16
tank_move_reattack_blast : mmove_t =
(firstframe: FRAME_attak111; lastframe: FRAME_attak116; frame: @tank_frames_reattack_blast; endfunc: tank_reattack_blaster);
tank_frames_attack_post_blast : array [0..5] of mframe_t = (
(aifunc: ai_move; dist: 0; thinkfunc: Nil), // 17
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: 3; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: -2; thinkfunc: tank_footstep) ); // 22
tank_move_attack_post_blast : mmove_t =
(firstframe: FRAME_attak117; lastframe: FRAME_attak122; frame: @tank_frames_attack_post_blast; endfunc: tank_run);
procedure tank_reattack_blaster (self : edict_p);cdecl;
begin
if (skill.value >= 2) then
//Y if (visible (self, self.enemy)) then
if (self.enemy.health > 0) then
if (random <= 0.6) then
begin
self.monsterinfo.currentmove := @tank_move_reattack_blast;
Exit;
end;
self.monsterinfo.currentmove := @tank_move_attack_post_blast;
end;//procedure
procedure tank_poststrike (self : edict_p); cdecl;
begin
self.enemy := Nil;
tank_run (self);
end;//procedure
const
tank_frames_attack_strike : array [0..37] of mframe_t = (
(aifunc: ai_move; dist: 3; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: 1; thinkfunc: Nil),
(aifunc: ai_move; dist: 6; thinkfunc: Nil),
(aifunc: ai_move; dist: 7; thinkfunc: Nil),
(aifunc: ai_move; dist: 9; thinkfunc: tank_footstep),
(aifunc: ai_move; dist: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: 1; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; thinkfunc: Nil),
(aifunc: ai_move; dist: 2; thinkfunc: tank_footstep),
(aifunc: ai_move; dist: 2; 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: -2; thinkfunc: Nil),
(aifunc: ai_move; dist: -2; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: tank_windup),
(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: TankStrike),
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: Nil),
(aifunc: ai_move; dist: -3; thinkfunc: Nil),
(aifunc: ai_move; dist: -10; thinkfunc: Nil),
(aifunc: ai_move; dist: -10; thinkfunc: Nil),
(aifunc: ai_move; dist: -2; thinkfunc: Nil),
(aifunc: ai_move; dist: -3; thinkfunc: Nil),
(aifunc: ai_move; dist: -2; thinkfunc: tank_footstep) );
tank_move_attack_strike : mmove_t =
(firstframe: FRAME_attak201; lastframe: FRAME_attak238; frame: @tank_frames_attack_strike; endfunc: tank_poststrike);
tank_frames_attack_pre_rocket : array [0..20] 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: 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),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil), // 10
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 1; thinkfunc: Nil),
(aifunc: ai_charge; dist: 2; thinkfunc: Nil),
(aifunc: ai_charge; dist: 7; thinkfunc: Nil),
(aifunc: ai_charge; dist: 7; thinkfunc: Nil),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -