X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fall.qh;h=c9e5ad37ba6448ed85374378affde2e871a6197c;hb=2bddfb42fdbb3318aa319d228d8c99adcc90b128;hp=ea1eb5158658c00ec967fa412af45016c9e98e21;hpb=035a588f9494a734e8eb948d4da5dfba9d5c664c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/all.qh b/qcsrc/common/monsters/all.qh index ea1eb5158..c9e5ad37b 100644 --- a/qcsrc/common/monsters/all.qh +++ b/qcsrc/common/monsters/all.qh @@ -1,60 +1,16 @@ -#ifndef MONSTERS_ALL_H -#define MONSTERS_ALL_H +#pragma once -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" +string M_Model(string m_mdl); -// 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; -const int MON_FLAG_CRUSH = 2048; // monster can be stomped in special modes -const int MON_FLAG_RIDE = 4096; // monster can be ridden in special modes - -// 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 -.bool(int) monster_attackfunc; +REGISTRY(Monsters, BITS(5)) +#define Monsters_from(i) _Monsters_from(i, MON_Null) +#define get_monsterinfo(i) Monsters_from(i) +REGISTER_REGISTRY(Monsters) +REGISTRY_CHECK(Monsters) +const int MON_FIRST = 1; +#define MON_LAST (Monsters_COUNT - 1) +#define REGISTER_MONSTER(id, inst) REGISTER(Monsters, MON, id, monsterid, inst) -// animations -.vector anim_blockend; -.vector anim_blockstart; -.vector anim_melee1; -.vector anim_melee2; -.vector anim_melee3; -.vector anim_pain3; -.vector anim_pain4; -.vector anim_pain5; -.vector anim_walk; -.vector anim_spawn; +#include "monster.qh" -#endif +REGISTER_MONSTER(Null, NEW(Monster));