X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fzombie.qc;h=0e06e4ae8ee1ca6ceb3fae5d1f1276a0704a22d1;hb=45419c41b4da92340152d6fffe1fa429769b6d6a;hp=1ccfa82c816879865e75faf2eeb1c8d0148bae88;hpb=b557753cb5b1d9c92ef9ab17cb03d74bcbb75485;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 1ccfa82c8..0e06e4ae8 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -1,20 +1,31 @@ +#ifndef ZOMBIE_H +#define ZOMBIE_H + #ifndef MENUQC -bool M_Zombie(int); +MODEL(MON_ZOMBIE, "models/monsters/zombie.dpm"); #endif -REGISTER_MONSTER_SIMPLE( -/* MON_##id */ ZOMBIE, -/* spawnflags */ MON_FLAG_MELEE, -/* mins,maxs */ '-18 -18 -25', '18 18 47', -/* model */ "zombie.dpm", -/* netname */ "zombie", -/* fullname */ _("Zombie") -) { + +CLASS(Zombie, Monster) + ATTRIB(Zombie, spawnflags, int, MON_FLAG_MELEE | MON_FLAG_RIDE); + ATTRIB(Zombie, mins, vector, '-18 -18 -25'); + ATTRIB(Zombie, maxs, vector, '18 18 47'); #ifndef MENUQC - this.monster_func = M_Zombie; - this.monster_func(MR_PRECACHE); + ATTRIB(Zombie, m_model, Model, MDL_MON_ZOMBIE); +#endif + ATTRIB(Zombie, netname, string, "zombie"); + ATTRIB(Zombie, monster_name, string, _("Zombie")); +ENDCLASS(Zombie) + +REGISTER_MONSTER(ZOMBIE, NEW(Zombie)) { +#ifndef MENUQC + MON_ACTION(this, MR_PRECACHE); #endif } +#endif + +#ifdef IMPLEMENTATION + #ifdef SVQC float autocvar_g_monster_zombie_health; float autocvar_g_monster_zombie_damageforcescale = 0.55; @@ -63,7 +74,7 @@ const float zombie_anim_spawn = 30; */ void M_Zombie_Attack_Leap_Touch() -{ +{SELFPARAM(); if (self.health <= 0) return; @@ -86,7 +97,7 @@ void M_Zombie_Attack_Leap_Touch() } void M_Zombie_Defend_Block_End() -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -95,7 +106,7 @@ void M_Zombie_Defend_Block_End() } float M_Zombie_Defend_Block() -{ +{SELFPARAM(); self.armorvalue = 0.9; self.state = MONSTER_ATTACK_MELEE; // freeze monster self.attack_finished_single = time + 2.1; @@ -107,8 +118,8 @@ float M_Zombie_Defend_Block() return true; } -float M_Zombie_Attack(float attack_type) -{ +float M_Zombie_Attack(float attack_type, entity targ) +{SELFPARAM(); switch(attack_type) { case MONSTER_ATTACK_MELEE: @@ -141,25 +152,24 @@ float M_Zombie_Attack(float attack_type) void spawnfunc_monster_zombie() { Monster_Spawn(MON_ZOMBIE.monsterid); } #endif // SVQC -bool M_Zombie(int req) -{ - switch(req) - { #ifdef SVQC - case MR_THINK: + METHOD(Zombie, mr_think, bool(Zombie thismon)) { + SELFPARAM(); if(time >= self.spawn_time) self.damageforcescale = autocvar_g_monster_zombie_damageforcescale; return true; } - case MR_PAIN: + METHOD(Zombie, mr_pain, bool(Zombie thismon)) { + SELFPARAM(); self.pain_finished = time + 0.34; setanim(self, ((random() > 0.5) ? self.anim_pain1 : self.anim_pain2), true, true, false); return true; } - case MR_DEATH: + METHOD(Zombie, mr_death, bool(Zombie thismon)) { + SELFPARAM(); self.armorvalue = autocvar_g_monsters_armor_blockpercent; setanim(self, ((random() > 0.5) ? self.anim_die1 : self.anim_die2), false, true, true); @@ -167,8 +177,9 @@ bool M_Zombie(int req) } #endif #ifndef MENUQC - case MR_ANIM: + METHOD(Zombie, mr_anim, bool(Zombie thismon)) { + SELFPARAM(); vector none = '0 0 0'; self.anim_die1 = animfixfps(self, '9 1 0.5', none); // 2 seconds self.anim_die2 = animfixfps(self, '12 1 0.5', none); // 2 seconds @@ -189,7 +200,7 @@ bool M_Zombie(int req) } #endif #ifdef SVQC - case MR_SETUP: + METHOD(Zombie, mr_setup, bool(Zombie thismon)) { if(!self.health) self.health = (autocvar_g_monster_zombie_health); if(!self.speed) { self.speed = (autocvar_g_monster_zombie_speed_walk); } @@ -212,13 +223,10 @@ bool M_Zombie(int req) return true; } - case MR_PRECACHE: + METHOD(Zombie, mr_precache, bool(Zombie thismon)) { - precache_model("models/monsters/zombie.dpm"); return true; } #endif - } - return true; -} +#endif