X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fall.qh;h=ce02312f1d4a414a11014c618b32cf5816df0320;hb=cf4d36d9d295ce940e9e9bdf7a711e4036de0b3c;hp=fec3f630dad395a4f522be1188709c1aba8daf9b;hpb=ef5d72bcd06c2c1380e63fe900aafbca20153d02;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index fec3f630da..ce02312f1d 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -1,11 +1,73 @@ -// TODO: include once -//#ifndef MONSTERS_ALL_H -//#define MONSTERS_ALL_H +#ifndef MONSTERS_ALL_H +#define MONSTERS_ALL_H -#include "monster/zombie.qc" -#include "monster/spider.qc" -#include "monster/mage.qc" -#include "monster/wyvern.qc" -#include "monster/shambler.qc" +#include "../util.qh" -//#endif \ No newline at end of file +// 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 + +// functions: +entity get_monsterinfo(float id); + +// 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: +.float monsterid; // MON_... +.string netname; // short name +.string monster_name; // human readable name +.float(float) monster_func; // m_... +.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 + +// ===================== +// Monster Registration +// ===================== + +float m_null(float dummy); +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 int MON_MAXCOUNT = 24; +const int MON_FIRST = 1; +int MON_COUNT; +int MON_LAST; + +#define REGISTER_MONSTER_2(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \ + int id; \ + float func(float); \ + void RegisterMonsters_##id() \ + { \ + MON_LAST = (id = MON_FIRST + MON_COUNT); \ + ++MON_COUNT; \ + register_monster(id,func,monsterflags,min_s,max_s,modelname,shortname,mname); \ + } \ + ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id) +#ifdef MENUQC +#define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \ + REGISTER_MONSTER_2(MON_##id,m_null,monsterflags,min_s,max_s,modelname,shortname,mname) +#else +#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) +#endif + +#include "all.inc" + +#undef REGISTER_MONSTER +ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done); +#endif