📄 m_boss2.c
字号:
/*
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
==============================================================================
boss2
==============================================================================
*/
#include "g_local.h"
#include "m_boss2.h"
void BossExplode (edict_t *self);
qboolean infront (edict_t *self, edict_t *other);
static int sound_pain1;
static int sound_pain2;
static int sound_pain3;
static int sound_death;
static int sound_search1;
void boss2_search (edict_t *self)
{
if (random() < 0.5)
gi.sound (self, CHAN_VOICE, sound_search1, 1, ATTN_NONE, 0);
}
void boss2_run (edict_t *self);
void boss2_stand (edict_t *self);
void boss2_dead (edict_t *self);
void boss2_attack (edict_t *self);
void boss2_attack_mg (edict_t *self);
void boss2_reattack_mg (edict_t *self);
void boss2_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
void Boss2Rocket (edict_t *self)
{
vec3_t forward, right;
vec3_t start;
vec3_t dir;
vec3_t vec;
AngleVectors (self->s.angles, forward, right, NULL);
//1
G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_BOSS2_ROCKET_1], forward, right, start);
VectorCopy (self->enemy->s.origin, vec);
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], forward, right, start);
VectorCopy (self->enemy->s.origin, vec);
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], forward, right, start);
VectorCopy (self->enemy->s.origin, vec);
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], forward, right, start);
VectorCopy (self->enemy->s.origin, vec);
vec[2] += self->enemy->viewheight;
VectorSubtract (vec, start, dir);
VectorNormalize (dir);
monster_fire_rocket (self, start, dir, 50, 500, MZ2_BOSS2_ROCKET_4);
}
void boss2_firebullet_right (edict_t *self)
{
vec3_t forward, right, target;
vec3_t start;
AngleVectors (self->s.angles, forward, right, NULL);
G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_R1], forward, right, start);
VectorMA (self->enemy->s.origin, -0.2, self->enemy->velocity, target);
target[2] += self->enemy->viewheight;
VectorSubtract (target, start, forward);
VectorNormalize (forward);
monster_fire_bullet (self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_R1);
}
void boss2_firebullet_left (edict_t *self)
{
vec3_t forward, right, target;
vec3_t start;
AngleVectors (self->s.angles, forward, right, NULL);
G_ProjectSource (self->s.origin, monster_flash_offset[MZ2_BOSS2_MACHINEGUN_L1], forward, right, start);
VectorMA (self->enemy->s.origin, -0.2, self->enemy->velocity, target);
target[2] += self->enemy->viewheight;
VectorSubtract (target, start, forward);
VectorNormalize (forward);
monster_fire_bullet (self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, MZ2_BOSS2_MACHINEGUN_L1);
}
void Boss2MachineGun (edict_t *self)
{
/* vec3_t forward, right;
vec3_t start;
vec3_t dir;
vec3_t vec;
int flash_number;
AngleVectors (self->s.angles, forward, right, NULL);
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] += 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);
}
mframe_t boss2_frames_stand [] =
{
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL
};
mmove_t boss2_move_stand = {FRAME_stand30, FRAME_stand50, boss2_frames_stand, NULL};
mframe_t boss2_frames_fidget [] =
{
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL,
ai_stand, 0, NULL
};
mmove_t boss2_move_fidget = {FRAME_stand1, FRAME_stand30, boss2_frames_fidget, NULL};
mframe_t boss2_frames_walk [] =
{
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL,
ai_walk, 8, NULL
};
mmove_t boss2_move_walk = {FRAME_walk1, FRAME_walk20, boss2_frames_walk, NULL};
mframe_t boss2_frames_run [] =
{
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL,
ai_run, 8, NULL
};
mmove_t boss2_move_run = {FRAME_walk1, FRAME_walk20, boss2_frames_run, NULL};
mframe_t boss2_frames_attack_pre_mg [] =
{
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, boss2_attack_mg
};
mmove_t boss2_move_attack_pre_mg = {FRAME_attack1, FRAME_attack9, boss2_frames_attack_pre_mg, NULL};
// Loop this
mframe_t boss2_frames_attack_mg [] =
{
ai_charge, 1, Boss2MachineGun,
ai_charge, 1, Boss2MachineGun,
ai_charge, 1, Boss2MachineGun,
ai_charge, 1, Boss2MachineGun,
ai_charge, 1, Boss2MachineGun,
ai_charge, 1, boss2_reattack_mg
};
mmove_t boss2_move_attack_mg = {FRAME_attack10, FRAME_attack15, boss2_frames_attack_mg, NULL};
mframe_t boss2_frames_attack_post_mg [] =
{
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL
};
mmove_t boss2_move_attack_post_mg = {FRAME_attack16, FRAME_attack19, boss2_frames_attack_post_mg, boss2_run};
mframe_t boss2_frames_attack_rocket [] =
{
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_move, -20, Boss2Rocket,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL,
ai_charge, 1, NULL
};
mmove_t boss2_move_attack_rocket = {FRAME_attack20, FRAME_attack40, boss2_frames_attack_rocket, boss2_run};
mframe_t boss2_frames_pain_heavy [] =
{
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
ai_move, 0, NULL,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -