From daba5281d011f86c64cd5f69c9db3299f67cb691 Mon Sep 17 00:00:00 2001 From: div0 Date: Fri, 20 Feb 2009 18:17:23 +0000 Subject: [PATCH] nex beam stuff by green git-svn-id: svn://svn.icculus.org/nexuiz/trunk@5914 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/check-sounds.sh | 43 ++++++++++++++++++++-------------- data/defaultNexuiz.cfg | 3 +++ data/qcsrc/client/Main.qc | 4 ++++ data/qcsrc/client/particles.qc | 15 ++++++++++++ data/qcsrc/common/constants.qh | 2 ++ data/qcsrc/server/cl_client.qc | 1 + data/qcsrc/server/defs.qh | 1 + data/qcsrc/server/g_world.qc | 1 + data/qcsrc/server/w_nex.qc | 19 +++++++++++---- 9 files changed, 67 insertions(+), 22 deletions(-) diff --git a/data/check-sounds.sh b/data/check-sounds.sh index 5aef39c5c..3170c7af4 100755 --- a/data/check-sounds.sh +++ b/data/check-sounds.sh @@ -87,25 +87,32 @@ for S in models/player/*.sounds sound/player/default.sounds; do ;; //*) identifiers_seen="$identifiers_seen ${TITLE#//}" - good=false - case "$COUNT" in - 0) - if psoundtry "$SOUND"; then - good=false - fi - ;; - *) - for i in `seq 1 $COUNT`; do - if psoundtry "$SOUND$i"; then - good=true - fi - done - ;; - esac + for X in $allidentifiers; do + if [ "$X" = "${TITLE#//}" ]; then + good=true + fi + done if $good; then - echo "$S references existing sound $SOUND but commented out" - else - echo "$S does not have a sound for ${TITLE#//} yet" + good=false + case "$COUNT" in + 0) + if psoundtry "$SOUND"; then + good=false + fi + ;; + *) + for i in `seq 1 $COUNT`; do + if psoundtry "$SOUND$i"; then + good=true + fi + done + ;; + esac + if $good; then + echo "$S references existing sound $SOUND but commented out" + else + echo "$S does not have a sound for ${TITLE#//} yet" + fi fi ;; *) diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index d03774d6c..5a3638fef 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -273,6 +273,9 @@ set sv_timeout_number 2 "how many timeouts one player is allowed to call (gets r set sv_timeout_leadtime 4 "how long the players will be informed that a timeout was calledbefore it starts, in seconds" set sv_timeout_resumetime 3 "how long the remaining timeout-time will be after a player called the resumegame command" +set g_allow_oldnexbeam 0 "If enabled, clients are allowed to use old v2.3 Nexgun beam" +set cl_particles_oldnexbeam 0 "Uses the old v2.3 Nexgun beam instead of the new beam, only works if server allows it (g_allow_oldnexbeam = 1)" + // use default physics exec physics25.cfg diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index fa134adb0..50546753b 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -1009,6 +1009,10 @@ float CSQC_Parse_TempEntity() Net_ReadZCurveParticles(); bHandled = true; break; + case TE_CSQC_NEXGUNBEAMPARTICLE: + Net_ReadNexgunBeamParticle(); + bHandled = true; + break; default: // No special logic for this temporary entity; return 0 so the engine can handle it bHandled = false; diff --git a/data/qcsrc/client/particles.qc b/data/qcsrc/client/particles.qc index b2a9e5bcd..ffb25cf07 100644 --- a/data/qcsrc/client/particles.qc +++ b/data/qcsrc/client/particles.qc @@ -243,3 +243,18 @@ void Net_ReadZCurveParticles() zcurveparticles(effectnum, start, end, end_dz, speed, 5); // at most 32 segments } + +void Net_ReadNexgunBeamParticle() +{ + vector shotorg, endpos; + shotorg_x = ReadCoord(); shotorg_y = ReadCoord(); shotorg_z = ReadCoord(); + endpos_x = ReadCoord(); endpos_y = ReadCoord(); endpos_z = ReadCoord(); + + pointparticles(particleeffectnum("nex_muzzleflash"), shotorg, normalize(endpos - shotorg) * 1000, 1); + + //draw either the old v2.3 beam or the new beam + if (cvar("cl_particles_oldnexbeam") && (getstati(STAT_ALLOW_OLDNEXBEAM) || isdemo())) + trailparticles(world, particleeffectnum("TE_TEI_G3"), shotorg, endpos); + else + trailparticles(world, particleeffectnum("nex_beam"), shotorg, endpos); +} diff --git a/data/qcsrc/common/constants.qh b/data/qcsrc/common/constants.qh index 891248a94..4a738298c 100644 --- a/data/qcsrc/common/constants.qh +++ b/data/qcsrc/common/constants.qh @@ -46,6 +46,7 @@ const float TE_CSQC_PICTURE = 100; const float TE_CSQC_RACE = 101; const float TE_CSQC_SPAWN = 102; const float TE_CSQC_ZCURVEPARTICLES = 103; +const float TE_CSQC_NEXGUNBEAMPARTICLE = 104; const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder const float RACE_NET_CHECKPOINT_CLEAR = 1; @@ -242,6 +243,7 @@ const float STAT_GAMESTARTTIME = 37; const float STAT_STRENGTH_FINISHED = 38; const float STAT_INVINCIBLE_FINISHED = 39; const float STAT_PRESSED_KEYS = 42; +const float STAT_ALLOW_OLDNEXBEAM = 43; // this stat could later contain some other bits of info, like, more server-side particle config const float CTF_STATE_ATTACK = 1; const float CTF_STATE_DEFEND = 2; const float CTF_STATE_COMMANDER = 3; diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 4bc62d5cb..3950f2d31 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -2078,6 +2078,7 @@ void PlayerPreThink (void) { self.stat_sys_ticrate = cvar("sys_ticrate"); self.stat_game_starttime = game_starttime; + self.stat_allow_oldnexbeam = cvar("g_allow_oldnexbeam"); if(blockSpectators && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index e983a3f0c..1508c2f4c 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -514,6 +514,7 @@ void W_Porto_Remove (entity p); .string message2; vector railgun_start, railgun_end; // filled by FireRailgunBullet, used by damage code for head shot +.float stat_allow_oldnexbeam; // reset to 0 on weapon switch // may be useful to all weapons diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index c3d792955..f03dbe7de 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -542,6 +542,7 @@ void spawnfunc_worldspawn (void) addstat(STAT_WEAPONS, AS_INT, weapons); addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon); addstat(STAT_GAMESTARTTIME, AS_FLOAT, stat_game_starttime); + addstat(STAT_ALLOW_OLDNEXBEAM, AS_INT, stat_allow_oldnexbeam); Nagger_Init(); addstat(STAT_STRENGTH_FINISHED, AS_FLOAT, strength_finished); diff --git a/data/qcsrc/server/w_nex.qc b/data/qcsrc/server/w_nex.qc index 3d809a7b0..3a0b4ff64 100644 --- a/data/qcsrc/server/w_nex.qc +++ b/data/qcsrc/server/w_nex.qc @@ -1,3 +1,15 @@ +void SendCSQCNexBeamParticle() { + 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, trace_endpos_x); + WriteCoord(MSG_BROADCAST, trace_endpos_y); + WriteCoord(MSG_BROADCAST, trace_endpos_z); +} + void W_Nex_Attack (void) { float flying; @@ -11,10 +23,9 @@ void W_Nex_Attack (void) if(yoda && flying) announce(self, "announcer/male/yoda.wav"); - pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); - - // beam effect - trailparticles(world, particleeffectnum("nex_beam"), w_shotorg, trace_endpos); + //beam and muzzle flash done on client + SendCSQCNexBeamParticle(); + // flash and burn the wall if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)) Damage_DamageInfo(trace_endpos, cvar("g_balance_nex_damage"), 0, 0, cvar("g_balance_nex_force") * w_shotdir, WEP_NEX); -- 2.39.2