📄 m_insane.pas
字号:
(aifunc: ai_walk; dist: 2.1; thinkfunc: nil),
(aifunc: ai_walk; dist: 3.6; thinkfunc: nil),
(aifunc: ai_walk; dist: 2; thinkfunc: nil),
(aifunc: ai_walk; dist: 0.9; thinkfunc: nil),
(aifunc: ai_walk; dist: 3; thinkfunc: nil),
(aifunc: ai_walk; dist: 3.4; thinkfunc: nil),
(aifunc: ai_walk; dist: 2.4; thinkfunc: nil));
insane_move_crawl: mmove_t = (firstframe: FRAME_crawl1; lastframe:FRAME_crawl9; frame:@insane_frames_crawl;
endfunc: nil);
insane_move_runcrawl: mmove_t = (firstframe: FRAME_crawl1; lastframe:FRAME_crawl9; frame:@insane_frames_crawl;
endfunc: nil);
insane_frames_crawl_pain: array [0..8] 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),
(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));
insane_move_crawl_pain: mmove_t = (firstframe: FRAME_cr_pain2; lastframe:FRAME_cr_pain10; frame:@insane_frames_crawl_pain;
endfunc: insane_run);
insane_frames_crawl_death: array [0..6] 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),
(aifunc: ai_move; dist: 0; thinkfunc: nil),
(aifunc: ai_move; dist: 0; thinkfunc: nil));
insane_move_crawl_death: mmove_t = (firstframe: FRAME_cr_death10; lastframe:FRAME_cr_death16; frame:@insane_frames_crawl_death;
endfunc: insane_run);
insane_frames_cross: array [0..14] of mframe_t = (
(aifunc: ai_move; dist: 0; thinkfunc: insane_moan),
(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));
insane_move_cross: mmove_t = (firstframe: FRAME_cross1; lastframe:FRAME_cross15; frame:@insane_frames_cross;
endfunc: insane_cross);
insane_frames_struggle_cross: array [0..14] of mframe_t = (
(aifunc: ai_move; dist: 0; thinkfunc: insane_scream),
(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));
insane_move_struggle_cross: mmove_t = (firstframe: FRAME_cross16; lastframe:FRAME_cross30; frame:@insane_frames_struggle_cross;
endfunc: insane_cross);
procedure insane_fist(self: edict_p);
begin
gi.sound(self, CHAN_VOICE, sound_fist, 1, ATTN_IDLE, 0);
end;
procedure insane_shake(self: edict_p);
begin
gi.sound(self, CHAN_VOICE, sound_shake, 1, ATTN_IDLE, 0);
end;
procedure insane_moan(self: edict_p);
begin
gi.sound(self, CHAN_VOICE, sound_moan, 1, ATTN_IDLE, 0);
end;
procedure insane_scream (self: edict_p);
begin
gi.sound(self, CHAN_VOICE, sound_scream[rand() mod 8], 1, ATTN_IDLE, 0);
end;
procedure insane_cross(self: edict_p);
begin
if (_random() < 0.8) then
self^.monsterinfo.currentmove:= @insane_move_cross
else
self^.monsterinfo.currentmove:= @insane_move_struggle_cross;
end;
procedure insane_walk(self: edict_p);
begin
if (self^.spawnflags and 16) <> 0 then // Hold Ground?
if (self^.s.frame = FRAME_cr_pain10) then begin
self^.monsterinfo.currentmove:= @insane_move_down;
exit;
end;
if (self^.spawnflags and 4) <> 0 then self^.monsterinfo.currentmove:= @insane_move_crawl
else
if (_random() <= 0.5) then
self^.monsterinfo.currentmove:= @insane_move_walk_normal
else
self^.monsterinfo.currentmove:= @insane_move_walk_insane;
end;
procedure insane_run(self: edict_p);
begin
if (self^.spawnflags and 16) <> 0 then // Hold Ground?
if (self^.s.frame = FRAME_cr_pain10) then begin
self^.monsterinfo.currentmove := @insane_move_down;
exit;
end;
if (self^.spawnflags and 4) <> 0 then // Crawling?
self^.monsterinfo.currentmove:= @insane_move_runcrawl
else
if (_random() <= 0.5) then // Else, mix it up
self^.monsterinfo.currentmove:= @insane_move_run_normal
else
self^.monsterinfo.currentmove:= @insane_move_run_insane;
end;
procedure insane_pain(self: edict_p; other: edict_p; kick: single; damage: integer);
var
l, r: integer;
begin
// if (self->health < (self->max_health / 2))
// self->s.skinnum = 1;
if (level.time < self^.pain_debounce_time) then exit;
self^.pain_debounce_time:= level.time + 3;
r:= 1 + (rand() and 1);
if (self^.health < 25) then
l:= 25
else if (self^.health < 50) then
l:= 50
else if (self^.health < 75) then
l:= 75
else l:= 100;
gi.sound(self, CHAN_VOICE, gi.soundindex (va('player/male/pain%i_%i.wav', [l, r])), 1, ATTN_IDLE, 0);
if (skill^.value = 3) then exit; // no pain anims in nightmare
// Don't go into pain frames if crucified.
if (self^.spawnflags and 8) <> 0 then begin
self^.monsterinfo.currentmove := @insane_move_struggle_cross;
exit;
end;
if ( ((self^.s.frame >= FRAME_crawl1) and (self^.s.frame <= FRAME_crawl9)) or ((self^.s.frame >= FRAME_stand99) and (self^.s.frame <= FRAME_stand160)) ) then begin
self^.monsterinfo.currentmove := @insane_move_crawl_pain;
end else self^.monsterinfo.currentmove := @insane_move_stand_pain;
end;
procedure insane_onground(self: edict_p);
begin
self^.monsterinfo.currentmove := @insane_move_down;
end;
procedure insane_checkdown(self: edict_p);
begin
// if ( (self.s.frame == FRAME_stand94) || (self.s.frame == FRAME_stand65) )
if (Self.spawnflags and 32) <> 0 then
exit; // Always stand
if (_random() < 0.3) then
if (_random() < 0.5) then
self^.monsterinfo.currentmove:= @insane_move_uptodown
else
self^.monsterinfo.currentmove:= @insane_move_jumpdown;
end;
procedure insane_checkup(self: edict_p);
begin
// If Hold_Ground and Crawl are set
if ((self^.spawnflags and 4) and (self^.spawnflags and 16)) <> 0 then exit;
if (_random() < 0.5) then
self^.monsterinfo.currentmove := @insane_move_downtoup;
end;
procedure insane_stand(self: edict_p);
begin
if (self^.spawnflags and 8) <> 0 then begin // If crucified
self^.monsterinfo.currentmove:= @insane_move_cross;
self^.monsterinfo.aiflags:= self^.monsterinfo.aiflags or AI_STAND_GROUND;
end
// If Hold_Ground and Crawl are set
else if ((self^.spawnflags and 4) and (self^.spawnflags and 16)) <> 0 then
self^.monsterinfo.currentmove:= @insane_move_down
else
if (_random() < 0.5) then
self^.monsterinfo.currentmove := @insane_move_stand_normal
else self^.monsterinfo.currentmove:= @insane_move_stand_insane;
end;
procedure insane_dead(self: edict_p);
begin
if (self.spawnflags and 8) <> 0 then begin
self^.flags:= self^.flags or FL_FLY;
end else begin
VectorSet(self^.mins, -16, -16, -24);
VectorSet(self^.maxs, 16, 16, -8);
self^.movetype := MOVETYPE_TOSS;
end;
self^.svflags:= self^.svflags or SVF_DEADMONSTER;
self^.nextthink:= 0;
gi.linkentity(self);
end;
procedure insane_die(self: edict_p; inflictor: edict_p; attacker: edict_p; damage: Integer; const point: vec3_t);
var
n: integer;
begin
if (self^.health <= self^.gib_health) then begin
gi.sound(self, CHAN_VOICE, gi.soundindex('misc/udeath.wav'), 1, ATTN_IDLE, 0);
for n:= 0 to 1 do
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;
gi.sound(self, CHAN_VOICE, gi.soundindex(va('player/male/death%i.wav', [(rand() mod 4)+1])), 1, ATTN_IDLE, 0);
self^.deadflag:= DEAD_DEAD;
self^.takedamage:= DAMAGE_YES;
if (self^.spawnflags and 8) <> 0 then begin
insane_dead(self);
end else begin
if (((self^.s.frame >= FRAME_crawl1) and (self^.s.frame <= FRAME_crawl9)) or ((self.s.frame >= FRAME_stand99) and (self.s.frame <= FRAME_stand160))) then
self.monsterinfo.currentmove := @insane_move_crawl_death
else
self^.monsterinfo.currentmove := @insane_move_stand_death;
end;
end;
{/*QUAKED misc_insane (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn CRAWL CRUCIFIED STAND_GROUND ALWAYS_STAND
*/}
procedure SP_misc_insane(self: edict_p);
begin
// static int skin = 0; //@@
if (deathmatch^.Value <> 0) then
begin
G_FreeEdict(self);
exit;
end;
sound_fist:= gi.soundindex ('insane/insane11.wav');
sound_shake:= gi.soundindex ('insane/insane5.wav');
sound_moan:= gi.soundindex ('insane/insane7.wav');
sound_scream[0]:= gi.soundindex ('insane/insane1.wav');
sound_scream[1]:= gi.soundindex ('insane/insane2.wav');
sound_scream[2]:= gi.soundindex ('insane/insane3.wav');
sound_scream[3]:= gi.soundindex ('insane/insane4.wav');
sound_scream[4]:= gi.soundindex ('insane/insane6.wav');
sound_scream[5]:= gi.soundindex ('insane/insane8.wav');
sound_scream[6]:= gi.soundindex ('insane/insane9.wav');
sound_scream[7]:= gi.soundindex ('insane/insane10.wav');
self^.movetype:= MOVETYPE_STEP;
self^.solid:= SOLID_BBOX;
self^.s.modelindex:= gi.modelindex('models/monsters/insane/tris.md2');
VectorSet(self^.mins, -16, -16, -24);
VectorSet(self^.maxs, 16, 16, 32);
self^.health := 100;
self^.gib_health := -50;
self^.mass := 300;
self^.pain := insane_pain;
self^.die := insane_die;
self^.monsterinfo.stand:= insane_stand;
self^.monsterinfo.walk:= insane_walk;
self^.monsterinfo.run:= insane_run;
self^.monsterinfo.dodge:= nil;
self^.monsterinfo.attack:= nil;
self^.monsterinfo.melee:= nil;
self^.monsterinfo.sight:= nil;
self^.monsterinfo.aiflags:= self^.monsterinfo.aiflags or AI_GOOD_GUY;
//@@
// self.s.skinnum = skin;
// skin++;
// if (skin > 12)
// skin = 0;
gi.linkentity(self);
if (self^.spawnflags and 16) <> 0 then // Stand Ground
self^.monsterinfo.aiflags:= self^.monsterinfo.aiflags or AI_STAND_GROUND;
self^.monsterinfo.currentmove:= @insane_move_stand_normal;
self^.monsterinfo.scale:= MODEL_SCALE;
if (Self.spawnflags and 8) <> 0 then begin // Crucified ?
VectorSet(self^.mins, -16, 0, 0);
VectorSet(self^.maxs, 16, 8, 32);
self^.flags:= self^.flags or FL_NO_KNOCKBACK;
flymonster_start(self);
end else begin
walkmonster_start(self);
self^.s.skinnum:= rand() mod 3;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -