mirror of
https://github.com/UberGames/RPG-X2.git
synced 2025-02-02 13:11:25 +00:00
Merge branch 'master' of https://github.com/UberGames/RPG-X2
This commit is contained in:
commit
27c653a790
7 changed files with 241 additions and 13 deletions
217
cgame/cg_env.c
217
cgame/cg_env.c
|
@ -1230,6 +1230,223 @@ void CG_DisruptorFX(centity_t *cent) {
|
||||||
|
|
||||||
// Additional ports from SP by Harry Young
|
// Additional ports from SP by Harry Young
|
||||||
|
|
||||||
|
/*
|
||||||
|
===========================
|
||||||
|
Laser
|
||||||
|
|
||||||
|
Create directed laser shot
|
||||||
|
===========================
|
||||||
|
*/
|
||||||
|
void CG_SmallSpark( vec3_t origin, vec3_t normal )
|
||||||
|
{
|
||||||
|
vec3_t dir, direction, start, end, velocity;
|
||||||
|
float scale;
|
||||||
|
int numSparks;
|
||||||
|
|
||||||
|
AngleVectors( normal, normal, NULL, NULL );
|
||||||
|
|
||||||
|
int j;
|
||||||
|
for ( j = 0; j < 3; j ++ )
|
||||||
|
normal[j] = normal[j] + (0.1f * crandom());
|
||||||
|
|
||||||
|
VectorNormalize( normal );
|
||||||
|
|
||||||
|
numSparks = 6 + (random() * 4.0f );
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for ( i = 0; i < numSparks; i++ )
|
||||||
|
{
|
||||||
|
scale = 0.1f + (random() *0.2f );
|
||||||
|
|
||||||
|
for ( j = 0; j < 3; j ++ )
|
||||||
|
dir[j] = normal[j] + (0.7f * crandom());
|
||||||
|
|
||||||
|
VectorMA( origin, 0.0f + ( random() * 0.5f ), dir, start );
|
||||||
|
VectorMA( start, 1.0f + ( random() * 1.5f ), dir, end );
|
||||||
|
|
||||||
|
FX_AddLine( start,
|
||||||
|
end,
|
||||||
|
1.0f,
|
||||||
|
scale,
|
||||||
|
0.0f,
|
||||||
|
1.0f,
|
||||||
|
0.7f,
|
||||||
|
4.0f,
|
||||||
|
cgs.media.sparkShader );
|
||||||
|
}
|
||||||
|
|
||||||
|
VectorMA( origin, 1, normal, direction );
|
||||||
|
|
||||||
|
scale = 2.0f + (random() * 3.0f );
|
||||||
|
float alpha = 0.6f + (random() * 0.4f );
|
||||||
|
|
||||||
|
VectorSet( velocity, crandom() * 2, crandom() * 2, 8 + random() * 4 );
|
||||||
|
VectorMA( velocity, 5, normal, velocity );
|
||||||
|
|
||||||
|
FX_AddSprite( direction,
|
||||||
|
velocity,
|
||||||
|
qfalse,
|
||||||
|
scale,
|
||||||
|
scale,
|
||||||
|
alpha,
|
||||||
|
0.0f,
|
||||||
|
random() * 45.0f,
|
||||||
|
0.0f,
|
||||||
|
1000.0f,
|
||||||
|
cgs.media.steamShader );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qboolean hit_ent )
|
||||||
|
{
|
||||||
|
vec3_t dir, right, up, angles, work, pos,
|
||||||
|
sRGB, lRGB;
|
||||||
|
float scale = 1.0f, alpha;
|
||||||
|
int life = 0;
|
||||||
|
|
||||||
|
if ( !(FX_DetailLevel( start, 16, 1200 ) ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Orient the laser spray
|
||||||
|
VectorSubtract( end, start, dir );
|
||||||
|
VectorNormalize( dir );
|
||||||
|
alpha = Vector4to3( laserRGB, lRGB );
|
||||||
|
|
||||||
|
VectorMA( end, 0.5f, normal, pos );
|
||||||
|
MakeNormalVectors( normal, right, up );
|
||||||
|
|
||||||
|
VectorSet( sRGB, 1.0f, 0.8f, 0.8f );
|
||||||
|
|
||||||
|
FX_AddSprite2( start, NULL, qfalse,
|
||||||
|
1.75f, 1.0f,
|
||||||
|
alpha, 0.0f,
|
||||||
|
lRGB, lRGB,
|
||||||
|
0.0f,
|
||||||
|
0.0f,
|
||||||
|
200,
|
||||||
|
cgs.media.waterDropShader );
|
||||||
|
|
||||||
|
FX_AddLine3( start, end,
|
||||||
|
1.0f,
|
||||||
|
3.0f, 5.0f,
|
||||||
|
alpha, 0.0f,
|
||||||
|
lRGB, lRGB,
|
||||||
|
125,
|
||||||
|
cgs.media.whiteLaserShader );
|
||||||
|
|
||||||
|
FX_AddLine( start, end,
|
||||||
|
1.0f,
|
||||||
|
0.3f, 5.0f,
|
||||||
|
random() * 0.4 + 0.4, 0.1f,
|
||||||
|
125,
|
||||||
|
cgs.media.whiteLaserShader );
|
||||||
|
|
||||||
|
// Doing all of this extra stuff would look weird if it hits a player ent.
|
||||||
|
if ( !hit_ent )
|
||||||
|
{
|
||||||
|
FX_AddQuad2( pos, normal,
|
||||||
|
3.5f, 1.0f,
|
||||||
|
alpha, 0.0f,
|
||||||
|
lRGB, lRGB,
|
||||||
|
0.0f,
|
||||||
|
200,
|
||||||
|
cgs.media.waterDropShader );
|
||||||
|
int t;
|
||||||
|
for ( t=0; t < 2; t ++ )
|
||||||
|
{
|
||||||
|
VectorMA( pos, crandom() * 0.5f, right, work );
|
||||||
|
VectorMA( work, crandom() * 0.5f, up, work );
|
||||||
|
|
||||||
|
scale = crandom() * 0.5f + 1.75f;
|
||||||
|
life = crandom() * 300 + 2100;
|
||||||
|
|
||||||
|
VectorSet( sRGB, 1.0f, 0.7f, 0.2f );
|
||||||
|
FX_AddQuad2( work, normal,
|
||||||
|
scale, -0.1f,
|
||||||
|
1.0f, 0.0f,
|
||||||
|
sRGB, sRGB,
|
||||||
|
0,
|
||||||
|
life,
|
||||||
|
cgs.media.waterDropShader );
|
||||||
|
}
|
||||||
|
|
||||||
|
FX_AddQuad( pos, normal,
|
||||||
|
scale * 2.5f, 0.0f,
|
||||||
|
1.0f, 0.0f,
|
||||||
|
0,
|
||||||
|
life * 2,
|
||||||
|
cgs.media.smokeShader );
|
||||||
|
|
||||||
|
vectoangles( normal, angles );
|
||||||
|
CG_SmallSpark( end, angles );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// However, do add a little smoke puff
|
||||||
|
FX_AddSprite2( pos, NULL, qfalse,
|
||||||
|
2.0f, 1.0f,
|
||||||
|
alpha, 0.0f,
|
||||||
|
lRGB, lRGB,
|
||||||
|
0.0f,
|
||||||
|
0.0f,
|
||||||
|
200,
|
||||||
|
cgs.media.waterDropShader );
|
||||||
|
|
||||||
|
VectorMA( end, 1, normal, dir );
|
||||||
|
scale = 1.0f + (random() * 3.0f);
|
||||||
|
|
||||||
|
CG_Smoke( dir, normal, scale, 12.0f );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal )
|
||||||
|
{
|
||||||
|
vec3_t lRGB = {1.0,0.0,0.0};
|
||||||
|
|
||||||
|
// Beam
|
||||||
|
FX_AddLine3( start, end,
|
||||||
|
1.0f,
|
||||||
|
5.5f, 5.0f,
|
||||||
|
random() * 0.2 + 0.2, 0.1f,
|
||||||
|
lRGB, lRGB,
|
||||||
|
150,
|
||||||
|
cgs.media.whiteLaserShader );
|
||||||
|
|
||||||
|
FX_AddLine( start, end,
|
||||||
|
1.0f,
|
||||||
|
0.3f, 5.0f,
|
||||||
|
random() * 0.4 + 0.4, 0.1f,
|
||||||
|
125,
|
||||||
|
cgs.media.whiteLaserShader );
|
||||||
|
|
||||||
|
// Flare at the start point
|
||||||
|
FX_AddSprite( start, NULL, qfalse,
|
||||||
|
1.5 + random() * 4, 0.0,
|
||||||
|
0.1f,0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
100,
|
||||||
|
cgs.media.borgEyeFlareShader );
|
||||||
|
|
||||||
|
// endpoint flare
|
||||||
|
FX_AddSprite( end, NULL, qfalse,
|
||||||
|
2.5 + random() * 4, 0.0,
|
||||||
|
0.1f,0.0,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
100,
|
||||||
|
cgs.media.borgEyeFlareShader );
|
||||||
|
|
||||||
|
// oriented impact flare
|
||||||
|
FX_AddQuad( end, normal,
|
||||||
|
1.5 + random() * 2, 0.0,
|
||||||
|
1.0, 0.0,
|
||||||
|
0.0,
|
||||||
|
120,
|
||||||
|
cgs.media.borgEyeFlareShader );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
======================
|
======================
|
||||||
CG_CookingSteam
|
CG_CookingSteam
|
||||||
|
|
|
@ -2034,6 +2034,8 @@ void CG_Bolt( centity_t *cent );
|
||||||
void CG_TransporterPad(vec3_t origin);
|
void CG_TransporterPad(vec3_t origin);
|
||||||
void CG_Drip(centity_t *cent, int killTime );
|
void CG_Drip(centity_t *cent, int killTime );
|
||||||
void CG_Chunks( vec3_t origin, vec3_t dir, float size, material_type_t type );
|
void CG_Chunks( vec3_t origin, vec3_t dir, float size, material_type_t type );
|
||||||
|
void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qboolean hit_ent );
|
||||||
|
void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal );
|
||||||
|
|
||||||
//TiM
|
//TiM
|
||||||
void CG_FountainSpurt( vec3_t org, vec3_t end );
|
void CG_FountainSpurt( vec3_t org, vec3_t end );
|
||||||
|
|
|
@ -10,6 +10,8 @@ localEntity_t *FX_AddLine(vec3_t start, vec3_t end, float stScale, float scale,
|
||||||
float startalpha, float endalpha, float killTime, qhandle_t shader);
|
float startalpha, float endalpha, float killTime, qhandle_t shader);
|
||||||
localEntity_t *FX_AddLine2(vec3_t start, vec3_t end, float stScale, float width1, float dwidth1, float width2, float dwidth2,
|
localEntity_t *FX_AddLine2(vec3_t start, vec3_t end, float stScale, float width1, float dwidth1, float width2, float dwidth2,
|
||||||
float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float killTime, qhandle_t shader);
|
float startalpha, float endalpha, vec3_t startRGB, vec3_t endRGB, float killTime, qhandle_t shader);
|
||||||
|
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 *FX_AddOrientedLine(vec3_t start, vec3_t end, vec3_t normal, float stScale, float scale,
|
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);
|
float dscale, float startalpha, float endalpha, float killTime, qhandle_t shader);
|
||||||
localEntity_t *FX_AddTrail( vec3_t origin, vec3_t velocity, qboolean gravity, float length, float dlength,
|
localEntity_t *FX_AddTrail( vec3_t origin, vec3_t velocity, qboolean gravity, float length, float dlength,
|
||||||
|
@ -144,3 +146,8 @@ void FX_qFlash( centity_t* cent, vec3_t org, int timeIndex );
|
||||||
* sin table
|
* sin table
|
||||||
*/
|
*/
|
||||||
void fxRandCircumferencePos(vec3_t center, vec3_t normal, float radius, vec3_t out);
|
void fxRandCircumferencePos(vec3_t center, vec3_t normal, float radius, vec3_t out);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* fx-public ports
|
||||||
|
*/
|
||||||
|
float FX_DetailLevel( vec3_t origin, float near_clip, float far_clip );
|
||||||
|
|
|
@ -387,7 +387,7 @@ struct gentity_s {
|
||||||
qboolean luaEntity;
|
qboolean luaEntity;
|
||||||
#endif
|
#endif
|
||||||
vec4_t startRGBA;
|
vec4_t startRGBA;
|
||||||
vec4_t endRGBA;
|
vec4_t finalRGBA;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \enum clientConnected_t
|
/** \enum clientConnected_t
|
||||||
|
@ -720,6 +720,7 @@ qboolean G_SpawnString( const char *key, const char *defaultString, char **out )
|
||||||
qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out );
|
qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out );
|
||||||
qboolean G_SpawnInt( const char *key, const char *defaultString, int *out );
|
qboolean G_SpawnInt( const char *key, const char *defaultString, int *out );
|
||||||
qboolean G_SpawnVector( const char *key, const char *defaultString, float *out );
|
qboolean G_SpawnVector( const char *key, const char *defaultString, float *out );
|
||||||
|
qboolean G_SpawnVector4( const char *key, const char *defaultString, float *out );
|
||||||
void G_SpawnEntitiesFromString( void );
|
void G_SpawnEntitiesFromString( void );
|
||||||
char *G_NewString( const char *string );
|
char *G_NewString( const char *string );
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ field_t fields[] = {
|
||||||
{"luaEntity", FOFS(luaEntity), F_INT},
|
{"luaEntity", FOFS(luaEntity), F_INT},
|
||||||
#endif
|
#endif
|
||||||
{"startRGBA", FOFS(startRGBA), F_VECTOR4},
|
{"startRGBA", FOFS(startRGBA), F_VECTOR4},
|
||||||
{"endRGBA", FOFS(endRGBA), F_VECTOR4},
|
{"finalRGBA", FOFS(finalRGBA), F_VECTOR4},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
//extern cvar_t *g_spskill;
|
//extern cvar_t *g_spskill;
|
||||||
|
|
||||||
//client side shortcut hacks from cg_local.h
|
//client side shortcut hacks from cg_local.h
|
||||||
//extern void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qboolean hit_ent );
|
extern void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qboolean hit_ent );
|
||||||
//extern void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal );
|
extern void CG_AimLaser( vec3_t start, vec3_t end, vec3_t normal );
|
||||||
|
|
||||||
|
|
||||||
#define ARM_ANGLE_RANGE 60
|
#define ARM_ANGLE_RANGE 60
|
||||||
|
@ -808,7 +808,7 @@ void SP_misc_turret (gentity_t *base)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*void laser_arm_fire (gentity_t *ent)
|
void laser_arm_fire (gentity_t *ent)
|
||||||
{
|
{
|
||||||
vec3_t start, end, fwd, rt, up;
|
vec3_t start, end, fwd, rt, up;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
@ -919,7 +919,7 @@ void laser_arm_use (gentity_t *self, gentity_t *other, gentity_t *activator)
|
||||||
G_Sound( self->lastEnemy->lastEnemy, G_SoundIndex( "sound/enemies/l_arm/move.wav" ) );
|
G_Sound( self->lastEnemy->lastEnemy, G_SoundIndex( "sound/enemies/l_arm/move.wav" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
/*QUAKED misc_laser_arm (1 0 0) (-8 -8 -8) (8 8 8)
|
/*QUAKED misc_laser_arm (1 0 0) (-8 -8 -8) (8 8 8)
|
||||||
|
|
||||||
|
@ -941,12 +941,12 @@ What it does when used depends on it's "count" (can be set by a script)
|
||||||
"startRGBA" - laser color, Red Green Blue Alpha, range 0 to 1 (default 1.0 0.85 0.15 0.75 = Yellow-Orange)
|
"startRGBA" - laser color, Red Green Blue Alpha, range 0 to 1 (default 1.0 0.85 0.15 0.75 = Yellow-Orange)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*void laser_arm_start (gentity_t *base)
|
void laser_arm_start (gentity_t *base)
|
||||||
{
|
{
|
||||||
vec3_t armAngles;
|
vec3_t armAngles;
|
||||||
vec3_t headAngles;
|
vec3_t headAngles;
|
||||||
|
|
||||||
base->e_ThinkFunc = thinkF_NULL;
|
base->think = 0;
|
||||||
//We're the base, spawn the arm and head
|
//We're the base, spawn the arm and head
|
||||||
gentity_t *arm = G_Spawn();
|
gentity_t *arm = G_Spawn();
|
||||||
gentity_t *head = G_Spawn();
|
gentity_t *head = G_Spawn();
|
||||||
|
@ -991,7 +991,7 @@ What it does when used depends on it's "count" (can be set by a script)
|
||||||
{
|
{
|
||||||
base->speed *= FRAMETIME/1000.0f;
|
base->speed *= FRAMETIME/1000.0f;
|
||||||
}
|
}
|
||||||
base->e_UseFunc = useF_laser_arm_use;
|
base->use = laser_arm_use;
|
||||||
base->nextthink = level.time + FRAMETIME;
|
base->nextthink = level.time + FRAMETIME;
|
||||||
|
|
||||||
//Arm
|
//Arm
|
||||||
|
@ -1021,7 +1021,7 @@ What it does when used depends on it's "count" (can be set by a script)
|
||||||
VectorSet( head->r.maxs, 8, 8, 8 );
|
VectorSet( head->r.maxs, 8, 8, 8 );
|
||||||
head->r.contents = CONTENTS_BODY;
|
head->r.contents = CONTENTS_BODY;
|
||||||
//FIXME: make an index into an external string table for localization
|
//FIXME: make an index into an external string table for localization
|
||||||
head->fullName = "Surgical Laser";
|
head->message = "Surgical Laser";
|
||||||
trap_LinkEntity(head);
|
trap_LinkEntity(head);
|
||||||
|
|
||||||
//dmg
|
//dmg
|
||||||
|
@ -1053,11 +1053,11 @@ What it does when used depends on it's "count" (can be set by a script)
|
||||||
//Link them up
|
//Link them up
|
||||||
base->lastEnemy = arm;
|
base->lastEnemy = arm;
|
||||||
arm->lastEnemy = head;
|
arm->lastEnemy = head;
|
||||||
head->owner = arm;
|
head->parent = arm;
|
||||||
arm->nextTrain = head->nextTrain = base;
|
arm->nextTrain = head->nextTrain = base;
|
||||||
|
|
||||||
// The head should always think, since it will be either firing a damage laser or just a target laser
|
// The head should always think, since it will be either firing a damage laser or just a target laser
|
||||||
head->e_ThinkFunc = thinkF_laser_arm_fire;
|
head->think = laser_arm_fire;
|
||||||
head->nextthink = level.time + FRAMETIME;
|
head->nextthink = level.time + FRAMETIME;
|
||||||
head->booleanstate = qfalse; // Don't do damage until told to
|
head->booleanstate = qfalse; // Don't do damage until told to
|
||||||
}
|
}
|
||||||
|
@ -1067,4 +1067,4 @@ void SP_laser_arm (gentity_t *base)
|
||||||
base->think = laser_arm_start;
|
base->think = laser_arm_start;
|
||||||
base->nextthink = level.time + FRAMETIME;
|
base->nextthink = level.time + FRAMETIME;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -549,6 +549,7 @@ void _VectorAdd( const vec3_t veca, const vec3_t vecb, vec3_t out );
|
||||||
void _VectorCopy( const vec3_t in, vec3_t out );
|
void _VectorCopy( const vec3_t in, vec3_t out );
|
||||||
void _VectorScale( const vec3_t in, float scale, vec3_t out );
|
void _VectorScale( const vec3_t in, float scale, vec3_t out );
|
||||||
void _VectorMA( const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc );
|
void _VectorMA( const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc );
|
||||||
|
float Vector4to3(const vec4_t in, vec3_t out); // returns in[3]
|
||||||
|
|
||||||
unsigned ColorBytes3 (float r, float g, float b);
|
unsigned ColorBytes3 (float r, float g, float b);
|
||||||
unsigned ColorBytes4 (float r, float g, float b, float a);
|
unsigned ColorBytes4 (float r, float g, float b, float a);
|
||||||
|
|
Loading…
Reference in a new issue