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 sflags)
+float monster_initialize(float mon_id, float nodrop)
{
if not(autocvar_g_monsters)
return FALSE;
self.gravity = 1;
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
- if(sflags & MONSTER_TYPE_SWIM)
+ if(mon.spawnflags & MONSTER_TYPE_SWIM)
self.flags |= FL_SWIM;
- if(sflags & MONSTER_TYPE_FLY)
+ if(mon.spawnflags & MONSTER_TYPE_FLY)
{
self.flags |= FL_FLY;
self.movetype = MOVETYPE_FLY;
if not(self.scale)
self.scale = 1;
- if(sflags & MONSTER_SIZE_BROKEN)
+ if(mon.spawnflags & MONSTER_SIZE_BROKEN)
self.scale = 1.3;
if not(self.attack_range)
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, MONSTER_SIZE_BROKEN)) { remove(self); return; }
+ if not(monster_initialize(MON_ANIMUS, FALSE)) { 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, MONSTER_SIZE_BROKEN)) { remove(self); return; }
+ if not(monster_initialize(MON_BRUISER, FALSE)) { 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, 0)) { remove(self); return; }
+ if not(monster_initialize(MON_BRUTE, FALSE)) { 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, 0)) { remove(self); return; }
+ if not(monster_initialize(MON_CERBERUS, FALSE)) { 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, MONSTER_SIZE_BROKEN)) { remove(self); return; }
+ if not(monster_initialize(MON_KNIGHT, FALSE)) { 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, 0)) { remove(self); return; }
+ if not(monster_initialize(MON_MAGE, FALSE)) { 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, MONSTER_SIZE_BROKEN)) { remove(self); return; }
+ if not(monster_initialize(MON_SHAMBLER, FALSE)) { 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, 0)) { remove(self); return; }
+ if not(monster_initialize(MON_SLIME, FALSE)) { 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, 0)) { remove(self); return; }
+ if not(monster_initialize(MON_SPIDER, FALSE)) { remove(self); return; }
}
float m_spider(float req)
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, MONSTER_TYPE_SWIM | MONSTER_SIZE_BROKEN)) { remove(self); return; }
+ if not(monster_initialize(MON_STINGRAY, TRUE)) { remove(self); return; }
}
float m_stingray(float req)
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, MONSTER_TYPE_FLY | MONSTER_SIZE_BROKEN)) { remove(self); return; }
+ if not(monster_initialize(MON_WYVERN, TRUE)) { remove(self); return; }
}
// compatibility with old spawns
REGISTER_MONSTER(
/* MON_##id */ ZOMBIE,
/* function */ m_zombie,
+/* spawnflags */ 0,
/* mins,maxs */ '-18 -18 -25', '18 18 47',
/* model */ "zombie.dpm",
/* netname */ "zombie",
self.monster_spawnfunc = spawnfunc_monster_zombie;
+ self.spawnflags |= MONSTER_RESPAWN_DEATHPOINT;
+
if(Monster_CheckAppearFlags(self))
return;
- if not(monster_initialize(MON_ZOMBIE, FALSE, MONSTER_RESPAWN_DEATHPOINT)) { remove(self); return; }
+ if not(monster_initialize(MON_ZOMBIE, FALSE)) { 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, vector min_s, vector max_s, string modelname, string shortname, string mname)
+void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname)
{
entity e;
monster_info[id - 1] = e = spawn();
e.monster_name = mname;
e.monster_func = func;
e.mdl = modelname;
+ e.spawnflags = monsterflags;
e.mins = min_s;
e.maxs = max_s;
e.model = strzone(strcat("models/monsters/", modelname));
// functions:
entity get_monsterinfo(float id);
+// 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
+
// entity properties of monsterinfo:
.float monsterid; // MON_...
.string netname; // short name
// =====================
float m_null(float dummy);
-void register_monster(float id, float(float) func, vector min_s, vector max_s, string modelname, string shortname, string mname);
+void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname);
void register_monsters_done();
const float MON_MAXCOUNT = 24;
float MON_COUNT;
float MON_LAST;
-#define REGISTER_MONSTER_2(id,func,min_s,max_s,modelname,shortname,mname) \
+#define REGISTER_MONSTER_2(id,func,monsterflags,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,min_s,max_s,modelname,shortname,mname); \
+ register_monster(id,func,monsterflags,min_s,max_s,modelname,shortname,mname); \
} \
ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id)
-#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 REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
+ REGISTER_MONSTER_2(MON_##id,func,monsterflags,min_s,max_s,modelname,shortname,mname)
#define MON_DUPECHECK(dupecheck,cvar) \
#ifndef dupecheck \
return MON_ZOMBIE;
float i;
+ entity mon;
RandomSelection_Init();
for(i = MON_FIRST; i <= MON_LAST; ++i)
{
- if(i == MON_STINGRAY || i == MON_WYVERN || (i == MON_SHAMBLER && have_shamblers >= 1))
+ mon = get_monsterinfo(i);
+ if((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM) || (i == MON_SHAMBLER && have_shamblers >= 1))
continue; // flying/swimming monsters not yet supported
RandomSelection_Add(world, i, "", 1, 1);