From: Rudolf Polzer Date: Tue, 19 Oct 2010 13:35:29 +0000 (+0200) Subject: nex beam: when low charge, display a weaker beam X-Git-Tag: xonotic-v0.1.0preview~278 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=4ffbca256f8bc337262838c28168b3253853d114 nex beam: when low charge, display a weaker beam --- diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index d4a95b7754..e9a02631f2 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -286,14 +286,18 @@ void Net_ReadZCurveParticles() void Net_ReadNexgunBeamParticle() { vector shotorg, endpos; + float charge; shotorg_x = ReadCoord(); shotorg_y = ReadCoord(); shotorg_z = ReadCoord(); endpos_x = ReadCoord(); endpos_y = ReadCoord(); endpos_z = ReadCoord(); + charge = ReadByte() / 255.0; pointparticles(particleeffectnum("nex_muzzleflash"), shotorg, normalize(endpos - shotorg) * 1000, 1); //draw either the old v2.3 beam or the new beam + charge = sqrt(charge); // divide evenly among trail spacing and alpha + particles_alphamin = particles_alphamax = charge; if (cvar("cl_particles_oldnexbeam") && (getstati(STAT_ALLOW_OLDNEXBEAM) || isdemo())) - WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), shotorg, endpos); + WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum("TE_TEI_G3"), shotorg, endpos, charge, 1); else - WarpZone_TrailParticles(world, particleeffectnum("nex_beam"), shotorg, endpos); + WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum("nex_beam"), shotorg, endpos, charge, 1); } diff --git a/qcsrc/server/extensions.qh b/qcsrc/server/extensions.qh index ac77483729..b72a050001 100644 --- a/qcsrc/server/extensions.qh +++ b/qcsrc/server/extensions.qh @@ -1,60 +1,60 @@ - //DarkPlaces supported extension list, draft version 1.04 - - //things that don't have extensions yet: - .float disableclientprediction; - - //definitions that id Software left out: - //these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed) - float MOVE_NORMAL = 0; // same as FALSE - float MOVE_NOMONSTERS = 1; // same as TRUE - float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE - - //checkextension function - //idea: expected by almost everyone - //darkplaces implementation: LordHavoc - float(string s) checkextension = #99; - //description: - //check if (cvar("pr_checkextension")) before calling this, this is the only - //guaranteed extension to be present in the extension system, it allows you - //to check if an extension is available, by name, to check for an extension - //use code like this: - //// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere) - //if (cvar("pr_checkextension")) - //if (checkextension("DP_SV_SETCOLOR")) - // ext_setcolor = TRUE; - //from then on you can check ext_setcolor to know if that extension is available - - //BX_WAL_SUPPORT - //idea: id Software - //darkplaces implementation: LordHavoc - //description: - //indicates the engine supports .wal textures for filenames in the textures/ directory - //(note: DarkPlaces has supported this since 2001 or 2002, but did not advertise it as an extension, then I noticed Betwix was advertising it and added the extension accordingly) - - //DP_BUTTONCHAT - //idea: Vermeulen - //darkplaces implementation: LordHavoc - //field definitions: - .float buttonchat; - //description: - //true if the player is currently chatting (in messagemode, menus or console) - - //DP_BUTTONUSE - //idea: id Software - //darkplaces implementation: LordHavoc - //field definitions: - .float buttonuse; - //client console commands: - //+use - //-use - //description: - //made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes). - - //DP_CL_LOADSKY - //idea: Nehahra, LordHavoc - //darkplaces implementation: LordHavoc - //client console commands: +//DarkPlaces supported extension list, draft version 1.04 + +//things that don't have extensions yet: +.float disableclientprediction; + +//definitions that id Software left out: +//these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed) +float MOVE_NORMAL = 0; // same as FALSE +float MOVE_NOMONSTERS = 1; // same as TRUE +float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE + +//checkextension function +//idea: expected by almost everyone +//darkplaces implementation: LordHavoc +float(string s) checkextension = #99; +//description: +//check if (cvar("pr_checkextension")) before calling this, this is the only +//guaranteed extension to be present in the extension system, it allows you +//to check if an extension is available, by name, to check for an extension +//use code like this: +//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere) +//if (cvar("pr_checkextension")) +//if (checkextension("DP_SV_SETCOLOR")) +// ext_setcolor = TRUE; +//from then on you can check ext_setcolor to know if that extension is available + +//BX_WAL_SUPPORT +//idea: id Software +//darkplaces implementation: LordHavoc +//description: +//indicates the engine supports .wal textures for filenames in the textures/ directory +//(note: DarkPlaces has supported this since 2001 or 2002, but did not advertise it as an extension, then I noticed Betwix was advertising it and added the extension accordingly) + +//DP_BUTTONCHAT +//idea: Vermeulen +//darkplaces implementation: LordHavoc +//field definitions: +.float buttonchat; +//description: +//true if the player is currently chatting (in messagemode, menus or console) + +//DP_BUTTONUSE +//idea: id Software +//darkplaces implementation: LordHavoc +//field definitions: +.float buttonuse; +//client console commands: +//+use +//-use +//description: +//made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes). + +//DP_CL_LOADSKY +//idea: Nehahra, LordHavoc +//darkplaces implementation: LordHavoc +//client console commands: //"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming) //description: //sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX). diff --git a/qcsrc/server/w_nex.qc b/qcsrc/server/w_nex.qc index 64c9c385b7..61af784e0e 100644 --- a/qcsrc/server/w_nex.qc +++ b/qcsrc/server/w_nex.qc @@ -2,23 +2,23 @@ REGISTER_WEAPON(NEX, w_nex, IT_CELLS, 7, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "nex", "nex", "Nex"); #else #ifdef SVQC -void SendCSQCNexBeamParticle() { +void SendCSQCNexBeamParticle(float charge) { vector v; v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_NEXGUNBEAMPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg_x); WriteCoord(MSG_BROADCAST, w_shotorg_y); WriteCoord(MSG_BROADCAST, w_shotorg_z); WriteCoord(MSG_BROADCAST, v_x); WriteCoord(MSG_BROADCAST, v_y); WriteCoord(MSG_BROADCAST, v_z); + WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255)); } void W_Nex_Attack (float issecondary) { - float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo; + float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge; if(issecondary) { mydmg = cvar("g_balance_nex_secondary_damage"); @@ -45,11 +45,13 @@ void W_Nex_Attack (float issecondary) if(cvar("g_balance_nex_charge")) { - mydmg *= self.nex_charge; - myforce *= self.nex_charge; - //print("^1Damage: ^7", ftos(mydmg), "\n"); + charge = self.nex_charge; self.nex_charge *= cvar("g_balance_nex_charge_shot_multiplier"); // do this AFTER setting mydmg/myforce } + else + charge = 1; + mydmg *= charge; + myforce *= charge; W_SetupShot (self, TRUE, 5, "weapons/nexfire.wav", mydmg); @@ -60,7 +62,7 @@ void W_Nex_Attack (float issecondary) AnnounceTo(self, "yoda"); //beam and muzzle flash done on client - SendCSQCNexBeamParticle(); + SendCSQCNexBeamParticle(charge); // flash and burn the wall if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)) diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index 1e4fc3e630..bc23cd11ba 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -411,6 +411,8 @@ void WarpZone_TraceToss(entity e, entity forent) entity WarpZone_TrailParticles_trace_callback_own; float WarpZone_TrailParticles_trace_callback_eff; +float WarpZone_TrailParticles_trace_callback_f; +float WarpZone_TrailParticles_trace_callback_flags; void WarpZone_TrailParticles_trace_callback(vector from, vector endpos, vector to) { trailparticles(WarpZone_TrailParticles_trace_callback_own, WarpZone_TrailParticles_trace_callback_eff, from, endpos); @@ -423,6 +425,22 @@ void WarpZone_TrailParticles(entity own, float eff, vector org, vector end) WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, world, world, WarpZone_TrailParticles_trace_callback); } +#ifdef CSQC +void WarpZone_TrailParticles_WithMultiplier_trace_callback(vector from, vector endpos, vector to) +{ + boxparticles(WarpZone_TrailParticles_trace_callback_eff, WarpZone_TrailParticles_trace_callback_own, from, endpos, WarpZone_TrailParticles_trace_callback_own.velocity, WarpZone_TrailParticles_trace_callback_own.velocity, WarpZone_TrailParticles_trace_callback_f, WarpZone_TrailParticles_trace_callback_flags); +} + +void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, float boxflags) +{ + WarpZone_TrailParticles_trace_callback_own = own; + WarpZone_TrailParticles_trace_callback_eff = eff; + WarpZone_TrailParticles_trace_callback_f = f; + WarpZone_TrailParticles_trace_callback_flags = boxflags; + WarpZone_TraceBox_ThroughZone(org, '0 0 0', '0 0 0', end, MOVE_NOMONSTERS, world, world, WarpZone_TrailParticles_WithMultiplier_trace_callback); +} +#endif + float WarpZone_PlaneDist(entity wz, vector v) { return (v - wz.warpzone_origin) * wz.warpzone_forward; diff --git a/qcsrc/warpzonelib/common.qh b/qcsrc/warpzonelib/common.qh index 9ccd5216a6..1b594d96d7 100644 --- a/qcsrc/warpzonelib/common.qh +++ b/qcsrc/warpzonelib/common.qh @@ -38,6 +38,9 @@ void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent) void WarpZone_TraceToss(entity e, entity forent); void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZone_trace_callback_t cb); void WarpZone_TrailParticles(entity own, float eff, vector org, vector end); +#ifdef CSQC +void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, float boxflags); +#endif .vector WarpZone_findradius_dist; .vector WarpZone_findradius_nearest;