From 3fd27395e8bbecb1eb4964533f3b2564a813461b Mon Sep 17 00:00:00 2001 From: Harry Young Date: Wed, 7 Dec 2011 00:12:33 +0100 Subject: [PATCH] Defined FX_AddLine3 and other minor things Signed-off-by: Harry Young --- cgame/cg_env.c | 10 +++++----- cgame/fx_lib.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ game/g_fx.c | 36 +++++++++++++++++------------------ game/g_spawn.c | 42 +++++++++++++++++++++-------------------- 4 files changed, 96 insertions(+), 43 deletions(-) diff --git a/cgame/cg_env.c b/cgame/cg_env.c index 734b689..6028469 100644 --- a/cgame/cg_env.c +++ b/cgame/cg_env.c @@ -1322,13 +1322,13 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, flo 200, cgs.media.waterDropShader ); - /*FX_AddLine3( start, end, + FX_AddLine3( start, end, 1.0f, 3.0f, 5.0f, alpha, 0.0f, laserRGB, laserRGB, 125, - cgs.media.whiteLaserShader );*/ /* FIXME: FX_AddLine3 not defined */ + cgs.media.whiteLaserShader ); /* FIXME: FX_AddLine3 not defined */ FX_AddLine( start, end, 1.0f, @@ -1398,16 +1398,16 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, flo //------------------------------------------------------------------------------ void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal ) { - //vec3_t lRGB = {1.0,0.0,0.0}; + vec3_t lRGB = {1.0,0.0,0.0}; // Beam - /*FX_AddLine3( start, end, + FX_AddLine3( start, end, 1.0f, 5.5f, 5.0f, random() * 0.2 + 0.2, 0.1f, lRGB, lRGB, 150, - cgs.media.whiteLaserShader );*/ /* FIXME: FX_AddLine3 not defined */ + cgs.media.whiteLaserShader ); /* FIXME: FX_AddLine3 not defined */ FX_AddLine( start, end, 1.0f, diff --git a/cgame/fx_lib.c b/cgame/fx_lib.c index 3d41c45..83b73dc 100644 --- a/cgame/fx_lib.c +++ b/cgame/fx_lib.c @@ -121,6 +121,57 @@ localEntity_t *FX_AddLine2(vec3_t start, vec3_t end, float stScale, float width1 return(le); } + + +localEntity_t *FX_AddLine3(vec3_t start, vec3_t end, float stScale, float scale, float dscale, + float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float killTime, qhandle_t shader) +{ + localEntity_t *le; + +#ifdef _DEBUG + if (!shader) + { + Com_Printf("FX_AddLine2: NULL shader\n"); + } +#endif + + le = CG_AllocLocalEntity(); + le->leType = LE_LINE2; + + le->startTime = cg.time; + le->endTime = le->startTime + killTime; + le->data.line.width = scale; + le->data.line.dwidth = dscale; + + le->alpha = startalpha; + le->dalpha = endalpha - startalpha; + VectorCopy(startRGB, le->data.line2.startRGB); + VectorSubtract(endRGB, startRGB, le->data.line2.dRGB); + + le->refEntity.data.line.stscale = stScale; + le->refEntity.data.line.width = scale; + + le->refEntity.customShader = shader; + + // set origin + VectorCopy ( start, le->refEntity.origin); + VectorCopy ( end, le->refEntity.oldorigin ); + + AxisClear(le->refEntity.axis); + le->refEntity.shaderRGBA[0] = 0xff; + le->refEntity.shaderRGBA[1] = 0xff; + le->refEntity.shaderRGBA[2] = 0xff; + le->refEntity.shaderRGBA[3] = 0xff; + + le->color[0] = startRGB[0]; + le->color[1] = startRGB[1]; + le->color[2] = startRGB[2]; + le->color[3] = startalpha; + le->lifeRate = 1.0 / ( le->endTime - le->startTime ); + + return(le); +} + localEntity_t *FX_AddOrientedLine(vec3_t start, vec3_t end, vec3_t normal, float stScale, float scale, float dscale, float startalpha, float endalpha, float killTime, qhandle_t shader) { diff --git a/game/g_fx.c b/game/g_fx.c index 2f2f183..5319cf1 100644 --- a/game/g_fx.c +++ b/game/g_fx.c @@ -1077,7 +1077,7 @@ Emits slowly moving steam puffs that rise up from the specified point */ //------------------------------------------ -/*void cooking_steam_think( gentity_t *ent ) +void cooking_steam_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_COOKING_STEAM, 0 ); ent->nextthink = level.time + 100; @@ -1128,7 +1128,7 @@ void SP_fx_cooking_steam( gentity_t *ent ) } VectorCopy( ent->s.origin, ent->s.pos.trBase ); -}*/ +} /*QUAKED fx_elecfire (0 0 1) (-8 -8 -8) (8 8 8) Emits sparks at the specified point in the specified direction @@ -1179,7 +1179,7 @@ Emits freaky orange bolts, sending pulses down the length of the beam if desired */ //------------------------------------------ -/*void forge_bolt_think( gentity_t *ent ) +void forge_bolt_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_FORGE_BOLT, ent->spawnflags & 2 ); ent->nextthink = level.time + (ent->wait + crandom() * ent->wait * 0.25) * 1000; @@ -1303,7 +1303,7 @@ void SP_fx_forge_bolt( gentity_t *ent ) } trap_LinkEntity( ent ); -}*/ +} /*QUAKED fx_plasma (0 0 1) (-8 -8 -8) (8 8 8) START_OFF Emits plasma jet directed from the specified point to the specified point. Jet size scales based on length. @@ -1319,7 +1319,7 @@ Emits plasma jet directed from the specified point to the specified point. Jet s */ //------------------------------------------ -/*void plasma_think( gentity_t *ent ) +void plasma_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_PLASMA, 0 ); ent->nextthink = level.time + 100; @@ -1439,7 +1439,7 @@ void SP_fx_plasma( gentity_t *ent ) ent->think = plasma_link; ent->nextthink = level.time + 500; -}*/ +} /*QUAKED fx_energy_stream (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF Creates streaming particles that travel between two points--for Stasis level. ONLY orients vertically. @@ -1450,7 +1450,7 @@ Creates streaming particles that travel between two points--for Stasis level. ON */ //------------------------------------------ -/*void stream_think( gentity_t *ent ) +void stream_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_STREAM, 0 ); ent->nextthink = level.time + 150; @@ -1547,7 +1547,7 @@ void SP_fx_stream( gentity_t *ent ) ent->nextthink = level.time + 1000; trap_LinkEntity( ent ); -}*/ +} /*QUAKED fx_transporter_stream (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF Creates streaming particles that travel between two points--for forge level. @@ -1558,7 +1558,7 @@ Creates streaming particles that travel between two points--for forge level. */ //------------------------------------------ -/*void transporter_stream_think( gentity_t *ent ) +void transporter_stream_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_TRANSPORTER_STREAM, 0 ); ent->nextthink = level.time + 150; @@ -1631,7 +1631,7 @@ void SP_fx_transporter_stream( gentity_t *ent ) ent->nextthink = 1000; trap_LinkEntity( ent ); -}*/ +} /*QUAKED fx_explosion_trail (0 0 1) (-8 -8 -8) (8 8 8) Creates a triggerable explosion aimed at a specific point. Always oriented towards viewer. @@ -1643,7 +1643,7 @@ Creates a triggerable explosion aimed at a specific point. Always oriented towa */ //------------------------------------------ -/*void explosion_trail_use( gentity_t *self, gentity_t *other, gentity_t *activator) +void explosion_trail_use( gentity_t *self, gentity_t *other, gentity_t *activator) { G_AddEvent( self, EV_FX_EXPLOSION_TRAIL, 0 ); } @@ -1687,7 +1687,7 @@ void SP_fx_explosion_trail( gentity_t *ent ) //ent->svFlags |= SVF_BROADCAST; trap_LinkEntity( ent ); -}*/ +} /*QUAKED fx_borg_energy_beam (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF CONE A borg tracing beam that either carves out a cone or swings like a pendulum, sweeping across an area. @@ -1704,7 +1704,7 @@ CONE - Beam traces a cone, default trace shape is a pendulum, sweeping across an */ //------------------------------------------ -/*void borg_energy_beam_think( gentity_t *ent ) +void borg_energy_beam_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_BORG_ENERGY_BEAM, 0 ); ent->nextthink = level.time + 100; @@ -1796,7 +1796,7 @@ void SP_fx_borg_energy_beam( gentity_t *ent ) ent->nextthink = 1000; trap_LinkEntity( ent ); -}*/ +} /*QUAKED fx_shimmery_thing (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF TAPER Creates a shimmering cone or cylinder of colored light that stretches between two points. Looks like a teleporter type thing. @@ -1813,7 +1813,7 @@ Creates a shimmering cone or cylinder of colored light that stretches between tw */ //------------------------------------------ -/*void shimmery_thing_think( gentity_t *ent ) +void shimmery_thing_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_SHIMMERY_THING, 0 ); if ( ent->wait >= 0 ) @@ -1895,7 +1895,7 @@ void SP_fx_shimmery_thing( gentity_t *ent ) ent->nextthink = level.time + 1000; trap_LinkEntity( ent ); -}*/ +} /*QUAKED fx_borg_bolt (0 0 1) (-8 -8 -8) (8 8 8) STARTOFF Emits yellow electric bolts from the specified point to the specified point. @@ -1908,7 +1908,7 @@ Emits showers of sparks if the endpoints are sufficiently close. */ //------------------------------------------ -/*void borg_bolt_think( gentity_t *ent ) +void borg_bolt_think( gentity_t *ent ) { G_AddEvent( ent, EV_FX_BORG_BOLT, 0 ); ent->nextthink = level.time + 100 + random() * 25; @@ -1983,4 +1983,4 @@ void SP_fx_borg_bolt( gentity_t *ent ) ent->nextthink = level.time + 1000; trap_LinkEntity( ent ); -}*/ \ No newline at end of file +} \ No newline at end of file diff --git a/game/g_spawn.c b/game/g_spawn.c index 6e29792..bca3498 100644 --- a/game/g_spawn.c +++ b/game/g_spawn.c @@ -199,6 +199,7 @@ void SP_misc_model_breakable(gentity_t *ent); void SP_misc_portal_camera(gentity_t *ent); void SP_misc_portal_surface(gentity_t *ent); void SP_misc_turret(gentity_t *base); +void SP_laser_arm(gentity_t *base); void SP_misc_ammo_station( gentity_t *ent ); void SP_shooter_rocket( gentity_t *ent ); @@ -237,16 +238,16 @@ void SP_fx_particleFire(gentity_t *ent); void SP_fx_fire(gentity_t *ent); // Additional ports from SP by Harry Young -//void SP_fx_cooking_steam( gentity_t *ent ); -//void SP_fx_electricfire( gentity_t *ent ); -//void SP_fx_forge_bolt( gentity_t *ent ); -//void SP_fx_plasma( gentity_t *ent ); -//void SP_fx_stream( gentity_t *ent ); -//void SP_fx_transporter_stream( gentity_t *ent ); -//void SP_fx_explosion_trail( gentity_t *ent ); -//void SP_fx_borg_energy_beam( gentity_t *ent ); -//void SP_fx_shimmery_thing( gentity_t *ent ); -//void SP_fx_borg_bolt( gentity_t *ent ); +void SP_fx_cooking_steam( gentity_t *ent ); +void SP_fx_electricfire( gentity_t *ent ); +void SP_fx_forge_bolt( gentity_t *ent ); +void SP_fx_plasma( gentity_t *ent ); +void SP_fx_stream( gentity_t *ent ); +void SP_fx_transporter_stream( gentity_t *ent ); +void SP_fx_explosion_trail( gentity_t *ent ); +void SP_fx_borg_energy_beam( gentity_t *ent ); +void SP_fx_shimmery_thing( gentity_t *ent ); +void SP_fx_borg_bolt( gentity_t *ent ); // new mover void SP_func_mover(gentity_t *ent); @@ -400,6 +401,7 @@ spawn_t spawns[] = { {"misc_portal_surface", SP_misc_portal_surface}, {"misc_portal_camera", SP_misc_portal_camera}, {"misc_turret", SP_misc_turret}, + {"misc_laser", SP_laser_arm}, {"misc_ammo_station", SP_misc_ammo_station}, {"shooter_rocket", SP_shooter_rocket}, @@ -432,16 +434,16 @@ spawn_t spawns[] = { {"fx_fire", SP_fx_fire}, // Additional ports from SP by Harry Young - //{"fx_cooking_steam", SP_fx_cooking_steam}, - //{"fx_elecfire", SP_fx_electricfire}, - //{"forge_bolt", SP_fx_forge_bolt}, - //{"fx_plasma", SP_fx_plasma}, - //{"fx_energy_stream", SP_fx_stream}, - //{"fx_transporter_stream", SP_fx_transporter_stream}, - //{"fx_explosion_trail", SP_fx_explosion_trail}, - //{"fx_borg_energy_beam", SP_fx_borg_energy_beam}, - //{"fx_shimmery_thing", SP_fx_shimmery_thing}, - //{"fx_borg_bolt", SP_fx_borg_bolt}, + {"fx_cooking_steam", SP_fx_cooking_steam}, + {"fx_elecfire", SP_fx_electricfire}, + {"forge_bolt", SP_fx_forge_bolt}, + {"fx_plasma", SP_fx_plasma}, + {"fx_energy_stream", SP_fx_stream}, + {"fx_transporter_stream", SP_fx_transporter_stream}, + {"fx_explosion_trail", SP_fx_explosion_trail}, + {"fx_borg_energy_beam", SP_fx_borg_energy_beam}, + {"fx_shimmery_thing", SP_fx_shimmery_thing}, + {"fx_borg_bolt", SP_fx_borg_bolt}, {"func_mover", SP_func_mover}, {"path_point", SP_path_point},