X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fsteerlib.qc;h=beaab08a4d5823f7cab36dd313d103f9068fd146;hp=ec76dfef2cda72354df3d1557fdd30e71f19dd7b;hb=64b8409b2d6fb93dc51ba24a82d219c8cd56a907;hpb=6dc9591eba337374f2b4348a6a6deaa1cb6887d0 diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index ec76dfef2..beaab08a4 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -1,17 +1,13 @@ #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) - #include "../dpdefs/progsdefs.qh" - #include "../dpdefs/dpextensions.qh" #endif -.vector steerto; - /** Uniform pull towards a point **/ vector steerlib_pull(vector point) -{ +{SELFPARAM(); return normalize(point - self.origin); } @@ -29,7 +25,7 @@ vector steerlib_push(vector point) Pull toward a point, The further away, the stronger the pull. **/ vector steerlib_arrive(vector point,float maximal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -42,7 +38,7 @@ vector steerlib_arrive(vector point,float maximal_distance) Pull toward a point increasing the pull the closer we get **/ vector steerlib_attract(vector point, float maximal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -53,7 +49,7 @@ vector steerlib_attract(vector point, float maximal_distance) } vector steerlib_attract2(vector point, float min_influense,float max_distance,float max_influense) -{ +{SELFPARAM(); float distance; vector direction; float influense; @@ -101,7 +97,7 @@ vector steerlib_attract2(vector point, float maximal_distance,float min_influens Move away from a point. **/ vector steerlib_repell(vector point,float maximal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -115,7 +111,7 @@ vector steerlib_repell(vector point,float maximal_distance) Try to keep at ideal_distance away from point **/ vector steerlib_standoff(vector point,float ideal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -142,7 +138,7 @@ vector steerlib_standoff(vector point,float ideal_distance) where range is the cicrle radius and tresh is how close we need to be to pick a new heading. **/ vector steerlib_wander(float range,float tresh,vector oldpoint) -{ +{SELFPARAM(); vector wander_point; wander_point = v_forward - oldpoint; @@ -161,7 +157,7 @@ vector steerlib_wander(float range,float tresh,vector oldpoint) Dodge a point. dont work to well. **/ vector steerlib_dodge(vector point,vector dodge_dir,float min_distance) -{ +{SELFPARAM(); float distance; distance = max(vlen(self.origin - point),min_distance); @@ -177,7 +173,7 @@ vector steerlib_dodge(vector point,vector dodge_dir,float min_distance) **/ .float flock_id; vector steerlib_flock(float _radius, float standoff,float separation_force,float flock_force) -{ +{SELFPARAM(); entity flock_member; vector push = '0 0 0', pull = '0 0 0'; float ccount = 0; @@ -203,7 +199,7 @@ vector steerlib_flock(float _radius, float standoff,float separation_force,float xy only version (for ground movers). **/ vector steerlib_flock2d(float _radius, float standoff,float separation_force,float flock_force) -{ +{SELFPARAM(); entity flock_member; vector push = '0 0 0', pull = '0 0 0'; float ccount = 0; @@ -234,7 +230,7 @@ vector steerlib_flock2d(float _radius, float standoff,float separation_force,flo This results in a aligned movement (?!) much like flocking. **/ vector steerlib_swarm(float _radius, float standoff,float separation_force,float swarm_force) -{ +{SELFPARAM(); entity swarm_member; vector force = '0 0 0', center = '0 0 0'; float ccount = 0; @@ -264,7 +260,7 @@ vector steerlib_swarm(float _radius, float standoff,float separation_force,float You need to call makevectors() (or equivalent) before this function to set v_forward and v_right **/ vector steerlib_traceavoid(float pitch,float length) -{ +{SELFPARAM(); vector vup_left,vup_right,vdown_left,vdown_right; float fup_left,fup_right,fdown_left,fdown_right; vector upwish,downwish,leftwish,rightwish; @@ -311,7 +307,7 @@ vector steerlib_traceavoid(float pitch,float length) Run tracelines in a forward trident, bias each direction negative if something is found there. **/ vector steerlib_traceavoid_flat(float pitch, float length, vector vofs) -{ +{SELFPARAM(); vector vt_left, vt_right,vt_front; float f_left, f_right,f_front; vector leftwish, rightwish,frontwish, v_left; @@ -383,7 +379,7 @@ float beamsweep_badpoint(vector point,float waterok) //#define BEAMSTEER_VISUAL float beamsweep(vector from, vector dir,float length, float step,float step_up, float step_down) -{ +{SELFPARAM(); float i; vector a,b,u,d; @@ -423,7 +419,7 @@ float beamsweep(vector from, vector dir,float length, float step,float step_up, } vector steerlib_beamsteer(vector dir, float length, float step, float step_up, float step_down) -{ +{SELFPARAM(); float bm_forward, bm_right, bm_left,p; vector vr,vl; @@ -499,8 +495,8 @@ vector steerlib_beamsteer(vector dir, float length, float step, float step_up, f //#define TLIBS_TETSLIBS #ifdef TLIBS_TETSLIBS void flocker_die() -{ - pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1); +{SELFPARAM(); + Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1); self.owner.cnt += 1; self.owner = world; @@ -511,7 +507,7 @@ void flocker_die() void flocker_think() -{ +{SELFPARAM(); vector dodgemove,swarmmove; vector reprellmove,wandermove,newmove; @@ -547,19 +543,17 @@ void flocker_think() self.nextthink = time + 0.1; } +MODEL(FLOCKER, "models/turrets/rocket.md3"); void spawn_flocker() -{ - entity flocker; - - flocker = spawn (); +{SELFPARAM(); + entity flocker = new(flocker); setorigin(flocker, self.origin + '0 0 32'); - setmodel (flocker, "models/turrets/rocket.md3"); + setmodel (flocker, MDL_FLOCKER); setsize (flocker, '-3 -3 -3', '3 3 3'); flocker.flock_id = self.flock_id; - flocker.classname = "flocker"; flocker.owner = self; flocker.think = flocker_think; flocker.nextthink = time + random() * 5; @@ -576,7 +570,7 @@ void spawn_flocker() } void flockerspawn_think() -{ +{SELFPARAM(); if(self.cnt > 0) @@ -587,7 +581,7 @@ void flockerspawn_think() } void flocker_hunter_think() -{ +{SELFPARAM(); vector dodgemove,attractmove,newmove; entity e,ee; float d,bd; @@ -641,10 +635,8 @@ void flocker_hunter_think() float globflockcnt; -void spawnfunc_flockerspawn() -{ - precache_model ( "models/turrets/rocket.md3"); - precache_model("models/turrets/c512.md3"); +spawnfunc(flockerspawn) +{SELFPARAM(); ++globflockcnt; if(!self.cnt) self.cnt = 20; @@ -654,12 +646,11 @@ void spawnfunc_flockerspawn() self.think = flockerspawn_think; self.nextthink = time + 0.25; - self.enemy = spawn(); + self.enemy = new(FLock Hunter); - setmodel(self.enemy, "models/turrets/rocket.md3"); + setmodel(self.enemy, MDL_FLOCKER); setorigin(self.enemy,self.origin + '0 0 768' + (randomvec() * 128)); - self.enemy.classname = "FLock Hunter"; self.enemy.scale = 3; self.enemy.effects = EF_LOWPRECISION; self.enemy.movetype = MOVETYPE_BOUNCEMISSILE;