mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-24 21:32:36 +00:00
Fixes for misc_laser.
Still need float to transfer alpha-channel from game to cgame Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
parent
252a52afdc
commit
90125906cb
6 changed files with 54 additions and 26 deletions
|
@ -1297,11 +1297,11 @@ void CG_SmallSpark( vec3_t origin, vec3_t normal )
|
|||
}
|
||||
|
||||
|
||||
void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qboolean hit_ent )
|
||||
void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec3_t laserRGB, float alpha )
|
||||
{
|
||||
vec3_t dir, right, up, angles, work, pos,
|
||||
sRGB, lRGB;
|
||||
float scale = 1.0f, alpha;
|
||||
sRGB, ;
|
||||
float scale = 1.0f;
|
||||
int life = 0;
|
||||
|
||||
/* FIXME: FX_DetailLevel defined nowhere */
|
||||
|
@ -1311,7 +1311,6 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qbo
|
|||
// Orient the laser spray
|
||||
VectorSubtract( end, start, dir );
|
||||
VectorNormalize( dir );
|
||||
/*alpha = Vector4to3( laserRGB, lRGB );*/ /* FIXME: Vector4to3 defined nowhere */
|
||||
|
||||
VectorMA( end, 0.5f, normal, pos );
|
||||
MakeNormalVectors( normal, right, up );
|
||||
|
@ -1321,7 +1320,7 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qbo
|
|||
FX_AddSprite2( start, NULL, qfalse,
|
||||
1.75f, 1.0f,
|
||||
alpha, 0.0f,
|
||||
lRGB, lRGB,
|
||||
laserRGB, laserRGB,
|
||||
0.0f,
|
||||
0.0f,
|
||||
200,
|
||||
|
@ -1331,7 +1330,7 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qbo
|
|||
1.0f,
|
||||
3.0f, 5.0f,
|
||||
alpha, 0.0f,
|
||||
lRGB, lRGB,
|
||||
laserRGB, laserRGB,
|
||||
125,
|
||||
cgs.media.whiteLaserShader );*/ /* FIXME: FX_AddLine3 not defined */
|
||||
|
||||
|
@ -1343,12 +1342,12 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qbo
|
|||
cgs.media.whiteLaserShader );
|
||||
|
||||
// Doing all of this extra stuff would look weird if it hits a player ent.
|
||||
if ( !hit_ent )
|
||||
{
|
||||
//if ( !hit_ent )
|
||||
//{
|
||||
FX_AddQuad2( pos, normal,
|
||||
3.5f, 1.0f,
|
||||
alpha, 0.0f,
|
||||
lRGB, lRGB,
|
||||
laserRGB, laserRGB,
|
||||
0.0f,
|
||||
200,
|
||||
cgs.media.waterDropShader );
|
||||
|
@ -1380,14 +1379,14 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qbo
|
|||
|
||||
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,
|
||||
laserRGB, laserRGB,
|
||||
0.0f,
|
||||
0.0f,
|
||||
200,
|
||||
|
@ -1397,7 +1396,7 @@ void CG_FireLaser( vec3_t start, vec3_t end, vec3_t normal, vec4_t laserRGB, qbo
|
|||
scale = 1.0f + (random() * 3.0f);
|
||||
|
||||
CG_Smoke( dir, normal, scale, 12.0f );
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
@ -1754,9 +1754,14 @@ case EV_SHAKE_SOUND:
|
|||
}
|
||||
break;
|
||||
|
||||
case EV_CAMMODE_TOGGLE:
|
||||
case EV_LASERTURRET_AIM:
|
||||
DEBUGNAME("EV_CAMMODE_TOGGLE");
|
||||
cg.cinematicFade = !cg.cinematicFade;
|
||||
CG_AimLaser( cent->currentState.origin, cent->currentState.origin2, cent->currentState.angles);
|
||||
break;
|
||||
|
||||
case EV_LASERTURRET_FIRE:
|
||||
DEBUGNAME("EV_CAMMODE_TOGGLE");
|
||||
CG_FireLaser( cent->currentState.origin, cent->currentState.origin2, cent->currentState.angles, cent->currentState.angles2, cent->currentState.scale);
|
||||
break;
|
||||
|
||||
// Additional ports from SP by Harry Young
|
||||
|
|
|
@ -873,7 +873,10 @@ typedef enum {
|
|||
EV_SHOOTER_SOUND,
|
||||
EV_TRIGGER_SHOW,
|
||||
EV_SCRIPT_SOUND,
|
||||
EV_CAMMODE_TOGGLE
|
||||
EV_CAMMODE_TOGGLE,
|
||||
|
||||
EV_LASERTURRET_AIM,
|
||||
EV_LASERTURRET_FIRE
|
||||
} entity_event_t;
|
||||
|
||||
/* THIS IS OLD FROM HOLOMATCH (RPG-X: J2J)
|
||||
|
|
|
@ -720,7 +720,6 @@ qboolean G_SpawnString( const char *key, const char *defaultString, char **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_SpawnVector( const char *key, const char *defaultString, float *out );
|
||||
qboolean G_SpawnVector4( const char *key, const char *defaultString, float *out );
|
||||
void G_SpawnEntitiesFromString( void );
|
||||
char *G_NewString( const char *string );
|
||||
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
//extern team_t TranslateTeamName( const char *name );
|
||||
//extern cvar_t *g_spskill;
|
||||
|
||||
//client side shortcut hacks from cg_local.h - nah sorry that won't work as we are MP
|
||||
//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 );
|
||||
|
||||
|
||||
#define ARM_ANGLE_RANGE 60
|
||||
#define HEAD_ANGLE_RANGE 90
|
||||
|
@ -848,11 +844,32 @@ void laser_arm_fire (gentity_t *ent)
|
|||
|
||||
if ( ent->booleanstate )
|
||||
{
|
||||
//CG_FireLaser( start, trace.endpos, trace.plane.normal, ent->nextTrain->startRGBA, qfalse );
|
||||
ent->s.origin2[0] = trace.endpos[0];
|
||||
ent->s.origin2[1] = trace.endpos[1];
|
||||
ent->s.origin2[2] = trace.endpos[2];
|
||||
|
||||
ent->s.angles[0] = trace.plane.normal[0];
|
||||
ent->s.angles[1] = trace.plane.normal[1];
|
||||
ent->s.angles[2] = trace.plane.normal[2];
|
||||
|
||||
ent->s.angles2[0] = ent->nextTrain->startRGBA[0];
|
||||
ent->s.angles2[1] = ent->nextTrain->startRGBA[1];
|
||||
ent->s.angles2[2] = ent->nextTrain->startRGBA[2];
|
||||
ent->s.scale = ent->nextTrain->startRGBA[3];
|
||||
|
||||
G_AddEvent( ent, EV_LASERTURRET_FIRE, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
//CG_AimLaser( start, trace.endpos, trace.plane.normal );
|
||||
ent->s.origin2[0] = trace.endpos[0];
|
||||
ent->s.origin2[1] = trace.endpos[1];
|
||||
ent->s.origin2[2] = trace.endpos[2];
|
||||
|
||||
ent->s.angles[0] = trace.plane.normal[0];
|
||||
ent->s.angles[1] = trace.plane.normal[1];
|
||||
ent->s.angles[2] = trace.plane.normal[2];
|
||||
|
||||
G_AddEvent( ent, EV_LASERTURRET_AIM, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -867,8 +884,8 @@ void laser_arm_use (gentity_t *self, gentity_t *other, gentity_t *activator)
|
|||
default:
|
||||
//Fire
|
||||
//trap_Printf("FIRE!\n");
|
||||
// self->lastEnemy->lastEnemy->e_ThinkFunc = thinkF_laser_arm_fire;
|
||||
// self->lastEnemy->lastEnemy->nextthink = level.time + FRAMETIME;
|
||||
self->lastEnemy->lastEnemy->think = laser_arm_fire;
|
||||
self->lastEnemy->lastEnemy->nextthink = level.time + FRAMETIME;
|
||||
//For 3 seconds
|
||||
self->lastEnemy->lastEnemy->booleanstate = qtrue; // Let 'er rip!
|
||||
self->lastEnemy->lastEnemy->last_move_time = level.time + self->lastEnemy->lastEnemy->wait;
|
||||
|
@ -981,7 +998,13 @@ void laser_arm_start (gentity_t *base)
|
|||
//FIXME: need an actual model
|
||||
base->s.modelindex = G_ModelIndex("models/mapobjects/dn/laser_base.md3");
|
||||
base->s.eType = ET_GENERAL;
|
||||
//G_SpawnVector4( "startRGBA", "1.0 0.85 0.15 0.75", (float *)&base->startRGBA );
|
||||
|
||||
if ( !base->startRGBA )
|
||||
{ base->startRGBA[0] = 1.0;
|
||||
base->startRGBA[1] = 0.85;
|
||||
base->startRGBA[2] = 0.15 ;
|
||||
base->startRGBA[3] = 0.75;
|
||||
}
|
||||
//anglespeed - how fast it can track the player, entered in degrees per second, so we divide by FRAMETIME/1000
|
||||
if ( !base->speed )
|
||||
{
|
||||
|
|
|
@ -549,7 +549,6 @@ void _VectorAdd( const vec3_t veca, const vec3_t vecb, vec3_t out );
|
|||
void _VectorCopy( const vec3_t in, 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 );
|
||||
float Vector4to3(const vec4_t in, vec3_t out); // returns in[3]
|
||||
|
||||
unsigned ColorBytes3 (float r, float g, float b);
|
||||
unsigned ColorBytes4 (float r, float g, float b, float a);
|
||||
|
|
Loading…
Reference in a new issue