min_s = mon.mins;
max_s = mon.maxs;
- if(mon.spawnflags & MONSTER_SIZE_BROKEN)
- self.scale = 1.3;
-
self.netname = M_NAME(self.monsterid);
setorigin(self, self.origin);
self.skin = ReadByte();
self.team = ReadByte();
+ self.scale = ReadByte();
monster_construct();
monster_changeteam();
WriteByte(MSG_ENTITY, self.skin);
WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, self.scale);
}
if(sf & MSF_ANG)
self.SendFlags = MSF_SETUP;
}
-float monster_initialize(float mon_id, float nodrop)
+float monster_initialize(float mon_id, float nodrop, float sflags)
{
if not(autocvar_g_monsters)
return FALSE;
self.gravity = 1;
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
- if(mon.spawnflags & MONSTER_TYPE_SWIM)
+ if(sflags & MONSTER_TYPE_SWIM)
self.flags |= FL_SWIM;
- if(mon.spawnflags & MONSTER_TYPE_FLY)
+ if(sflags & MONSTER_TYPE_FLY)
{
self.flags |= FL_FLY;
self.movetype = MOVETYPE_FLY;
if not(self.scale)
self.scale = 1;
+
+ if(sflags & MONSTER_SIZE_BROKEN)
+ self.scale = 1.3;
if not(self.attack_range)
self.attack_range = 120;
void monsters_setstatus(); // monsters.qc
.float monster_moveflags; // checks where to move when not attacking
+// special spawn flags
+const float MONSTER_RESPAWN_DEATHPOINT = 128; // re-spawn where we died
+const float MONSTER_TYPE_FLY = 256;
+const float MONSTER_TYPE_SWIM = 512;
+const float MONSTER_SIZE_BROKEN = 1024; // TODO: remove when bad models are replaced
+
#endif // SVQC
#ifndef MENUQC
REGISTER_MONSTER(
/* MON_##id */ ANIMUS,
/* function */ m_animus,
-/* spawnflags */ MONSTER_SIZE_BROKEN,
/* mins,maxs */ '-41 -41 -31', '41 41 31',
/* model */ "demon.mdl",
/* netname */ "animus",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_ANIMUS, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_ANIMUS, FALSE, MONSTER_SIZE_BROKEN)) { remove(self); return; }
}
// compatibility with old spawns
REGISTER_MONSTER(
/* MON_##id */ BRUISER,
/* function */ m_bruiser,
-/* spawnflags */ MONSTER_SIZE_BROKEN,
/* mins,maxs */ '-20 -20 -31', '20 20 53',
/* model */ "knight.mdl",
/* netname */ "bruiser",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_BRUISER, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_BRUISER, FALSE, MONSTER_SIZE_BROKEN)) { remove(self); return; }
}
float m_bruiser(float req)
REGISTER_MONSTER(
/* MON_##id */ BRUTE,
/* function */ m_brute,
-/* spawnflags */ 0,
/* mins,maxs */ '-36 -36 -20', '36 36 50',
/* model */ "ogre.dpm",
/* netname */ "brute",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_BRUTE, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_BRUTE, FALSE, 0)) { remove(self); return; }
}
float m_brute(float req)
REGISTER_MONSTER(
/* MON_##id */ CERBERUS,
/* function */ m_cerberus,
-/* spawnflags */ 0,
/* mins,maxs */ '-16 -16 -24', '16 16 12',
/* model */ "dog.dpm",
/* netname */ "cerberus",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_CERBERUS, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_CERBERUS, FALSE, 0)) { remove(self); return; }
}
// compatibility with old spawns
REGISTER_MONSTER(
/* MON_##id */ KNIGHT,
/* function */ m_knight,
-/* spawnflags */ MONSTER_SIZE_BROKEN,
/* mins,maxs */ '-20 -20 -32', '20 20 41',
/* model */ "hknight.mdl",
/* netname */ "knight",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_KNIGHT, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_KNIGHT, FALSE, MONSTER_SIZE_BROKEN)) { remove(self); return; }
}
// compatibility with old spawns
REGISTER_MONSTER(
/* MON_##id */ MAGE,
/* function */ m_mage,
-/* spawnflags */ 0,
/* mins,maxs */ '-36 -36 -24', '36 36 50',
/* model */ "mage.dpm",
/* netname */ "mage",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_MAGE, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_MAGE, FALSE, 0)) { remove(self); return; }
}
// compatibility with old spawns
REGISTER_MONSTER(
/* MON_##id */ SHAMBLER,
/* function */ m_shambler,
-/* spawnflags */ MONSTER_SIZE_BROKEN,
/* mins,maxs */ '-41 -41 -31', '41 41 65',
/* model */ "shambler.mdl",
/* netname */ "shambler",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_SHAMBLER, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_SHAMBLER, FALSE, MONSTER_SIZE_BROKEN)) { remove(self); return; }
}
float m_shambler(float req)
REGISTER_MONSTER(
/* MON_##id */ SLIME,
/* function */ m_slime,
-/* spawnflags */ 0,
/* mins,maxs */ '-16 -16 -24', '16 16 16',
/* model */ "slime.dpm",
/* netname */ "slime",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_SLIME, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_SLIME, FALSE, 0)) { remove(self); return; }
}
// compatibility with old spawns
REGISTER_MONSTER(
/* MON_##id */ SPIDER,
/* function */ m_spider,
-/* spawnflags */ 0,
/* mins,maxs */ '-18 -18 -25', '18 18 30',
/* model */ "spider.dpm",
/* netname */ "spider",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_SPIDER, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_SPIDER, FALSE, 0)) { remove(self); return; }
}
float m_spider(float req)
{
monsters_setframe(spider_anim_attack);
self.angles += '180 0 0';
+ self.SendFlags |= MSF_ANG;
return TRUE;
}
case MR_SETUP:
{
case MR_DEATH:
{
- self.angles += '180 0 0'; // TODO: use the server side angles instead?
+ // nothing
return TRUE;
}
case MR_INIT:
REGISTER_MONSTER(
/* MON_##id */ STINGRAY,
/* function */ m_stingray,
-/* spawnflags */ MONSTER_TYPE_SWIM | MONSTER_SIZE_BROKEN,
/* mins,maxs */ '-20 -20 -31', '20 20 20',
/* model */ "fish.mdl",
/* netname */ "stingray",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_STINGRAY, TRUE)) { remove(self); return; }
+ if not(monster_initialize(MON_STINGRAY, TRUE, MONSTER_TYPE_SWIM | MONSTER_SIZE_BROKEN)) { remove(self); return; }
}
float m_stingray(float req)
}
case MR_DEATH:
{
- monsters_setframe(stingray_anim_swim);
+ monsters_setframe(stingray_anim_death);
return TRUE;
}
case MR_SETUP:
if not(self.health) self.health = autocvar_g_monster_stingray_health;
self.monster_attackfunc = stingray_attack;
- monsters_setframe(stingray_anim_death);
+ monsters_setframe(stingray_anim_swim);
return TRUE;
}
REGISTER_MONSTER(
/* MON_##id */ WYVERN,
/* function */ m_wyvern,
-/* spawnflags */ MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN,
/* mins,maxs */ '-20 -20 -58', '20 20 20',
/* model */ "wizard.mdl",
/* netname */ "wyvern",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_WYVERN, TRUE)) { remove(self); return; }
+ if not(monster_initialize(MON_WYVERN, TRUE, MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN)) { remove(self); return; }
}
// compatibility with old spawns
}
case MR_INIT:
{
- precache_model ("models/monsters/knight.mdl");
+ precache_model ("models/monsters/wizard.mdl");
return TRUE;
}
}
REGISTER_MONSTER(
/* MON_##id */ ZOMBIE,
/* function */ m_zombie,
-/* spawnflags */ MONSTER_RESPAWN_DEATHPOINT,
/* mins,maxs */ '-18 -18 -25', '18 18 47',
/* model */ "zombie.dpm",
/* netname */ "zombie",
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_ZOMBIE, FALSE)) { remove(self); return; }
+ if not(monster_initialize(MON_ZOMBIE, FALSE, MONSTER_RESPAWN_DEATHPOINT)) { remove(self); return; }
}
float m_zombie(float req)
entity monster_info[MON_MAXCOUNT];
entity dummy_monster_info;
-void register_monster(float id, float(float) func, float monstertype, vector min_s, vector max_s, string modelname, string shortname, string mname)
+void register_monster(float id, float(float) func, vector min_s, vector max_s, string modelname, string shortname, string mname)
{
entity e;
monster_info[id - 1] = e = spawn();
e.mins = min_s;
e.maxs = max_s;
e.model = strzone(strcat("models/monsters/", modelname));
- e.spawnflags = monstertype;
func(MR_INIT);
}
dummy_monster_info.mins = '-0 -0 -0';
dummy_monster_info.maxs = '0 0 0';
dummy_monster_info.model = "";
- dummy_monster_info.spawnflags = 0;
}
entity get_monsterinfo(float id)
{
// =====================
float m_null(float dummy);
-void register_monster(float id, float(float) func, float monstertype, vector min_s, vector max_s, string modelname, string shortname, string mname);
+void register_monster(float id, float(float) func, vector min_s, vector max_s, string modelname, string shortname, string mname);
void register_monsters_done();
-// special spawn flags
-const float MONSTER_RESPAWN_DEATHPOINT = 699; // re-spawn where we died
-const float MONSTER_TYPE_FLY = 700;
-const float MONSTER_TYPE_SWIM = 701;
-const float MONSTER_SIZE_BROKEN = 702; // TODO: remove when bad models are replaced
-
const float MON_MAXCOUNT = 24;
#define MON_FIRST 1
float MON_COUNT;
float MON_LAST;
-#define REGISTER_MONSTER_2(id,func,monstertype,min_s,max_s,modelname,shortname,mname) \
+#define REGISTER_MONSTER_2(id,func,min_s,max_s,modelname,shortname,mname) \
float id; \
float func(float); \
void RegisterMonsters_##id() \
{ \
MON_LAST = (id = MON_FIRST + MON_COUNT); \
++MON_COUNT; \
- register_monster(id,func,monstertype,min_s,max_s,modelname,shortname,mname); \
+ register_monster(id,func,min_s,max_s,modelname,shortname,mname); \
} \
ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id)
-#define REGISTER_MONSTER(id,func,monstertype,min_s,max_s,modelname,shortname,mname) \
- REGISTER_MONSTER_2(MON_##id,func,monstertype,min_s,max_s,modelname,shortname,mname)
+#define REGISTER_MONSTER(id,func,min_s,max_s,modelname,shortname,mname) \
+ REGISTER_MONSTER_2(MON_##id,func,min_s,max_s,modelname,shortname,mname)
#define MON_DUPECHECK(dupecheck,cvar) \
#ifndef dupecheck \