Skip to content

Commit

Permalink
update: new R_BeginPolygon beams, cleaner flak fire presentation, add…
Browse files Browse the repository at this point in the history
…ed glow map to artillery cannon. Refactored particle light source to Ion, EMP, and artillery projectiles.

+ fixed small issue with client-side vehicle bboxes to catch trailparticle hits.
  • Loading branch information
Subject9x committed Sep 18, 2024
1 parent e7d101d commit 977b4d2
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 25 deletions.
1 change: 1 addition & 0 deletions client/data/data_vehicles.qc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void( float dataID ) data_sync_new_vehicle={
}

self.skin = self.faction - 1;
self.solid = SOLID_SLIDEBOX;
self.data_type = DATA_VEHC;
self.deadflag = DEAD_NO;
self.critBits = 0;
Expand Down
28 changes: 16 additions & 12 deletions client/main/client_update_view.qc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ void(float w, float h, float menuView) CSQC_UpdateView =
// and engine viewmodel and engine networked entities with the viewdemol flag (MASK_ENGINEVIEWMODELS)

}

renderscene();

//DATA - Update local Client data vars from Server
Expand Down Expand Up @@ -216,6 +217,7 @@ void(float w, float h, float menuView) CSQC_UpdateView =

//Player has toggled 'Objectives' menu while in-mission.
ui_objective_frame(VIEW_ORG);

}
//HUD sound system
snd_hud_vfx_frame();
Expand All @@ -241,6 +243,7 @@ void(float w, float h, float menuView) CSQC_UpdateView =
if(ANM_FILE_STATUS == 1){
anm_execute_frame();
}


if( cvar("developer") ){

Expand All @@ -253,29 +256,30 @@ void(float w, float h, float menuView) CSQC_UpdateView =
//drawstring(porg + '1 -30', strcat("Player Origin: ", vtos(getpropertyvec(VF_ORIGIN))), '8 8 0', '0.85 0.85 0.85', 1, 0);
//version wille eventually be only displayed as needed.
gui_drawversion();
drawstring(VIEW_ORG + '0 24', sprintf("VF_SIZE = %s", vtos(getpropertyvec(VF_SIZE))), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 32', sprintf("W/H = %s", vtos([w,h])), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 24', sprintf("VF_SIZE = %s", vtos(getpropertyvec(VF_SIZE))), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 32', sprintf("W/H = %s", vtos([w,h])), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 40', sprintf("CLIENT_VIS_ORG = %s", vtos(CLIENT_vis_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 48', sprintf("VF_ORIGIN = %s", vtos(getpropertyvec(VF_ORIGIN))), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 56', sprintf("VF_ANGLES = %s", vtos(getpropertyvec(VF_ANGLES))), '8 8', '0.85 0.85 0.85', 1, 0);

local vector mpos;
mpos = getmousepos();
if(MENU_ACTIVE){
drawstring(VIEW_ORG + '0 64', sprintf("UI mouse = %0.2f %0.2f", mpos_x - UI_ORG_x, mpos_y - UI_ORG_y), '8 8', '0.85 0.85 0.85', 1, 0);
// drawstring(VIEW_ORG + '0 64', sprintf("UI mouse = %0.2f %0.2f", mpos_x - UI_ORG_x, mpos_y - UI_ORG_y), '8 8', '0.85 0.85 0.85', 1, 0);
}
else{
drawstring(VIEW_ORG + '0 64', sprintf("Hud offset = %s", vtos(CLIENT_server_ent.hud_StrutsOffset)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 64', sprintf("Hud offset = %s", vtos(CLIENT_server_ent.hud_StrutsOffset)), '8 8', '0.85 0.85 0.85', 1, 0);
}
drawstring(VIEW_ORG + '0 72', sprintf("CLIENT_VIS_ORG = %s", vtos(CLIENT_vis_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 80', sprintf("MECH org = %s", vtos(CLIENT_server_ent.rootOrigin)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 72', sprintf("DBG_PREDRAW_ORG = %s", vtos(CLIENT_server_ent.rootOrigin)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 72', sprintf("CLIENT_VIS_ORG = %s", vtos(CLIENT_vis_org)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 80', sprintf("MECH org = %s", vtos(CLIENT_server_ent.rootOrigin)), '8 8', '0.85 0.85 0.85', 1, 0);
// drawstring(VIEW_ORG + '0 72', sprintf("DBG_PREDRAW_ORG = %s", vtos(CLIENT_server_ent.rootOrigin)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 80', sprintf("pmove_org = %s", vtos(pmove_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 92', sprintf("torso org = %s", vtos(CLIENT_server_ent.torC_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 100', sprintf("left torso org = %s", vtos(CLIENT_server_ent.torL_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 108', sprintf("right torso org= %s", vtos(CLIENT_server_ent.torR_org)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 92', sprintf("torso org = %s", vtos(CLIENT_server_ent.torC_org)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 100', sprintf("left torso org = %s", vtos(CLIENT_server_ent.torL_org)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 108', sprintf("right torso org= %s", vtos(CLIENT_server_ent.torR_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 116', sprintf("left arm org = %s", vtos(CLIENT_server_ent.armL_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 124', sprintf("right arm org = %s", vtos(CLIENT_server_ent.armR_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 132', sprintf("legs org = %s", vtos(CLIENT_server_ent.legs_org)), '8 8', '0.85 0.85 0.85', 1, 0);
drawstring(VIEW_ORG + '0 124', sprintf("left arm angl = %s", vtos(CLIENT_server_ent.armL_angl)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 124', sprintf("right arm org = %s", vtos(CLIENT_server_ent.armR_org)), '8 8', '0.85 0.85 0.85', 1, 0);
//drawstring(VIEW_ORG + '0 132', sprintf("legs org = %s", vtos(CLIENT_server_ent.legs_org)), '8 8', '0.85 0.85 0.85', 1, 0);
}
};
14 changes: 14 additions & 0 deletions client/network/net_general.qc
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ vector( vector partOffset, .vector partAngles) predraw_unit_part_and_angle={
where parent.origin has already been calculated.
*/
void(entity item) predraw_unit_weapon={
local entity this;
local vector pOfs;
local vector drawAng;
local vector offset;
Expand Down Expand Up @@ -557,6 +558,19 @@ void(entity item) predraw_unit_weapon={
item.angles = T_PART_PARENT_ANGL;
}
addentity(item);

if(item.effect_beam){
if(item.beamActive){
this = self;
self = item;
item.effect_beam();
if(time > item.beamTime){
item.beamActive = FALSE;
}
self = this;
}
}

};

void(entity item) predraw_unit_weapon_tank={
Expand Down
8 changes: 8 additions & 0 deletions client/util/headers/particle_sys.qh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ float PTC_WRECK_SMOKE;
.float count1;
//.vector dest;

.void() effect_beam;
.float beamActive;
.vector beamOrg;
.vector beamEnd;
.float beamWidth;
.float beamTime;
//===================================

void() particle_sys_ini_globals;
Expand All @@ -171,6 +177,8 @@ vector() te_read_angle;
//AI voice selector
void( float randomBool ) ai_voice_ini;

void (vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg) Draw_CylindricLine;
void (vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg) Draw_CrossPlanesLine;

//ported from effectinfo_api
void( vector org, vector windVel ) te_mech_crit;
Expand Down
53 changes: 53 additions & 0 deletions client/util/particle_sys.qc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,59 @@ vector() te_read_angle={
return newa;
};

vector (vector a, vector b ) crossProduct={

local vector cross;
cross_x = (a_y * b_z) - (a_z * b_y);
cross_y = (a_z * b_x) - (a_x * b_z);
cross_z = (a_x * b_y) - (a_y * b_x);

return cross;
};

/**
pulled from Xonotic for very nice beams.
*/
void (vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg) Draw_CylindricLine={
// I want to draw a quad...
// from and to are MIDPOINTS.
local vector axis;
local vector thickdir;
local vector A;
local vector B;
local vector C;
local vector D;

local float length_tex;

axis = normalize(to - from);

length_tex = aspect * vlen(to - from) / thickness;

// direction is perpendicular to the view normal, and perpendicular to the axis

//Subject9x- somehow this is bugged in vanilla DP QC, or perhaps my code, but it doesn't auto-orient the way the func says it should.
// as a lame hack I've just made the polygon double sided.
thickdir = normalize( crossProduct(axis, vieworg - from) );

A = from - thickdir * (thickness / 2);
B = from + thickdir * (thickness / 2);
C = to + thickdir * (thickness / 2);
D = to - thickdir * (thickness / 2);

R_BeginPolygon(texture, drawflag, FALSE);
R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
//reverse order for primitive double-sided effect.
R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
R_EndPolygon();
};

/*
Ported from SSQC, ai_voice system now CSQC implemented, but
driven by SendEnt events.
Expand Down
38 changes: 37 additions & 1 deletion common/data/item/weapon/data_electro_repeater.qc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,35 @@ void() data_ini_attack_electro_repeater_;
#endif

#ifdef CSQC
void() te_beam_esr={
local vector bAngl;
local float segment;
local vector segOrg;
local vector nexOrg;
local float itr;
local float width;

bAngl = vectoangles(self.beamEnd - self.wepFireOffset);
bAngl_x = bAngl_x * -1;

makevectors(bAngl);

segment = rint(vlen(self.beamEnd - self.wepFireOffset) / 6);
segOrg = self.wepFireOffset;
width = self.beamWidth;

for( itr = 0; itr < 6; itr = itr + 1){
nexOrg = self.wepFireOffset + (v_forward * segment * itr) + (v_right * random() * 6) + (v_up * random() * 6);

Draw_CylindricLine(segOrg, nexOrg, width, "particles/electro_beam", 0.1, time * 0.1, '0.17 0.33 1.0', 1.0, DRAWFLAG_NORMAL | DRAWFLAG_MIPMAP, CLIENT_vis_org);

width = max(1, width - 1);

segOrg = nexOrg;
}
Draw_CylindricLine(segOrg, self.beamEnd, width, "particles/electro_beam", 0.1, time * 0.1, '0.17 0.33 1.0', 1.0, DRAWFLAG_NORMAL | DRAWFLAG_MIPMAP, CLIENT_vis_org);

};
void() te_muzzle_esr={
local vector startOrg;
local vector endOrg;
Expand All @@ -122,7 +151,7 @@ void() te_muzzle_esr={

sound7(self, CHAN_AUTO, self.fire_sound, 1, ATTN_NORM, (0.5 + (random() * 0.5)) * 175, 0 );

trailparticles( world, particleeffectnum("TE_ESR_RAIL"), startOrg, endOrg );
//trailparticles( world, particleeffectnum("TE_ESR_RAIL"), startOrg, endOrg );

if( particleDraw < PARTICLE_HAZ_DISTANCE / 2){
pointparticles( particleeffectnum("TE_ESR_MUZZLE"), startOrg, norm* 1, 1);
Expand All @@ -137,6 +166,12 @@ void() te_muzzle_esr={
pointparticles(PTC_HIT_DIRT_ENE_SML, endOrg, trace_plane_normal * -1, 1);
}
}

self.beamTime = time + 0.05;
self.beamOrg = startOrg;
self.beamEnd = endOrg;
self.beamWidth = 5.0;
self.beamActive = TRUE;
};
#endif
void() data_ini_electro_repeater_={
Expand Down Expand Up @@ -172,6 +207,7 @@ void() data_ini_electro_repeater_={
self.description = "+ Instant-impact weapon. + Rate of Fire spin up/cool down. + Damage reduced by 50% against <shields>";
self.icon = "gfx/ui/wep_icons/wi_esr.png";
self.itemMuzzleFlash = te_muzzle_esr;
self.effect_beam = te_beam_esr;
#endif

#ifdef SSQC
Expand Down
6 changes: 4 additions & 2 deletions common/data/item/weapon/data_flak_cannon.qc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ void() data_ini_attack_flak_={
local vector dir;
local float totes;
local float damage;

local float contents;

cacheSpread = self.spreadDefault;
self.spreadDefault = '0 0 0';

Expand Down Expand Up @@ -153,9 +154,10 @@ void() data_ini_attack_flak_={
pointparticles( particleeffectnum("TE_FLK_IMPACT"), trace_endpos + (v_forward * -16), dir * -4, 1);
}
}
else{
else if( (trace_dphitcontents & DPCONTENTS_SOLID) || (trace_dphitq3surfaceflags & DPCONTENTS_BODY) ){
pointparticles( particleeffectnum("TE_FLK_DIRT"), trace_endpos + (v_forward * -4), dir * -8, 1);
}

totes = totes - 1;
}
};
Expand Down
19 changes: 14 additions & 5 deletions common/data/item/weapon/data_light_laser.qc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ void() data_ini_attack_laser_;
#endif

#ifdef CSQC
void() te_beam_las={
Draw_CylindricLine(self.wepFireOffset, self.beamEnd, self.beamWidth, "particles/laserbeam", 0.5, time * (random() * -6), '1.0 0.33 0.67', 0.75, DRAWFLAG_NORMAL | DRAWFLAG_MIPMAP, CLIENT_vis_org);
};
void() te_muzzle_las={
local vector startOrg;
local vector endOrg;
Expand All @@ -35,17 +38,22 @@ void() te_muzzle_las={
else{
sound7(self, CHAN_AUTO, self.fire_sound, 1, ATTN_NORM, (0.45 + (random() * 0.55)) * 175, 0 );
}

trailparticles( world, particleeffectnum("TE_LAS_RAIL"), startOrg, endOrg );


self.beamTime = time + 0.2;
self.beamOrg = startOrg;
self.beamEnd = endOrg;
self.beamWidth = 3.0;
self.beamActive = TRUE;

//trailparticles( world, particleeffectnum("TE_LAS_RAIL"), startOrg, endOrg );
if( particleDraw < PARTICLE_HAZ_DISTANCE / 2){
impactStyle = te_impact_type(endOrg, trace_ent, trace_dphitcontents);
pointparticles( particleeffectnum("TE_LAS_MUZZLE"), startOrg, norm * -2, 1);
if(impactStyle == IMPACT_ARMOR){
pointparticles(particleeffectnum("TE_LAS_HIT"), endOrg + (v_forward * -2), norm, 1);
pointparticles(particleeffectnum("TE_LAS_HIT"), endOrg + (norm * -2), norm, 1);
}
else if(impactStyle == IMPACT_DIRT){
pointparticles(particleeffectnum("TE_LAS_DIRT"), endOrg + (v_forward * -2), norm, 1);
pointparticles(particleeffectnum("TE_LAS_DIRT"), endOrg + (norm * -2), norm, 1);
pointparticles(PTC_HIT_DIRT_ENE_SML, endOrg, trace_plane_normal * -1, 1);
}
}
Expand Down Expand Up @@ -82,6 +90,7 @@ void() data_ini_light_laser_={
self.description = "+ Instant-impact weapon. + bonus damage against <shields>.";
self.icon = "gfx/ui/wep_icons/wi_las.png";
self.itemMuzzleFlash = te_muzzle_las;
self.effect_beam = te_beam_las;
#endif

#ifdef SSQC
Expand Down
5 changes: 4 additions & 1 deletion common/data/projectiles/data_projectile_snub_artillery.qc
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ void() data_projectile_snub_artillery_touch_={
if( (trace_dpstartcontents & DPCONTENTS_SOLID) || (trace_dphitcontents & DPCONTENTS_SOLID) ){
self.impactType = IMPACT_DIRT;
debris = ceil(random() * 4);
data_projectile_snub_artillery_radiusDamage();
}
else if( (trace_dphitcontents & DPCONTENTS_SKY) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY) ){
debris = 0;
}
data_projectile_snub_artillery_radiusDamage();
}
if( debris > 0 ){
te_debris( self.origin, vectoangles(self.velocity), self.velocity, debris, min(3, rint(0.5+ (random() * 3))) );
Expand Down
10 changes: 6 additions & 4 deletions data_dir_backup/effectinfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,15 @@

//TE_LAS_RAIL
effect TE_LAS_RAIL
countabsolute 1
type beam
orientation beam
blend add
orientation beam
color 0xe1bee7 0xce93d8
tex 60 60
size 3 3
alpha 1024 1024 2048
alpha 256 256 256

//TE_LAS_HIT - SPARK
effect TE_LAS_HIT
Expand Down Expand Up @@ -1819,9 +1821,9 @@
//TE_SFGA_TRAIL - LIGHT
effect TE_SFGA_TRAIL
countabsolute 1
lightradius 5
lightradiusfade 100
lightcolor 0.996 0.392 0.18
lightradius 25
lightradiusfade 15
lightcolor 0.99 0.99 0.87
lightshadow 0
notunderwater

Expand Down

0 comments on commit 977b4d2

Please sign in to comment.