📄 m_brain.pas
字号:
(aifunc: ai_move; dist: 1; thinkfunc: Nil),
(aifunc: ai_move; dist: 7; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: 3; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: Nil) );
brain_move_pain1 : mmove_t = (firstframe: FRAME_pain101; lastframe: FRAME_pain121; frame: @brain_frames_pain1; endfunc: brain_run);
//
// DUCK
//
procedure brain_duck_down (self : edict_p); cdecl;
begin
if ((self.monsterinfo.aiflags AND AI_DUCKED) <> 0) then
Exit;
self.monsterinfo.aiflags := self.monsterinfo.aiflags OR AI_DUCKED;
self.maxs[2] := self.maxs[2] - 32;
//Y self.takedamage := DAMAGE_YES; //Y: g_local - C2PAS
gi.linkentity (self);
end;//procedure
procedure brain_duck_hold (self : edict_p); cdecl;
begin
if (level.time >= self.monsterinfo.pausetime)
then self.monsterinfo.aiflags := self.monsterinfo.aiflags AND (NOT AI_HOLD_FRAME)
else self.monsterinfo.aiflags := self.monsterinfo.aiflags OR AI_HOLD_FRAME;
end;//procedure
procedure brain_duck_up (self : edict_p); cdecl;
begin
self.monsterinfo.aiflags := self.monsterinfo.aiflags AND (NOT AI_DUCKED);
self.maxs[2] := self.maxs[2] + 32;
//Y self.takedamage := DAMAGE_AIM; //Y: g_local - C2PAS
gi.linkentity (self);
end;//procedure
const
brain_frames_duck : array [0..7] of mframe_t = (
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: -2; thinkfunc: brain_duck_down),
(aifunc: ai_move; dist: 17; thinkfunc: brain_duck_hold),
(aifunc: ai_move; dist: -3; thinkfunc: Nil),
(aifunc: ai_move; dist: -1; thinkfunc: brain_duck_up),
(aifunc: ai_move; dist: -5; thinkfunc: Nil),
(aifunc: ai_move; dist: -6; thinkfunc: Nil),
(aifunc: ai_move; dist: -6; thinkfunc: Nil) );
brain_move_duck : mmove_t = (firstframe: FRAME_duck01; lastframe: FRAME_duck08; frame: @brain_frames_duck; endfunc: brain_run);
procedure brain_dodge (self, attacker : edict_p; eta : float);
begin
if (random > 0.25) then
Exit;
// if (!self.enemy)
if (self.enemy=Nil) then
self.enemy := attacker;
self.monsterinfo.pausetime := level.time + eta + 0.5;
self.monsterinfo.currentmove := @brain_move_duck;
end;//procedure
const
brain_frames_death2 : 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: 9; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil) );
brain_move_death2 : mmove_t = (firstframe: FRAME_death201; lastframe: FRAME_death205; frame: @brain_frames_death2; endfunc: brain_dead);
brain_frames_death1 : array [0..17] of mframe_t = (
(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: 9; 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: 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: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil),
(aifunc: ai_move; dist: 0; thinkfunc: Nil) );
brain_move_death1 : mmove_t = (firstframe: FRAME_death101; lastframe: FRAME_death118; frame: @brain_frames_death1; endfunc: brain_dead);
//
// MELEE
//
procedure brain_swing_right (self : edict_p); cdecl;
begin
gi.sound (self, CHAN_BODY, sound_melee1, 1, ATTN_NORM, 0);
end;//procedure
procedure brain_hit_right (self : edict_p); cdecl;
var
aim : vec3_t;
begin
VectorSet (aim, MELEE_DISTANCE, self.maxs[0], 8);
// if (fire_hit (self, aim, (15 + (rand() %5)), 40)) then
//Y if fire_hit (self, aim, 15 + random(5), 40) then
gi.sound (self, CHAN_WEAPON, sound_melee3, 1, ATTN_NORM, 0);
end;//procedure
procedure brain_swing_left (self : edict_p); cdecl;
begin
gi.sound (self, CHAN_BODY, sound_melee2, 1, ATTN_NORM, 0);
end;//procedure
procedure brain_hit_left (self : edict_p); cdecl;
var
aim : vec3_t;
begin
VectorSet (aim, MELEE_DISTANCE, self.mins[0], 8);
//Y if fire_hit (self, aim, 15 + random(5), 40) then
gi.sound (self, CHAN_WEAPON, sound_melee3, 1, ATTN_NORM, 0);
end;//procedure
const
brain_frames_attack1 : array [0..17] of mframe_t = (
(aifunc: ai_charge; dist: 8; thinkfunc: Nil),
(aifunc: ai_charge; dist: 3; thinkfunc: Nil),
(aifunc: ai_charge; dist: 5; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: -3; thinkfunc: brain_swing_right),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: -5; thinkfunc: Nil),
(aifunc: ai_charge; dist: -7; thinkfunc: brain_hit_right),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 6; thinkfunc: brain_swing_left),
(aifunc: ai_charge; dist: 1; thinkfunc: Nil),
(aifunc: ai_charge; dist: 2; thinkfunc: brain_hit_left),
(aifunc: ai_charge; dist: -3; thinkfunc: Nil),
(aifunc: ai_charge; dist: 6; thinkfunc: Nil),
(aifunc: ai_charge; dist: -1; thinkfunc: Nil),
(aifunc: ai_charge; dist: -3; thinkfunc: Nil),
(aifunc: ai_charge; dist: 2; thinkfunc: Nil),
(aifunc: ai_charge; dist: -11; thinkfunc: Nil) );
brain_move_attack1 : mmove_t = (firstframe: FRAME_attak101; lastframe: FRAME_attak118; frame: @brain_frames_attack1; endfunc: brain_run);
procedure brain_chest_open (self : edict_p); cdecl;
begin
self.spawnflags := self.spawnflags AND (NOT 65536);
self.monsterinfo.power_armor_type := POWER_ARMOR_NONE;
gi.sound (self, CHAN_BODY, sound_chest_open, 1, ATTN_NORM, 0);
end;//procedure
procedure brain_tentacle_attack (self : edict_p); cdecl;
var
aim : vec3_t;
begin
VectorSet (aim, MELEE_DISTANCE, 0, 8);
// if (fire_hit (self, aim, (10 + (rand() %5)), -600) && skill->value > 0)
//Y if fire_hit (self, aim, 10 + random(5), -600) AND (skill.value > 0) then
self.spawnflags := self.spawnflags OR 65536;
gi.sound (self, CHAN_WEAPON, sound_tentacles_retract, 1, ATTN_NORM, 0);
end;//procedure
procedure brain_chest_closed (self : edict_p); cdecl;
begin
self.monsterinfo.power_armor_type := POWER_ARMOR_SCREEN;
// if (self->spawnflags & 65536)
if (self.spawnflags AND 65536) <> 0 then
begin
self.spawnflags := self.spawnflags AND (NOT 65536);
self.monsterinfo.currentmove := @brain_move_attack1;
end;
end;//procedure
const
brain_frames_attack2 : array [0..16] of mframe_t = (
(aifunc: ai_charge; dist: 5; thinkfunc: Nil),
(aifunc: ai_charge; dist: -4; thinkfunc: Nil),
(aifunc: ai_charge; dist: -4; thinkfunc: Nil),
(aifunc: ai_charge; dist: -3; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: brain_chest_open),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 13; thinkfunc: brain_tentacle_attack),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 2; thinkfunc: Nil),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: -9; thinkfunc: brain_chest_closed),
(aifunc: ai_charge; dist: 0; thinkfunc: Nil),
(aifunc: ai_charge; dist: 4; thinkfunc: Nil),
(aifunc: ai_charge; dist: 3; thinkfunc: Nil),
(aifunc: ai_charge; dist: 2; thinkfunc: Nil),
(aifunc: ai_charge; dist: -3; thinkfunc: Nil),
(aifunc: ai_charge; dist: -6; thinkfunc: Nil) );
brain_move_attack2 : mmove_t = (firstframe: FRAME_attak201; lastframe: FRAME_attak217; frame: @brain_frames_attack2; endfunc: brain_run);
procedure brain_melee(self : edict_t);
begin
if (random <= 0.5)
then self.monsterinfo.currentmove := @brain_move_attack1
else self.monsterinfo.currentmove := @brain_move_attack2;
end;//procedure
//
// RUN
//
const
brain_frames_run : array [0..10] of mframe_t = (
(aifunc: ai_run; dist: 9; thinkfunc: Nil),
(aifunc: ai_run; dist: 2; thinkfunc: Nil),
(aifunc: ai_run; dist: 3; thinkfunc: Nil),
(aifunc: ai_run; dist: 3; thinkfunc: Nil),
(aifunc: ai_run; dist: 1; thinkfunc: Nil),
(aifunc: ai_run; dist: 0; thinkfunc: Nil),
(aifunc: ai_run; dist: 0; thinkfunc: Nil),
(aifunc: ai_run; dist: 10; thinkfunc: Nil),
(aifunc: ai_run; dist: -4; thinkfunc: Nil),
(aifunc: ai_run; dist: -1; thinkfunc: Nil),
(aifunc: ai_run; dist: 2; thinkfunc: Nil) );
brain_move_run : mmove_t = (firstframe: FRAME_walk101; lastframe: FRAME_walk111; frame: @brain_frames_run; endfunc: Nil);
procedure brain_run (self : edict_p); cdecl; //Y: need test
begin
self.monsterinfo.power_armor_type := POWER_ARMOR_SCREEN;
if (self.monsterinfo.aiflags AND AI_STAND_GROUND) <> 0
then self.monsterinfo.currentmove := @brain_move_stand
else self.monsterinfo.currentmove := @brain_move_run;
end;//procedure
procedure brain_pain (self, other : edict_p; kick : float; damage : integer);
var
r : float;
begin
if (self.health < (self.max_health / 2)) then
self.s.skinnum := 1;
if (level.time < self.pain_debounce_time) then
Exit;
self.pain_debounce_time := level.time + 3;
if (skill.value = 3) then
Exit; // no pain anims in nightmare
r := random;
if (r < 0.33)
then begin
gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
self.monsterinfo.currentmove := @brain_move_pain1;
end
else
if (r < 0.66)
then begin
gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
self.monsterinfo.currentmove := @brain_move_pain2;
end
else begin
gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
self.monsterinfo.currentmove := @brain_move_pain3;
end;
end;//procedure
procedure brain_dead (self : edict_p); cdecl;
begin
VectorSet (self.mins, -16, -16, -24);
VectorSet (self.maxs, 16, 16, -8);
//Y self.movetype := MOVETYPE_TOSS; //Y: g_local - C2PAS
self.svflags := self.svflags OR SVF_DEADMONSTER;
self.nextthink := 0;
gi.linkentity (self);
end;//procedure
procedure brain_die (self, inflictor, attacker : edict_p; damage : integer; point : vec3_t);
var
n : integer;
begin
self.s.effects := 0;
self.monsterinfo.power_armor_type := POWER_ARMOR_NONE;
// check for gib
if (self.health <= self.gib_health) then
begin
gi.sound (self, CHAN_VOICE, gi.soundindex ('misc/udeath.wav'), 1, ATTN_NORM, 0);
for n:=0 to 1 do
(*Y ThrowGib (self, 'models/objects/gibs/bone/tris.md2', damage, GIB_ORGANIC);
for n:=0 to 3 do
ThrowGib (self, 'models/objects/gibs/sm_meat/tris.md2', damage, GIB_ORGANIC);
ThrowHead (self, 'models/objects/gibs/head2/tris.md2', damage, GIB_ORGANIC);*)
self.deadflag := DEAD_DEAD;
Exit;
end;
if (self.deadflag = DEAD_DEAD) then
Exit;
// regular death
gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
self.deadflag := DEAD_DEAD;
self.takedamage := DAMAGE_YES; //Y: g_local - C2PAS
if (random <= 0.5)
then self.monsterinfo.currentmove := @brain_move_death1
else self.monsterinfo.currentmove := @brain_move_death2;
end;//procedure
{*QUAKED monster_brain (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
*}
procedure SP_monster_brain (self : edict_p);
begin
if (deathmatch.value <> 0) then
begin
//Y G_FreeEdict (self);
Exit;
end;
sound_chest_open := gi.soundindex ('brain/brnatck1.wav');
sound_tentacles_extend := gi.soundindex ('brain/brnatck2.wav');
sound_tentacles_retract := gi.soundindex ('brain/brnatck3.wav');
sound_death := gi.soundindex ('rain/brndeth1.wav');
sound_idle1 := gi.soundindex ('rain/brnidle1.wav');
sound_idle2 := gi.soundindex ('brain/brnidle2.wav');
sound_idle3 := gi.soundindex ('brain/brnlens1.wav');
sound_pain1 := gi.soundindex ('brain/brnpain1.wav');
sound_pain2 := gi.soundindex ('brain/brnpain2.wav');
sound_sight := gi.soundindex ('brain/brnsght1.wav');
sound_search := gi.soundindex ('rain/brnsrch1.wav');
sound_melee1 := gi.soundindex ('brain/melee1.wav');
sound_melee2 := gi.soundindex ('brain/melee2.wav');
sound_melee3 := gi.soundindex ('brain/melee3.wav');
self.movetype := MOVETYPE_STEP; //Y: g_local - C2PAS
self.solid := SOLID_BBOX;
self.s.modelindex := gi.modelindex ('models/monsters/brain/tris.md2');
VectorSet (self.mins, -16, -16, -24);
VectorSet (self.maxs, 16, 16, 32);
self.health := 300;
self.gib_health := -150;
self.mass := 400;
self.pain := @brain_pain;
self.die := @brain_die;
self.monsterinfo.stand := @brain_stand;
self.monsterinfo.walk := @brain_walk;
self.monsterinfo.run := @brain_run;
self.monsterinfo.dodge := @brain_dodge;
//idsoft self->monsterinfo.attack = brain_attack;
self.monsterinfo.melee := @brain_melee;
self.monsterinfo.sight := @brain_sight;
self.monsterinfo.search := @brain_search;
self.monsterinfo.idle := @brain_idle;
self.monsterinfo.power_armor_type := POWER_ARMOR_SCREEN;
self.monsterinfo.power_armor_power := 100;
gi.linkentity (self);
self.monsterinfo.currentmove := @brain_move_stand;
self.monsterinfo.scale := MODEL_SCALE;
//Y walkmonster_start (self);
end;//procedure
// End of file
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -