From 1a673c66a14bf089bb14a9d38098ec0c49df1ff1 Mon Sep 17 00:00:00 2001 From: div0 Date: Tue, 26 Aug 2008 07:32:17 +0000 Subject: [PATCH] CSQC handle func_sparks; more to come later (func_pointparticles planned); however, sparks are broken git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4183 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/effectinfo.txt | 779 +--------------------------- data/qcsrc/client/Main.qc | 2 + data/qcsrc/client/View.qc | 14 +- data/qcsrc/client/csqc_builtins.qc | 2 +- data/qcsrc/client/csqc_constants.qc | 7 + data/qcsrc/client/hook.qc | 130 +++-- data/qcsrc/client/main.qh | 3 + data/qcsrc/client/progs.src | 1 + data/qcsrc/common/constants.qh | 4 +- data/qcsrc/server/g_triggers.qc | 73 ++- 10 files changed, 139 insertions(+), 876 deletions(-) diff --git a/data/effectinfo.txt b/data/effectinfo.txt index 36add68ad..a0549f7b6 100644 --- a/data/effectinfo.txt +++ b/data/effectinfo.txt @@ -600,7 +600,7 @@ velocitymultiplier 1 // sparks (quake effect) effect TE_SPARK -count 1 +count 1000 type spark color 0x8f4333 0xfff31b size 0.4 0.4 @@ -1512,780 +1512,3 @@ size 24 24 alpha 256 256 256 originjitter 20 20 20 velocityjitter 32 32 32 - - - -effect crylink_muzzleflash -count 1 -type smoke -color 0x202020 0x404040 -tex 0 8 -size 5 5 -alpha 128 128 256 -originjitter 1.5 1.5 1.5 -velocityjitter 6 6 6 -velocitymultiplier 0.01 -lightradius 200 -lightradiusfade 2000 -lightcolor 2 1.5 0.2 -effect crylink_muzzleflash -count 10 -type spark -tex 40 40 -color 0xA080C0 0xA080C0 -size 3 3 -alpha 0 128 1024 -originjitter 1 1 1 -velocityjitter 200 200 200 -velocitymultiplier 0.3 -airfriction 12 - - - -// crylink impact effect -// decal -effect crylink_impact -countabsolute 1 -type decal -tex 47 47 -size 8 8 -alpha 256 256 0 -originjitter 12 12 12 -//lightradius 60 -//lightradiusfade 300 -//lightcolor 3.2 0.4 4 -// purple flare effect -effect crylink_impact -countabsolute 1 -type static -tex 39 39 -color 0x504060 0x504060 -size 8 8 -alpha 256 256 512 -// purple sparks -effect crylink_impact -count 20 -type spark -tex 41 41 -color 0xA040C0 0xA040C0 -bounce 2 -size 4 4 -alpha 256 256 1024 -velocityjitter 256 256 256 -// purple splash -effect crylink_impact -count 3 -type static -color 0xE070FF 0xE070FF -size 8 8 -alpha 256 256 512 -velocityjitter 8 8 8 -// purple splash -effect crylink_impact -count 3 -type static -color 0xE070FF 0xE070FF -size 8 8 -alpha 256 256 1024 -velocityjitter 32 32 32 - - - -effect nex_muzzleflash -count 10 -type smoke -color 0x202020 0x404040 -tex 0 8 -size 16 16 -alpha 128 128 192 -originjitter 4 4 4 -velocityjitter 24 24 24 -velocitymultiplier 0.02 -lightradius 200 -lightradiusfade 200 -lightcolor 2 2.5 3 -effect nex_muzzleflash -count 150 -type spark -tex 41 41 -color 0xD9FDFF 0xD9FDFF -size 3 3 -alpha 0 128 1024 -originjitter 1 1 1 -velocityjitter 600 600 600 -velocitymultiplier 0.5 -airfriction 9 - - - -//// nex beam -//effect nex_beam -//countabsolute 1 -//type beam -//tex 60 60 -//color 0xFFFFFF 0xFFFFFF -//size 6 6 -//alpha 128 128 192 -// nex beam: ring smoke -effect nex_beam -trailspacing 32 -color 0x1680A0 0x1680A0 -size 4 4 -tex 32 32 -alpha 64 128 64 -airfriction 5 -sizeincrease 2 -type static -// nex beam: drifting smoke -effect nex_beam -trailspacing 6 -color 0x5080A0 0x5080A0 -size 4 4 -tex 48 55 -alpha 32 64 32 -airfriction 9 -sizeincrease 4 -velocityjitter 64 64 64 -type static -// nex beam: bright core -effect nex_beam -trailspacing 6 -color 0x80CDFF 0x80CDFF -size 4 4 -//tex 48 55 -alpha 256 256 1280 -type static - -// nex impact -// decal -effect nex_impact -countabsolute 1 -type decal -tex 47 47 -size 24 24 -alpha 256 256 0 -originjitter 16 16 16 -lightradius 200 -lightradiusfade 250 -lightcolor 4 6 8 -// flare effect -effect nex_impact -countabsolute 1 -type static -tex 37 37 -color 0x80C0FF 0x80C0FF -size 8 8 -alpha 256 256 256 -// small sparks which form a sphere as they slow down -//effect nex_impact -//count 256 -//type spark -//color 0x2030FF 0x80C0FF -//size 1 2 -//alpha 256 256 512 -//bounce 2 -//airfriction 8 -//liquidfriction 8 -//velocityjitter 384 384 384 -// small sparks which glow brightly but live briefly -effect nex_impact -count 128 -type spark -tex 41 41 -color 0xD9FDFF 0xD9FDFF -size 4 4 -alpha 0 128 512 -bounce 2 -velocityjitter 600 600 600 -velocitymultiplier 0.5 -airfriction 9 - - - -effect hagar_muzzleflash -count 4 -type smoke -color 0x202020 0x404040 -tex 0 8 -size 5 5 -alpha 256 256 512 -originjitter 1.5 1.5 1.5 -velocityjitter 6 6 6 -velocitymultiplier 0.01 -lightradius 200 -lightradiusfade 2000 -lightcolor 2 1.5 0.2 -effect hagar_muzzleflash -count 30 -type spark -tex 40 40 -color 0xFFFDD9 0xFFFDD9 -size 3 3 -alpha 0 128 1024 -originjitter 1 1 1 -velocityjitter 300 300 300 -velocitymultiplier 0.5 -airfriction 12 - - - -effect hagar_bounce -count 4 -type smoke -color 0x202020 0x404040 -tex 0 8 -size 5 5 -alpha 256 256 256 -originjitter 1.5 1.5 1.5 -velocityjitter 6 6 6 -velocitymultiplier 0.01 -lightradius 60 -lightradiusfade 300 -lightcolor 2 1.5 0.2 -effect hagar_bounce -count 30 -type spark -tex 40 40 -color 0xFFFDD9 0xFFFDD9 -size 3 3 -alpha 0 256 256 -gravity 1 -bounce 1.5 -originjitter 1 1 1 -velocityjitter 600 600 600 -velocitymultiplier 0.5 -airfriction 12 - - - -// decal -effect hagar_explode -countabsolute 1 -type decal -tex 8 16 -size 48 48 -alpha 256 256 0 -originjitter 40 40 40 -lightradius 250 -lightradiusfade 400 -lightcolor 8 4 1 -// flare effect -effect hagar_explode -countabsolute 1 -type static -tex 35 37 -color 0x404040 0x404040 -size 48 48 -alpha 192 192 64 -// fire effect which expands then slows -effect hagar_explode -notunderwater -count 128 -type static -tex 48 55 -color 0x902010 0xFFD080 -size 16 16 -alpha 128 128 256 -bounce 1.5 -airfriction 4 -liquidfriction 4 -originjitter 8 8 8 -velocityjitter 256 256 256 -// underwater bubbles -effect hagar_explode -underwater -count 32 -type bubble -tex 62 62 -color 0x404040 0x808080 -size 3 3 -alpha 128 256 64 -gravity -0.125 -bounce 1.5 -liquidfriction 0.25 -originjitter 16 16 16 -velocityjitter 96 96 96 -// bouncing sparks -effect hagar_explode -notunderwater -count 32 -type spark -color 0x903010 0xFFD030 -size 2 2 -alpha 256 256 384 -gravity 1 -airfriction 0.2 -bounce 1.5 -liquidfriction 0.8 -velocityoffset 0 0 80 -velocityjitter 256 256 256 - - - -effect rocketlauncher_muzzleflash -count 5 -type smoke -color 0x202020 0x404040 -tex 0 8 -size 5 5 -alpha 256 256 256 -airfriction 6 -originjitter 1.5 1.5 1.5 -velocityjitter 40 40 40 -velocitymultiplier 0.03 -//lightradius 200 -//lightradiusfade 2000 -//lightcolor 2 1.5 0.2 -effect rocketlauncher_muzzleflash -count 30 -type spark -tex 40 40 -color 0xFFFDD9 0xFFFDD9 -size 3 3 -alpha 0 128 1024 -originjitter 1 1 1 -velocityjitter 300 300 300 -velocitymultiplier 0.5 -airfriction 12 - - - -// rocket trail -// smoke -effect TR_ROCKET -trailspacing 6 -type smoke -color 0x303030 0x606060 -tex 0 8 -size 7 7 -alpha 32 32 32 -lightradius 150 -lighttime 0 -lightcolor 6 3 1 -// fire -effect TR_ROCKET -notunderwater -trailspacing 6 -type static -color 0x805010 0xFFA020 -tex 0 8 -size 6 6 -alpha 144 144 288 -airfriction 8 -velocityjitter 32 32 32 -velocitymultiplier -0.5 -// bubbles -effect TR_ROCKET -underwater -trailspacing 8 -type bubble -tex 62 62 -color 0x404040 0x808080 -size 1 1 -alpha 256 256 256 -gravity -0.125 -bounce 1.5 -liquidfriction 4 -velocityjitter 16 16 16 -// sparks -effect TR_ROCKET -trailspacing 10 -type spark -tex 40 40 -color 0xFFFDD9 0xFFFDD9 -size 2 2 -alpha 444 512 1866 -gravity 1 -bounce 1 -velocityoffset 0 0 15 -airfriction 12 -originjitter 1 1 1 -velocityjitter 200 200 200 -velocitymultiplier -0.5 - - - -// rocket explosion (bigger than mortar and hagar) -// decal -effect rocket_explode -countabsolute 1 -type decal -tex 8 16 -size 72 72 -alpha 256 256 0 -originjitter 40 40 40 -lightradius 400 -lightradiusfade 400 -lightcolor 8 4 1 -// flare effect -effect rocket_explode -countabsolute 1 -type static -tex 35 37 -color 0x404040 0x404040 -size 72 72 -alpha 192 192 64 -// fire effect -effect rocket_explode -notunderwater -count 256 -type static -tex 48 55 -color 0x902010 0xFFD080 -size 16 16 -alpha 128 128 256 -bounce 1.5 -airfriction 4 -liquidfriction 4 -originjitter 8 8 8 -velocityjitter 512 512 512 -// underwater bubbles -effect rocket_explode -underwater -count 64 -type bubble -tex 62 62 -color 0x404040 0x808080 -size 3 3 -alpha 128 256 64 -gravity -0.125 -bounce 1.5 -liquidfriction 0.25 -originjitter 16 16 16 -velocityjitter 144 144 144 -// bouncing sparks -effect rocket_explode -notunderwater -count 128 -type spark -color 0x903010 0xFFD030 -size 2 2 -alpha 256 256 384 -gravity 1 -airfriction 0.2 -bounce 1.5 -liquidfriction 0.8 -velocityoffset 0 0 80 -velocityjitter 384 384 384 - - - -effect grapple_muzzleflash -lightradius 160 -lightradiusfade 800 -lightcolor 1 0 0 - - - -effect grapple_impact -lightradius 160 -lightradiusfade 800 -lightcolor 1 0 0 - - - -effect misc_laser_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0xff0000 0xff0000 -sizeincrease 1 - -effect misc_laser_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - - - -effect misc_laser_beam_fast -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 640 -color 0xff0000 0xff0000 -sizeincrease 0.1 - -effect misc_laser_beam_fast_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -// additional laser colors (mike) -effect misc_laser_green_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0x00ff00 0x00ff00 -sizeincrease 1 - -effect misc_laser_green_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_blue_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0x0000ff 0x0000ff -sizeincrease 1 - -effect misc_laser_blue_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_yellow_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0xffff00 0xffff00 -sizeincrease 1 - -effect misc_laser_yellow_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_cyan_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0x00ffff 0x00ffff -sizeincrease 1 - -effect misc_laser_cyan_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_magenta_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0xff00ff 0xff00ff -sizeincrease 1 - -effect misc_laser_magenta_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_white_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0xffffff 0xffffff -sizeincrease 1 - -effect misc_laser_white_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_black_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0x000000 0x000000 -sizeincrease 1 - -effect misc_laser_black_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - -effect misc_laser_orange_beam -countabsolute 1 -type beam -tex 60 60 -size 1 1 -alpha 256 256 64 -color 0xff6600 0xff6600 -sizeincrease 1 - -effect misc_laser_orange_beam_end -count 1 -type spark -color 0x8f4333 0xfff31b -size 0.4 0.4 -alpha 128 256 768 -gravity 1 -bounce -1 -velocityjitter 64 64 64 -velocitymultiplier 100 - - - - -// bigger crylink impact effect -// decal -effect crylink_impactbig -countabsolute 1 -type decal -tex 47 47 -size 24 24 -alpha 256 256 0 -originjitter 12 12 12 -//lightradius 200 -//lightradiusfade 800 -//lightcolor 3.2 0.4 4 -// purple flare effect -effect crylink_impactbig -countabsolute 1 -type static -tex 39 39 -color 0x504060 0x504060 -size 24 24 -alpha 256 256 512 -// purple sparks -effect crylink_impactbig -count 80 -type spark -tex 41 41 -color 0xA040C0 0xA040C0 -bounce 2 -size 6 6 -alpha 256 256 1024 -velocityjitter 512 512 512 -// purple splash -effect crylink_impactbig -count 3 -type static -color 0xE070FF 0xE070FF -size 16 16 -alpha 256 256 512 -velocityjitter 32 32 32 -// purple splash -effect crylink_impactbig -count 6 -type static -color 0xE070FF 0xE070FF -size 16 16 -alpha 256 256 1024 -velocityjitter 256 256 256 - -// Zero-violence effects - -// impact effect indicating damage -effect damage_hit -count 1 -type static -color 0x20FF30 0x80FFC0 -size 1 1 -alpha 256 256 256 -gravity -0.4 -bounce 1.5 -airfriction 8 -liquidfriction 16 -//velocityoffset 0 0 120 -velocityjitter 16 16 16 - -// effect for removing player model -// "teleport" -effect damage_dissolve -count 96 -type static -color 0x66FF66 0xFFFFFF -size 10 10 -alpha 64 128 128 -airfriction 1 -liquidfriction 4 -originoffset 0 0 28 -originjitter 16 16 28 -velocityjitter 0 0 256 -// flare -effect damage_dissolve -countabsolute 1 -type static -tex 38 38 -color 0x00FF00 0x99FF99 -size 32 32 -alpha 256 256 196 -// large sparks -effect damage_dissolve -count 20 -type static -color 0x00FF00 0x99FF99 -size 16 16 -alpha 256 256 256 -//gravity 1 -bounce 1.5 -airfriction 4 -liquidfriction 16 -//velocityoffset 0 0 120 -velocityjitter 512 512 512 - - diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 78ba5d38f..9a96e80f6 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -434,6 +434,8 @@ void(float bIsNewEntity) CSQC_Ent_Update = Ent_ReadPlayerScore(); else if(self.enttype == ENT_CLIENT_TEAMSCORES) Ent_ReadTeamScore(); + else if(self.enttype == ENT_CLIENT_POINTPARTICLES) + Ent_PointParticles(); else error("unknown entity type in CSQC_Ent_Update\n"); diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 4626fc0a4..237a9acaf 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -1,5 +1,7 @@ //include "main.qh" +float drawtime; + void CSQC_common_hud(void); void CSQC_kh_hud(void); @@ -8,6 +10,11 @@ void PostInit(void); float Sbar_WouldDrawScoreboard (); void CSQC_UpdateView(void) { + entity e; + + drawframetime = time - drawtime; + drawtime = time; + // watch for gametype changes here... // in ParseStuffCMD the cmd isn't executed yet :/ // might even be better to add the gametype to TE_CSQC_INIT...? @@ -52,7 +59,12 @@ void CSQC_UpdateView(void) R_AddEntities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS); // Render the Scene - Draw_GrapplingHook(); + + e = self; + for(self = world; (self = nextent(self)); ) + if(self.draw) + self.draw(); + self = e; R_RenderScene(); // Draw the mouse cursor diff --git a/data/qcsrc/client/csqc_builtins.qc b/data/qcsrc/client/csqc_builtins.qc index cef8dbaa1..22cf2e373 100644 --- a/data/qcsrc/client/csqc_builtins.qc +++ b/data/qcsrc/client/csqc_builtins.qc @@ -110,7 +110,7 @@ string (float i) modelnameforindex = #334; float(string efname) particleeffectnum = #335; void(entity ent, float effectnum, vector start, vector end, ...) trailparticles = #336; -void (float efnum, vector org, vector vel, float countmultiplier) pointparticles = #337; +void (float efnum, vector org, vector vel, float countmultiplier, ...) pointparticles = #337; void (string s, ...) cprint = #338; void (string s, ...) print = #339; diff --git a/data/qcsrc/client/csqc_constants.qc b/data/qcsrc/client/csqc_constants.qc index d6c6f8ec8..82b758649 100644 --- a/data/qcsrc/client/csqc_constants.qc +++ b/data/qcsrc/client/csqc_constants.qc @@ -187,3 +187,10 @@ const float DRAWFLAG_ADDITIVE = 1; const float DRAWFLAG_MODULATE = 2; const float DRAWFLAG_2XMODULATE = 3; const float DRAWFLAG_NUMFLAGS = 4; + +#define SOLID_NOT 0 // no interaction with other objects +#define SOLID_TRIGGER 1 // touch on edge, but not blocking +#define SOLID_BBOX 2 // touch on edge, block +#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground +#define SOLID_BSP 4 // bsp clip, touch on edge, block +#define SOLID_CORPSE 5 // same as SOLID_BBOX, except it behaves as SOLID_NOT against SOLID_SLIDEBOX objects (players/monsters) diff --git a/data/qcsrc/client/hook.qc b/data/qcsrc/client/hook.qc index c33362e1f..eb147600e 100644 --- a/data/qcsrc/client/hook.qc +++ b/data/qcsrc/client/hook.qc @@ -1,32 +1,6 @@ .vector HookStart; .vector HookEnd; .float HookKillTime; -void Net_GrapplingHook() -{ - float i; - vector start, end; - entity p; - - i = ReadShort(); - end_x = ReadCoord(); - end_y = ReadCoord(); - end_z = ReadCoord(); - start_x = ReadCoord(); - start_y = ReadCoord(); - start_z = ReadCoord(); - - if(i <= 0 || i >= 256) // not owned by a client - return; - --i; - - p = playerslots[i]; - if(!p) - return; - - p.HookKillTime = time + 0.1; - p.HookStart = start; - p.HookEnd = end; -} void Draw_GrapplingHookLine(vector from, vector to, float thickness, vector org, vector view_forward, string texture, float aspect, vector rgb) { @@ -61,55 +35,75 @@ void Draw_GrapplingHookLine(vector from, vector to, float thickness, vector org, void Draw_GrapplingHook() { - float i; vector a, b, o; - entity e; string tex; vector rgb; o = pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT); makevectors(input_angles); - for(i = 0; i < 255; ++i) + if(time >= self.HookKillTime) + return; + if(self.sv_entnum == player_localentnum - 1) + a = o + v_forward * 8 - v_right * 8 + v_up * -12; + else + a = self.HookStart; + b = self.HookEnd; + if(self.team == COLOR_TEAM1) + { + tex = "particles/hook_red"; + rgb = '1 .3 .3'; + } + else if(self.team == COLOR_TEAM2) + { + tex = "particles/hook_blue"; + rgb = '.3 .3 1'; + } + else if(self.team == COLOR_TEAM3) { - e = playerslots[i]; - if(!e) - continue; - if(time >= e.HookKillTime) - continue; - if(i == player_localentnum - 1) - a = o + v_forward * 8 - v_right * 8 + v_up * -12; - else - a = e.HookStart; - b = e.HookEnd; - if(e.team == COLOR_TEAM1) - { - tex = "particles/hook_red"; - rgb = '1 .3 .3'; - } - else if(e.team == COLOR_TEAM2) - { - tex = "particles/hook_blue"; - rgb = '.3 .3 1'; - } - else if(e.team == COLOR_TEAM3) - { - tex = "particles/hook_yellow"; - rgb = '1 1 .3'; - } - else if(e.team == COLOR_TEAM4) - { - tex = "particles/hook_pink"; - rgb = '1 .3 1'; - } - else - { - tex = "particles/hook_green"; - rgb = '.3 1 .3'; - } - if(checkextension("DP_SV_WRITEPICTURE")) - Draw_GrapplingHookLine(b, a, 8, o, v_forward, tex, 0.25, '1 1 1'); - else - Draw_GrapplingHookLine(b, a, 1, o, v_forward, "", 0.25, rgb); + tex = "particles/hook_yellow"; + rgb = '1 1 .3'; } + else if(self.team == COLOR_TEAM4) + { + tex = "particles/hook_pink"; + rgb = '1 .3 1'; + } + else + { + tex = "particles/hook_green"; + rgb = '.3 1 .3'; + } + if(checkextension("DP_SV_WRITEPICTURE")) + Draw_GrapplingHookLine(b, a, 8, o, v_forward, tex, 0.25, '1 1 1'); + else + Draw_GrapplingHookLine(b, a, 1, o, v_forward, "", 0.25, rgb); +} + +void Net_GrapplingHook() +{ + float i; + vector start, end; + entity p; + + i = ReadShort(); + end_x = ReadCoord(); + end_y = ReadCoord(); + end_z = ReadCoord(); + start_x = ReadCoord(); + start_y = ReadCoord(); + start_z = ReadCoord(); + + if(i <= 0 || i >= 256) // not owned by a client + return; + --i; + + p = playerslots[i]; + if(!p) + return; + + p.HookKillTime = time + 0.1; + p.HookStart = start; + p.HookEnd = end; + p.draw = Draw_GrapplingHook; } diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index 442819606..f84e3ae19 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -107,3 +107,6 @@ entity playerslots[255]; // 255 is engine limit on maxclients entity teamslots[17]; // 17 teams (including "spectator team") .float gotscores; .entity owner; + +.void(void) draw; +float drawframetime; diff --git a/data/qcsrc/client/progs.src b/data/qcsrc/client/progs.src index 5d9c5ecc9..d891b7638 100644 --- a/data/qcsrc/client/progs.src +++ b/data/qcsrc/client/progs.src @@ -22,6 +22,7 @@ sbar.qc mapvoting.qc hook.qc +particles.qc Main.qc View.qc diff --git a/data/qcsrc/common/constants.qh b/data/qcsrc/common/constants.qh index 801629a43..7d8abc2ee 100644 --- a/data/qcsrc/common/constants.qh +++ b/data/qcsrc/common/constants.qh @@ -11,7 +11,8 @@ // Revision 10: scoreboard force // Revision 11: scoreboard unforce; spectator support beginning // Revision 12: smaller scores updates (SERVER: requires new engine) -#define CSQC_REVISION 12 +// Revision 12: pointparticles +#define CSQC_REVISION 13 // probably put these in common/ // so server/ and client/ can be synced better @@ -38,6 +39,7 @@ const float ENT_CLIENT_ENTCS = 2; const float ENT_CLIENT_SCORES_INFO = 3; const float ENT_CLIENT_SCORES = 4; const float ENT_CLIENT_TEAMSCORES = 5; +const float ENT_CLIENT_POINTPARTICLES = 6; /////////////////////////// // key constants diff --git a/data/qcsrc/server/g_triggers.qc b/data/qcsrc/server/g_triggers.qc index 39e561c01..7a58e5e73 100644 --- a/data/qcsrc/server/g_triggers.qc +++ b/data/qcsrc/server/g_triggers.qc @@ -486,40 +486,59 @@ void spawnfunc_func_stardust() { } -/* -void sparksthink() -{ - self.nextthink = time + 0.1; - - if(random() < self.wait) { - te_spark(self.origin,'0 0 -1',self.cnt); - } +float pointparticles_SendEntity(entity to) +{ + WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES); + WriteShort(MSG_ENTITY, self.modelindex); + WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x); + WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y); + WriteCoord(MSG_ENTITY, self.origin_z + self.mins_z); + WriteCoord(MSG_ENTITY, self.maxs_x - self.mins_x); + WriteCoord(MSG_ENTITY, self.maxs_y - self.mins_y); + WriteCoord(MSG_ENTITY, self.maxs_z - self.mins_z); + WriteShort(MSG_ENTITY, self.cnt); + WriteCoord(MSG_ENTITY, self.impulse); + WriteCoord(MSG_ENTITY, self.velocity_x); + WriteCoord(MSG_ENTITY, self.velocity_y); + WriteCoord(MSG_ENTITY, self.velocity_z); + WriteCoord(MSG_ENTITY, self.waterlevel); + WriteCoord(MSG_ENTITY, self.count); + WriteByte(MSG_ENTITY, self.glow_color); + WriteString(MSG_ENTITY, self.noise); + return 1; } - -void func_sparks() +void spawnfunc_func_sparks() { - self.think = sparksthink; - self.nextthink = time + 0.2; + // self.cnt is the amount of sparks that one burst will spawn + if(self.cnt < 1) { + self.cnt = 25.0; // nice default value + } - // self.cnt is the amount of sparks that one burst will spawn - if(self.cnt < 1) { - self.cnt = 25.0; // nice default value - } + // self.wait is the probability that a sparkthink will spawn a spark shower + // range: 0 - 1, but 0 makes little sense, so... + if(self.wait < 0.05) { + self.wait = 0.25; // nice default value + } - // self.wait is the probability that a sparkthink will spawn a spark shower - // range: 0 - 1, but 0 makes little sense, so... - if(self.wait < 0.05) { - self.wait = 0.25; // nice default value - } + // sound + if(self.noise) + precache_sound (self.noise); - // sound - if(self.noise) { - precache_sound (self.noise); - ambientsound (self.origin, self.noise, VOL_BASE, ATTN_STATIC); - } + self.effects = EF_NODEPTHTEST; + self.SendEntity = pointparticles_SendEntity; + self.Version = 1; + self.modelindex = 1; + self.model = "net_entity"; + + self.count = self.cnt; + self.mins = '0 0 0'; + self.maxs = '0 0 0'; + self.velocity = '0 0 -1'; + self.cnt = particleeffectnum("TE_SPARK"); + self.impulse = 0.1 / self.wait; } -*/ + void rain_think() { self.nextthink = time + 0.1; -- 2.39.2