X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=inline;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fspider.qc;h=9338657082f25eb168607ac338858783607f99f1;hb=10c0e93c75ef6f408e3357bd5fb46c721e7e0576;hp=512422d33b9c8227420106035d5b9e41991c3c9e;hpb=e0e847a336cdb7ab1fcb93d3cf3e1402b761a726;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 512422d33..933865708 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -56,39 +56,46 @@ REGISTER_MUTATOR(spiderweb, true); MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics) { - if (time >= self.spider_slowness) + entity player = M_ARGV(0, entity); + + if (time >= player.spider_slowness) return false; - PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider - PHYS_MAXAIRSPEED(self) *= 0.5; - PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5; - PHYS_AIRSTRAFEACCELERATE(self) *= 0.5; - return false; + PHYS_MAXSPEED(player) *= 0.5; // half speed while slow from spider + PHYS_MAXAIRSPEED(player) *= 0.5; + PHYS_AIRSPEEDLIMIT_NONQW(player) *= 0.5; + PHYS_AIRSTRAFEACCELERATE(player) *= 0.5; } MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove) { - if(time < self.spider_slowness) + entity mon = M_ARGV(0, entity); + + if(time < mon.spider_slowness) { - monster_speed_run *= 0.5; - monster_speed_walk *= 0.5; + M_ARGV(1, float) *= 0.5; // run speed + M_ARGV(2, float) *= 0.5; // walk speed } - return false; } MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn) { - self.spider_slowness = 0; + entity player = M_ARGV(0, entity); + + player.spider_slowness = 0; return false; } MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn) { - self.spider_slowness = 0; - return false; + entity mon = M_ARGV(0, entity); + + mon.spider_slowness = 0; } SOUND(SpiderAttack_FIRE, W_Sound("electro_fire")); -METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire)) { +METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire)) +{ + TC(SpiderAttack, thiswep); bool isPlayer = IS_PLAYER(actor); if (fire & 1) if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay)) { @@ -99,7 +106,7 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity actor.anim_finished = time + 1; } if (isPlayer) actor.enemy = Monster_FindTarget(actor); - W_SetupShot_Dir(actor, v_forward, false, 0, SND(SpiderAttack_FIRE), CH_WEAPON_B, 0); + W_SetupShot_Dir(actor, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0); if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin); M_Spider_Attack_Web(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready); @@ -111,7 +118,7 @@ METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity actor.enemy = Monster_FindTarget(actor); actor.attack_range = 60; } - Monster_Attack_Melee(actor, actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? self.anim_melee : self.anim_shoot), self.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER.m_id, true); + Monster_Attack_Melee(actor, actor.enemy, (autocvar_g_monster_spider_attack_bite_damage), ((random() > 0.5) ? actor.anim_melee : actor.anim_shoot), actor.attack_range, (autocvar_g_monster_spider_attack_bite_delay), DEATH_MONSTER_SPIDER.m_id, true); weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, 0, w_ready); } } @@ -129,29 +136,33 @@ const float spider_anim_attack = 2; const float spider_anim_attack2 = 3; */ -void M_Spider_Attack_Web_Explode() -{SELFPARAM(); - entity e; - if(self) +void M_Spider_Attack_Web_Explode(entity this) +{ + if(this) { - Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1); - RadiusDamage(self, self.realowner, 0, 0, 25, world, world, 25, self.projectiledeathtype, world); + Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1); + RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, NULL); - for(e = findradius(self.origin, 25); e; e = e.chain) if(e != self) if(e.takedamage && !IS_DEAD(e)) if(e.health > 0) if(e.monsterid != MON_SPIDER.monsterid) + for(entity e = findradius(this.origin, 25); e; e = e.chain) if(e != this) if(e.takedamage && !IS_DEAD(e)) if(e.health > 0) if(e.monsterid != MON_SPIDER.monsterid) e.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime); - remove(self); + remove(this); } } -void M_Spider_Attack_Web_Touch() +void M_Spider_Attack_Web_Explode_use(entity this, entity actor, entity trigger) +{ + M_Spider_Attack_Web_Explode(this); +} + +void M_Spider_Attack_Web_Touch(entity this) { - PROJECTILE_TOUCH; + PROJECTILE_TOUCH(this); - M_Spider_Attack_Web_Explode(); + M_Spider_Attack_Web_Explode(this); } -void adaptor_think2use_hittype_splash(); +void adaptor_think2use_hittype_splash(entity this); void M_Spider_Attack_Web(entity this) { @@ -161,8 +172,8 @@ void M_Spider_Attack_Web(entity this) entity proj = new(plasma); proj.owner = proj.realowner = this; - proj.use = M_Spider_Attack_Web_Explode; - proj.think = adaptor_think2use_hittype_splash; + proj.use = M_Spider_Attack_Web_Explode_use; + setthink(proj, adaptor_think2use_hittype_splash); proj.bot_dodge = true; proj.bot_dodgerating = 0; proj.nextthink = time + 5; @@ -174,7 +185,7 @@ void M_Spider_Attack_Web(entity this) //proj.glow_color = 45; proj.movetype = MOVETYPE_BOUNCE; 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 = M_Spider_Attack_Web_Touch; + settouch(proj, M_Spider_Attack_Web_Touch); setsize(proj, '-4 -4 -4', '4 4 4'); proj.takedamage = DAMAGE_NO; proj.damageforcescale = 0; @@ -215,26 +226,30 @@ spawnfunc(monster_spider) { Monster_Spawn(this, MON_SPIDER.monsterid); } #endif // SVQC #ifdef SVQC -METHOD(Spider, mr_think, bool(Spider thismon, entity actor)) +METHOD(Spider, mr_think, bool(Spider this, entity actor)) { + TC(Spider, this); return true; } -METHOD(Spider, mr_pain, bool(Spider thismon, entity actor)) +METHOD(Spider, mr_pain, float(Spider this, entity actor, float damage_take, entity attacker, float deathtype)) { - return true; + TC(Spider, this); + return damage_take; } -METHOD(Spider, mr_death, bool(Spider thismon, entity actor)) +METHOD(Spider, mr_death, bool(Spider this, entity actor)) { + TC(Spider, this); setanim(actor, actor.anim_melee, false, true, true); actor.angles_x = 180; return true; } #endif #ifndef MENUQC -METHOD(Spider, mr_anim, bool(Spider thismon, entity actor)) +METHOD(Spider, mr_anim, bool(Spider this, entity actor)) { + TC(Spider, this); vector none = '0 0 0'; actor.anim_walk = animfixfps(actor, '1 1 1', none); actor.anim_idle = animfixfps(actor, '0 1 1', none); @@ -246,8 +261,9 @@ METHOD(Spider, mr_anim, bool(Spider thismon, entity actor)) #endif #ifdef SVQC spawnfunc(item_health_medium); -METHOD(Spider, mr_setup, bool(Spider thismon, entity actor)) +METHOD(Spider, mr_setup, bool(Spider this, entity actor)) { + TC(Spider, this); if(!actor.health) actor.health = (autocvar_g_monster_spider_health); if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); } if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); } @@ -260,8 +276,9 @@ METHOD(Spider, mr_setup, bool(Spider thismon, entity actor)) return true; } -METHOD(Spider, mr_precache, bool(Spider thismon)) +METHOD(Spider, mr_precache, bool(Spider this)) { + TC(Spider, this); return true; } #endif