X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fall.qh;h=45adf5e5906e3e0ac8988e5712ad9733a5ce1e88;hb=e500c4c3ae16913240d1bd0509e68510195f2872;hp=0c4f0af991091fae5d3b63c35689d968619e1f7a;hpb=dbf4ed6939f70e795228a1dc7eee5c37da3da8ee;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index 0c4f0af99..45adf5e59 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -1,12 +1,57 @@ -#include "monster/brute.qc" -#include "monster/animus.qc" -#include "monster/shambler.qc" -#include "monster/bruiser.qc" -#include "monster/wyvern.qc" -#include "monster/cerberus.qc" -#include "monster/slime.qc" -#include "monster/knight.qc" -#include "monster/stingray.qc" -#include "monster/mage.qc" -#include "monster/zombie.qc" -#include "monster/spider.qc" +#include "../registry.qh" + +#ifndef MONSTERS_ALL_H +#define MONSTERS_ALL_H + +void RegisterMonsters(); +const int MON_MAXCOUNT = 24; +entity monster_info[MON_MAXCOUNT], monster_info_first, monster_info_last; +entity get_monsterinfo(float id); +int MON_COUNT; +const int MON_FIRST = 1; +#define MON_LAST (MON_FIRST + MON_COUNT - 1) +/** If you register a new monster, make sure to add it to all.inc */ +#define REGISTER_MONSTER(id, class) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, monsterid, NEW(class)) +#include "monster.qh" +#define REGISTER_MONSTER_SIMPLE(id, monsterflags, min_s, max_s, modelname, shortname, mname) \ + REGISTER_MONSTER(id, Monster) { \ + this.netname = shortname; \ + this.monster_name = mname; \ + this.mdl = modelname; \ + this.spawnflags = monsterflags; \ + this.mins = min_s; \ + this.maxs = max_s; \ + this.model = strzone(strcat("models/monsters/", modelname)); \ + } \ + REGISTER_INIT(MON, id) +REGISTER_REGISTRY(RegisterMonsters) + +#include "../util.qh" + +// monster requests +const int MR_SETUP = 1; // (SERVER) setup monster data +const int MR_THINK = 2; // (SERVER) logic to run every frame +const int MR_DEATH = 3; // (SERVER) called when monster dies +const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster + +// special spawn flags +const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died +const int MONSTER_TYPE_FLY = 32; +const int MONSTER_TYPE_SWIM = 64; +const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced +const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster +const int MON_FLAG_RANGED = 512; // monster shoots projectiles +const int MON_FLAG_MELEE = 1024; + +// entity properties of monsterinfo: +.string netname; // short name +.string mdl; // currently a copy of the model +.string model; // full name of model +.int spawnflags; +.vector mins, maxs; // monster hitbox size + +// other useful macros +#define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest) +#define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name + +#endif