-#ifndef SHAMBLER_H
-#define SHAMBLER_H
-
-#ifndef MENUQC
-MODEL(MON_SHAMBLER, M_Model("shambler.mdl"));
-#endif
-
-CLASS(Shambler, Monster)
- ATTRIB(Shambler, spawnflags, int, MONSTER_SIZE_BROKEN | MON_FLAG_SUPERMONSTER | MON_FLAG_MELEE | MON_FLAG_RANGED);
- ATTRIB(Shambler, mins, vector, '-41 -41 -31');
- ATTRIB(Shambler, maxs, vector, '41 41 65');
-#ifndef MENUQC
- ATTRIB(Shambler, m_model, Model, MDL_MON_SHAMBLER);
-#endif
- ATTRIB(Shambler, netname, string, "shambler");
- ATTRIB(Shambler, monster_name, string, _("Shambler"));
-ENDCLASS(Shambler)
-
-REGISTER_MONSTER(SHAMBLER, NEW(Shambler)) {
-#ifndef MENUQC
- this.mr_precache(this);
-#endif
-}
-
-#endif
+#include "shambler.qh"
#ifdef IMPLEMENTATION
#include <common/effects/qc/all.qh>
-void M_Shambler_Attack_Lightning_Explode()
-{SELFPARAM();
- entity head;
-
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
- Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1);
+void M_Shambler_Attack_Lightning_Explode(entity this, entity directhitentity)
+{
+ sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
- self.event_damage = func_null;
- self.takedamage = DAMAGE_NO;
- self.movetype = MOVETYPE_NONE;
- self.velocity = '0 0 0';
+ this.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
+ set_movetype(this, MOVETYPE_NONE);
+ this.velocity = '0 0 0';
- if(self.movetype == MOVETYPE_NONE)
- self.velocity = self.oldvelocity;
+ if(this.move_movetype == MOVETYPE_NONE)
+ this.velocity = this.oldvelocity;
- RadiusDamage (self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), world, world, (autocvar_g_monster_shambler_attack_lightning_force), self.projectiledeathtype, other);
+ RadiusDamage (this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius),
+ NULL, NULL, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, directhitentity);
- for(head = findradius(self.origin, (autocvar_g_monster_shambler_attack_lightning_radius_zap)); head; head = head.chain) if(head != self.realowner) if(head.takedamage)
+ FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_shambler_attack_lightning_radius_zap, it != this.realowner && it.takedamage,
{
- te_csqc_lightningarc(self.origin, head.origin);
- Damage(head, self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
- }
+ te_csqc_lightningarc(this.origin, it.origin);
+ Damage(it, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, it.origin, '0 0 0');
+ });
+
+ setthink(this, SUB_Remove);
+ this.nextthink = time + 0.2;
+}
- self.think = SUB_Remove_self;
- self.nextthink = time + 0.2;
+void M_Shambler_Attack_Lightning_Explode_use(entity this, entity actor, entity trigger)
+{
+ M_Shambler_Attack_Lightning_Explode(this, trigger);
}
void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
}
-void M_Shambler_Attack_Lightning_Touch()
-{SELFPARAM();
- PROJECTILE_TOUCH;
+void M_Shambler_Attack_Lightning_Touch(entity this, entity toucher)
+{
+ PROJECTILE_TOUCH(this, toucher);
- self.use ();
+ this.use(this, NULL, toucher);
}
-void M_Shambler_Attack_Lightning_Think()
-{SELFPARAM();
- self.nextthink = time;
- if (time > self.cnt)
+void M_Shambler_Attack_Lightning_Think(entity this)
+{
+ this.nextthink = time;
+ if (time > this.cnt)
{
- other = world;
- M_Shambler_Attack_Lightning_Explode();
+ M_Shambler_Attack_Lightning_Explode(this, NULL);
return;
}
}
gren.owner = gren.realowner = this;
gren.bot_dodge = true;
gren.bot_dodgerating = (autocvar_g_monster_shambler_attack_lightning_damage);
- gren.movetype = MOVETYPE_BOUNCE;
+ set_movetype(gren, MOVETYPE_BOUNCE);
PROJECTILE_MAKETRIGGER(gren);
gren.projectiledeathtype = DEATH_MONSTER_SHAMBLER_ZAP.m_id;
setorigin(gren, CENTER_OR_VIEWOFS(this));
gren.cnt = time + 5;
gren.nextthink = time;
- gren.think = M_Shambler_Attack_Lightning_Think;
- gren.use = M_Shambler_Attack_Lightning_Explode;
- gren.touch = M_Shambler_Attack_Lightning_Touch;
+ setthink(gren, M_Shambler_Attack_Lightning_Think);
+ gren.use = M_Shambler_Attack_Lightning_Explode_use;
+ settouch(gren, M_Shambler_Attack_Lightning_Touch);
gren.takedamage = DAMAGE_YES;
gren.health = 50;
gren.angles = vectoangles (gren.velocity);
gren.flags = FL_PROJECTILE;
+ IL_PUSH(g_projectiles, gren);
CSQCProjectile(gren, true, PROJECTILE_SHAMBLER_LIGHTNING, true);
}
spawnfunc(monster_shambler) { Monster_Spawn(this, MON_SHAMBLER.monsterid); }
#endif // SVQC
- #ifdef SVQC
- METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
- {
- return true;
- }
- METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
- {
- actor.pain_finished = time + 0.5;
- setanim(actor, actor.anim_pain1, true, true, false);
- return true;
- }
- METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
- {
- setanim(actor, actor.anim_die1, false, true, true);
- return true;
- }
- #endif
- #ifndef MENUQC
- METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
- {
- vector none = '0 0 0';
- actor.anim_die1 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
- actor.anim_walk = animfixfps(actor, '1 1 1', none);
- actor.anim_idle = animfixfps(actor, '0 1 1', none);
- actor.anim_pain1 = animfixfps(actor, '7 1 2', none); // 0.5 seconds
- actor.anim_melee1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
- actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
- actor.anim_melee3 = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
- actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
- actor.anim_run = animfixfps(actor, '2 1 1', none);
- return true;
- }
- #endif
- #ifdef SVQC
- spawnfunc(item_health_mega);
- .float animstate_endtime;
- METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
- {
- if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
- if(!actor.attack_range) actor.attack_range = 150;
- if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
- if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
- if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_shambler_speed_stop); }
- if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_shambler_damageforcescale); }
+#ifdef SVQC
+METHOD(Shambler, mr_think, bool(Shambler this, entity actor))
+{
+ TC(Shambler, this);
+ return true;
+}
- actor.monster_loot = spawnfunc_item_health_mega;
- actor.weapon = WEP_ELECTRO.m_id; // matches attacks better than WEP_VORTEX
+METHOD(Shambler, mr_pain, float(Shambler this, entity actor, float damage_take, entity attacker, float deathtype))
+{
+ TC(Shambler, this);
+ actor.pain_finished = time + 0.5;
+ setanim(actor, actor.anim_pain1, true, true, false);
+ return damage_take;
+}
- setanim(actor, actor.anim_shoot, false, true, true);
- actor.spawn_time = actor.animstate_endtime;
- actor.spawnshieldtime = actor.spawn_time;
- actor.monster_attackfunc = M_Shambler_Attack;
+METHOD(Shambler, mr_death, bool(Shambler this, entity actor))
+{
+ TC(Shambler, this);
+ setanim(actor, actor.anim_die1, false, true, true);
+ return true;
+}
+#endif
+#ifdef GAMEQC
+METHOD(Shambler, mr_anim, bool(Shambler this, entity actor))
+{
+ TC(Shambler, this);
+ vector none = '0 0 0';
+ actor.anim_die1 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
+ actor.anim_walk = animfixfps(actor, '1 1 1', none);
+ actor.anim_idle = animfixfps(actor, '0 1 1', none);
+ actor.anim_pain1 = animfixfps(actor, '7 1 2', none); // 0.5 seconds
+ actor.anim_melee1 = animfixfps(actor, '3 1 5', none); // analyze models and set framerate
+ actor.anim_melee2 = animfixfps(actor, '4 1 5', none); // analyze models and set framerate
+ actor.anim_melee3 = animfixfps(actor, '5 1 5', none); // analyze models and set framerate
+ actor.anim_shoot = animfixfps(actor, '6 1 5', none); // analyze models and set framerate
+ actor.anim_run = animfixfps(actor, '2 1 1', none);
+ return true;
+}
+#endif
+#ifdef SVQC
+spawnfunc(item_health_mega);
+.float animstate_endtime;
+METHOD(Shambler, mr_setup, bool(Shambler this, entity actor))
+{
+ TC(Shambler, this);
+ if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
+ if(!actor.attack_range) actor.attack_range = 150;
+ if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
+ if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
+ if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_shambler_speed_stop); }
+ if(!actor.damageforcescale) { actor.damageforcescale = (autocvar_g_monster_shambler_damageforcescale); }
+
+ actor.monster_loot = spawnfunc_item_health_mega;
+ actor.weapon = WEP_ELECTRO.m_id; // matches attacks better than WEP_VORTEX
+
+ setanim(actor, actor.anim_shoot, false, true, true);
+ actor.spawn_time = actor.animstate_endtime;
+ actor.spawnshieldtime = actor.spawn_time;
+ actor.monster_attackfunc = M_Shambler_Attack;
+
+ return true;
+}
- return true;
- }
- METHOD(Shambler, mr_precache, bool(Shambler thismon))
- {
- return true;
- }
- #endif
+METHOD(Shambler, mr_precache, bool(Shambler this))
+{
+ TC(Shambler, this);
+ return true;
+}
+#endif
#endif