hexen2-siege-hc/monsters.hc

329 lines
6.1 KiB
C++
Raw Normal View History

1998-06-24 00:00:00 +00:00
/*
* $Header: /HexenWorld/Siege/MONSTERS.hc 4 5/25/98 1:39p Mgummelt $
*/
/* ALL MONSTERS SHOULD BE 1 0 0 IN COLOR */
// name =[framenum, nexttime, nextthink] {code}
// expands to:
// name ()
// {
// self.frame=framenum;
// self.nextthink = time + nexttime;
// self.think = nextthink
// <code>
// };
/*
================
monster_use
Using a monster makes it angry at the current activator
================
*/
void() monster_use =
{
if (self.enemy)
return;
if (self.health <= 0)
return;
if (activator.items & IT_INVISIBILITY)
return;
if (activator.flags & FL_NOTARGET)
return;
if (activator.classname != "player")
return;
if(self.classname=="monster_mezzoman"&&!visible(activator)&&!self.monster_awake)
{
self.enemy=activator;
mezzo_choose_roll(activator);
return;
}
// delay reaction so if the monster is teleported, its sound is still
// heard
else
{
self.enemy = activator;
thinktime self : 0.1;
self.think = FoundTarget;
}
};
/*
================
monster_death_use
When a mosnter dies, it fires all of its targets with the current
enemy as activator.
================
*/
void() monster_death_use =
{
// fall to ground
self.flags(-)FL_FLY;
self.flags(-)FL_SWIM;
if (!self.target)
return;
activator = self.enemy;
SUB_UseTargets ();
};
//============================================================================
void() walkmonster_start_go =
{
if(!self.touch)
self.touch=obj_push;
if(!self.spawnflags&NO_DROP)
{
self.origin_z = self.origin_z + 1; // raise off floor a bit
droptofloor();
if (!walkmove(0,0, FALSE))
{
if(self.flags2&FL_SUMMONED)
remove(self);
else
{
dprint ("walkmonster in wall at: ");
dprint (vtos(self.origin));
dprint ("\n");
}
}
if(self.model=="model/spider.mdl"||self.model=="model/scorpion.mdl")
pitch_roll_for_slope('0 0 0');
}
if(!self.ideal_yaw)
{
// dprint("no preset ideal yaw\n");
self.ideal_yaw = self.angles * '0 1 0';
}
if (!self.yaw_speed)
self.yaw_speed = 20;
if(self.view_ofs=='0 0 0')
self.view_ofs = '0 0 25';
if(self.proj_ofs=='0 0 0')
self.proj_ofs = '0 0 25';
if(!self.use)
self.use = monster_use;
if(!self.flags&FL_MONSTER)
self.flags(+)FL_MONSTER;
if(self.flags&FL_MONSTER&&self.classname=="player_sheep")
self.flags(-)FL_MONSTER;
if (self.target)
{
self.goalentity = self.pathentity = find(world, targetname, self.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if (!self.pathentity)
{
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
/* if(self.spawnflags&PLAY_DEAD&&self.th_possum!=SUB_Null)
{
self.think=self.th_possum;
thinktime self : 0;
}
else
*/
if (self.pathentity.classname == "path_corner")
self.th_walk ();
else
{
self.pausetime = 99999999;
self.th_stand ();
}
}
else
{
/* if(self.spawnflags&PLAY_DEAD&&self.th_possum!=SUB_Null)
{
self.think=self.th_possum;
thinktime self : 0;
}
else
{
*/
self.pausetime = 99999999;
self.th_stand ();
// }
}
// spread think times so they don't all happen at same time
self.nextthink+=random(0.5);
};
void() walkmonster_start =
{
// delay drop to floor to make sure all doors have been spawned
// spread think times so they don't all happen at same time
self.takedamage=DAMAGE_YES;
self.flags2(+)FL_ALIVE;
if(self.scale<=0)
self.scale=1;
self.nextthink+=random(0.5);
self.think = walkmonster_start_go;
total_monsters = total_monsters + 1;
};
/*
void() flymonster_start_go =
{
self.takedamage = DAMAGE_YES;
self.ideal_yaw = self.angles * '0 1 0';
if (!self.yaw_speed)
self.yaw_speed = 10;
if(self.view_ofs=='0 0 0');
self.view_ofs = '0 0 24';
if(self.proj_ofs=='0 0 0');
self.proj_ofs = '0 0 24';
self.use = monster_use;
self.flags(+)FL_FLY;
self.flags(+)FL_MONSTER;
if(!self.touch)
self.touch=obj_push;
if (!walkmove(0,0, FALSE))
{
dprint ("flymonster in wall at: ");
dprint (vtos(self.origin));
dprint ("\n");
}
if (self.target)
{
self.goalentity = self.pathentity = find(world, targetname, self.target);
if (!self.pathentity)
{
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
// if(self.spawnflags&PLAY_DEAD&&self.th_possum!=SUB_Null)
// {
// self.think=self.th_possum;
// thinktime self : 0;
// }
// else
if (self.pathentity.classname == "path_corner")
self.th_walk ();
else
{
self.pausetime = 99999999;
self.th_stand ();
}
}
else
{
// if(self.spawnflags&PLAY_DEAD&&self.th_possum!=SUB_Null)
// {
// self.think=self.th_possum;
// thinktime self : 0;
// }
// else
// {
self.pausetime = 99999999;
self.th_stand ();
// }
}
};
void() flymonster_start =
{
// spread think times so they don't all happen at same time
self.takedamage=DAMAGE_YES;
self.flags2(+)FL_ALIVE;
self.nextthink+=random(0.5);
self.think = flymonster_start_go;
total_monsters = total_monsters + 1;
};
void() swimmonster_start_go =
{
if (deathmatch)
{
remove(self);
return;
}
if(!self.touch)
self.touch=obj_push;
self.takedamage = DAMAGE_YES;
total_monsters = total_monsters + 1;
self.ideal_yaw = self.angles * '0 1 0';
if (!self.yaw_speed)
self.yaw_speed = 10;
if(self.view_ofs=='0 0 0');
self.view_ofs = '0 0 10';
if(self.proj_ofs=='0 0 0');
self.proj_ofs = '0 0 10';
self.use = monster_use;
self.flags(+)FL_SWIM;
self.flags(+)FL_MONSTER;
if (self.target)
{
self.goalentity = self.pathentity = find(world, targetname, self.target);
if (!self.pathentity)
{
dprint ("Monster can't find target at ");
dprint (vtos(self.origin));
dprint ("\n");
}
// this used to be an objerror
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
self.th_walk ();
}
else
{
self.pausetime = 99999999;
self.th_stand ();
}
// spread think times so they don't all happen at same time
self.nextthink+=random(0.5);
};
void() swimmonster_start =
{
// spread think times so they don't all happen at same time
self.takedamage=DAMAGE_YES;
self.flags2(+)FL_ALIVE;
self.nextthink+=random(0.5);
self.think = swimmonster_start_go;
total_monsters = total_monsters + 1;
};
*/