X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fspider.qc;h=0f46a9620e6683c5d6b8e6a1bcebd94a268d9f33;hb=ae2c1407ec9a05e4f501a6604a7cce8e1030df9f;hp=ea4a6d6b786f5b1f70abb3b1ed82456fb9bf5dcb;hpb=079fd1f068d026f4cba8bcaa4d5827dfeb7aca61;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index ea4a6d6b7..65ba8dad5 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -1,76 +1,49 @@ -#ifdef REGISTER_MONSTER -REGISTER_MONSTER( +#ifndef MENUQC +bool m_spider(int); +#endif +REGISTER_MONSTER_SIMPLE( /* MON_##id */ SPIDER, -/* function */ m_spider, /* spawnflags */ MON_FLAG_MELEE | MON_FLAG_RANGED, /* mins,maxs */ '-18 -18 -25', '18 18 30', /* model */ "spider.dpm", /* netname */ "spider", /* fullname */ _("Spider") -); - -#define SPIDER_SETTINGS(monster) \ - MON_ADD_CVAR(monster, health) \ - MON_ADD_CVAR(monster, attack_bite_damage) \ - MON_ADD_CVAR(monster, attack_bite_delay) \ - MON_ADD_CVAR(monster, attack_web_damagetime) \ - MON_ADD_CVAR(monster, attack_web_speed) \ - MON_ADD_CVAR(monster, attack_web_speed_up) \ - MON_ADD_CVAR(monster, attack_web_delay) \ - MON_ADD_CVAR(monster, attack_type) \ - MON_ADD_CVAR(monster, speed_stop) \ - MON_ADD_CVAR(monster, speed_run) \ - MON_ADD_CVAR(monster, speed_walk) +) { +#ifndef MENUQC + this.monster_func = m_spider; +#endif +} #ifdef SVQC -SPIDER_SETTINGS(spider) -#endif // SVQC -#else -#ifdef SVQC +float autocvar_g_monster_spider_health; +float autocvar_g_monster_spider_attack_bite_damage; +float autocvar_g_monster_spider_attack_bite_delay; +float autocvar_g_monster_spider_attack_web_damagetime; +float autocvar_g_monster_spider_attack_web_speed; +float autocvar_g_monster_spider_attack_web_speed_up; +float autocvar_g_monster_spider_attack_web_delay; +float autocvar_g_monster_spider_speed_stop; +float autocvar_g_monster_spider_speed_run; +float autocvar_g_monster_spider_speed_walk; + const float spider_anim_idle = 0; const float spider_anim_walk = 1; const float spider_anim_attack = 2; const float spider_anim_attack2 = 3; -.float spider_type; // used to switch between fire & ice attacks -const float SPIDER_TYPE_ICE = 0; -const float SPIDER_TYPE_FIRE = 1; +.float spider_web_delay; void spider_web_explode() { entity e; if(self) { - float damg = 0, edamg = 0, rad = 1; - switch(self.realowner.spider_type) - { - case SPIDER_TYPE_ICE: - rad = 25; - pointparticles(particleeffectnum("electro_impact"), self.origin, '0 0 0', 1); - break; - case SPIDER_TYPE_FIRE: - pointparticles(particleeffectnum("fireball_explode"), self.origin, '0 0 0', 1); - damg = 15; - rad = 25; - edamg = 6; - break; - } - - RadiusDamage(self, self.realowner, damg, edamg, rad, world, rad, DEATH_MONSTER_SPIDER_FIRE, world); // ice deals no damage anyway - - for(e = findradius(self.origin, rad); e; e = e.chain) if(e != self) if(e.takedamage && e.deadflag == DEAD_NO) if(e.health > 0) - { - switch(self.realowner.spider_type) - { - case SPIDER_TYPE_ICE: - Freeze(e, 0.3, 2, FALSE); - break; - case SPIDER_TYPE_FIRE: - Fire_AddDamage(e, self.realowner, 5 * monster_skill, MON_CVAR(spider, attack_web_damagetime), DEATH_MONSTER_SPIDER_FIRE); - break; - } - } - + Send_Effect("electro_impact", self.origin, '0 0 0', 1); + RadiusDamage(self, self.realowner, 0, 0, 25, world, world, 25, self.projectiledeathtype, world); + + for(e = findradius(self.origin, 25); e; e = e.chain) if(e != self) if(e.takedamage && e.deadflag == DEAD_NO) if(e.health > 0) if(e.monsterid != MON_SPIDER.monsterid) + e.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); + remove(self); } } @@ -78,46 +51,32 @@ void spider_web_explode() void spider_web_touch() { PROJECTILE_TOUCH; - + spider_web_explode(); } -void spider_shootweb(float ptype) +void spider_shootweb() { - float p = 0; - string snd = ""; - switch(ptype) - { - case SPIDER_TYPE_ICE: - p = PROJECTILE_ELECTRO; - snd = "weapons/electro_fire2.wav"; - break; - case SPIDER_TYPE_FIRE: - p = PROJECTILE_FIREMINE; - snd = "weapons/fireball_fire.wav"; - break; - } - monster_makevectors(self.enemy); - - sound(self, CH_SHOTS, snd, VOL_BASE, ATTEN_NORM); + + sound(self, CH_SHOTS, "weapons/electro_fire2.wav", VOL_BASE, ATTEN_NORM); entity proj = spawn (); proj.classname = "plasma"; proj.owner = proj.realowner = self; proj.use = spider_web_touch; proj.think = adaptor_think2use_hittype_splash; - proj.bot_dodge = TRUE; + proj.bot_dodge = true; proj.bot_dodgerating = 0; proj.nextthink = time + 5; PROJECTILE_MAKETRIGGER(proj); - proj.projectiledeathtype = DEATH_MONSTER_SPIDER_FIRE; + proj.projectiledeathtype = DEATH_MONSTER_SPIDER; setorigin(proj, CENTER_OR_VIEWOFS(self)); //proj.glow_size = 50; //proj.glow_color = 45; proj.movetype = MOVETYPE_BOUNCE; - W_SetupProjectileVelocityEx(proj, v_forward, v_up, MON_CVAR(spider, attack_web_speed), MON_CVAR(spider, attack_web_speed_up), 0, 0, FALSE); + W_SetupProjVelocity_Explicit(proj, v_forward, v_up, (autocvar_g_monster_spider_attack_web_speed), (autocvar_g_monster_spider_attack_web_speed_up), 0, 0, false); proj.touch = spider_web_touch; setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_NO; @@ -125,13 +84,13 @@ void spider_shootweb(float ptype) proj.health = 500; proj.event_damage = func_null; proj.flags = FL_PROJECTILE; - proj.damagedbycontents = TRUE; + proj.damagedbycontents = true; proj.bouncefactor = 0.3; proj.bouncestop = 0.05; proj.missile_flags = MIF_SPLASH | MIF_ARC; - CSQCProjectile(proj, TRUE, p, TRUE); + CSQCProjectile(proj, true, PROJECTILE_ELECTRO, true); } float spider_attack(float attack_type) @@ -139,35 +98,32 @@ float spider_attack(float attack_type) switch(attack_type) { case MONSTER_ATTACK_MELEE: - { - return monster_melee(self.enemy, MON_CVAR(spider, attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, MON_CVAR(spider, attack_bite_delay), DEATH_MONSTER_SPIDER, TRUE); + { + return monster_melee(self.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? spider_anim_attack : spider_anim_attack2), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER, true); } case MONSTER_ATTACK_RANGED: { - if(self.enemy.frozen) - return FALSE; - - monsters_setframe(spider_anim_attack2); - self.attack_finished_single = time + MON_CVAR(spider, attack_web_delay); - spider_shootweb(self.spider_type); - - return TRUE; + if(time >= self.spider_web_delay) + { + self.frame = spider_anim_attack2; + self.attack_finished_single = time + (autocvar_g_monster_spider_attack_web_delay); + spider_shootweb(); + self.spider_web_delay = time + 3; + return true; + } + + return false; } } - - return FALSE; + + return false; } -void spawnfunc_monster_spider() +void spawnfunc_monster_spider() { self.classname = "monster_spider"; - - self.monster_spawnfunc = spawnfunc_monster_spider; - - if(Monster_CheckAppearFlags(self)) - return; - - if not(monster_initialize(MON_SPIDER, FALSE)) { remove(self); return; } + + if(!monster_initialize(MON_SPIDER.monsterid)) { remove(self); return; } } float m_spider(float req) @@ -176,42 +132,34 @@ float m_spider(float req) { case MR_THINK: { - monster_move(MON_CVAR(spider, speed_run), MON_CVAR(spider, speed_walk), MON_CVAR(spider, speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle); - return TRUE; + monster_move((autocvar_g_monster_spider_speed_run), (autocvar_g_monster_spider_speed_walk), (autocvar_g_monster_spider_speed_stop), spider_anim_walk, spider_anim_walk, spider_anim_idle); + return true; } case MR_DEATH: { - monsters_setframe(spider_anim_attack); + self.frame = spider_anim_attack; self.angles_x = 180; - self.SendFlags |= MSF_ANG; - return TRUE; + return true; } case MR_SETUP: { - if not(self.health) self.health = MON_CVAR(spider, health); - if not(self.spider_type) self.spider_type = MON_CVAR(spider, attack_type); - + if(!self.health) self.health = (autocvar_g_monster_spider_health); + self.monster_loot = spawnfunc_item_health_medium; self.monster_attackfunc = spider_attack; - monsters_setframe(spider_anim_idle); - - return TRUE; + self.frame = spider_anim_idle; + + return true; } - case MR_INIT: + case MR_PRECACHE: { - precache_model ("models/ice/ice.md3"); + precache_model("models/monsters/spider.dpm"); precache_sound ("weapons/electro_fire2.wav"); - precache_sound ("weapons/fireball_fire.wav"); - return TRUE; - } - case MR_CONFIG: - { - MON_CONFIG_SETTINGS(SPIDER_SETTINGS(spider)) - return TRUE; + return true; } } - - return TRUE; + + return true; } #endif // SVQC @@ -220,20 +168,13 @@ float m_spider(float req) { switch(req) { - case MR_DEATH: + case MR_PRECACHE: { - // nothing - return TRUE; - } - case MR_INIT: - { - precache_model ("models/monsters/spider.dpm"); - return TRUE; + return true; } } - - return TRUE; + + return true; } #endif // CSQC -#endif // REGISTER_MONSTER