mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-04-22 08:50:48 +00:00
Tons of variable scopes eliminated and some other stuff
Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
parent
e1198d3079
commit
fc2706750b
17 changed files with 57 additions and 99 deletions
|
@ -1857,7 +1857,6 @@ CG_DrawSelfdestructTimer
|
|||
*/
|
||||
static float CG_DrawSelfdestructTimer( void ) {
|
||||
char *s;
|
||||
int w;
|
||||
int msec = cg.selfdestructTime - cg.time;
|
||||
|
||||
if (msec > 0){
|
||||
|
@ -1869,7 +1868,7 @@ static float CG_DrawSelfdestructTimer( void ) {
|
|||
|
||||
s = va( "%i:%i%i.%i", mins, tens, seconds, remainder );
|
||||
|
||||
w = UI_ProportionalStringWidth("SELF-DESTRUCT IN",UI_SMALLFONT);
|
||||
int w = UI_ProportionalStringWidth("SELF-DESTRUCT IN",UI_SMALLFONT);
|
||||
UI_DrawProportionalString(320 - (w / 2), 10, "SELF-DESTRUCT IN", UI_SMALLFONT, colorTable[CT_RED]);
|
||||
|
||||
w = UI_ProportionalStringWidth(s,UI_SMALLFONT);
|
||||
|
|
|
@ -191,7 +191,6 @@ CG_MakeExplosion
|
|||
localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
|
||||
qhandle_t hModel, qhandle_t shader,
|
||||
int msec, float scale, qboolean isSprite ) {
|
||||
float ang;
|
||||
localEntity_t *ex;
|
||||
int offset;
|
||||
vec3_t tmpVec, newOrigin;
|
||||
|
@ -219,7 +218,7 @@ localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
|
|||
if ( !dir ) {
|
||||
AxisClear( ex->refEntity.axis );
|
||||
} else {
|
||||
ang = rand() % 360;
|
||||
float ang = rand() % 360;
|
||||
VectorCopy( dir, ex->refEntity.axis[0] );
|
||||
RotateAroundDirection( ex->refEntity.axis, ang );
|
||||
}
|
||||
|
@ -256,7 +255,6 @@ localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
|
|||
localEntity_t *CG_MakeExplosion2( vec3_t origin, vec3_t dir,
|
||||
qhandle_t hModel, int numFrames, qhandle_t shader,
|
||||
int msec, qboolean isSprite, float scale, int flags) {
|
||||
float ang;
|
||||
localEntity_t *ex;
|
||||
int offset;
|
||||
vec3_t tmpVec, newOrigin;
|
||||
|
@ -284,7 +282,7 @@ localEntity_t *CG_MakeExplosion2( vec3_t origin, vec3_t dir,
|
|||
if ( !dir ) {
|
||||
AxisClear( ex->refEntity.axis );
|
||||
} else {
|
||||
ang = rand() % 360;
|
||||
float ang = rand() % 360;
|
||||
VectorCopy( dir, ex->refEntity.axis[0] );
|
||||
RotateAroundDirection( ex->refEntity.axis, ang );
|
||||
}
|
||||
|
|
|
@ -542,7 +542,6 @@ static void CG_Missile( centity_t *cent, qboolean altfire ) {
|
|||
entityState_t *s1;
|
||||
qhandle_t missile = 0;
|
||||
const weaponInfo_t *weapon;
|
||||
int rpg_tripmines;
|
||||
const char *info;
|
||||
|
||||
s1 = ¢->currentState;
|
||||
|
@ -581,7 +580,7 @@ static void CG_Missile( centity_t *cent, qboolean altfire ) {
|
|||
}
|
||||
//RPG-X: RedTechie - non-admin see no tripmines! But first by popular demand check CVAR
|
||||
info = CG_ConfigString( CS_SERVERINFO );
|
||||
rpg_tripmines = atoi( Info_ValueForKey( info, "rpg_invisibletripmines" ) );
|
||||
int rpg_tripmines = atoi( Info_ValueForKey( info, "rpg_invisibletripmines" ) );
|
||||
if (!weapon->alt_missileModel || (!cgs.clientinfo[cg.snap->ps.clientNum].isAdmin/*cg.snap->ps.persistant[PERS_CLASS] != PC_ADMIN*/ && rpg_tripmines == 1)) {
|
||||
//if there is no missile then we're done
|
||||
return;
|
||||
|
|
|
@ -502,7 +502,7 @@ ObjectivePrint_Line
|
|||
static void ObjectivePrint_Line(int strIndex,int color,centity_t *cent)
|
||||
{
|
||||
char *str,*strBegin;
|
||||
int y,pixelLen,charLen;
|
||||
int y,pixelLen;
|
||||
char holdText[1024], holdText2[2];
|
||||
char finalText[MAX_OBJ_LENGTH];
|
||||
int len, maxPixLength, charHeight;
|
||||
|
@ -547,7 +547,7 @@ static void ObjectivePrint_Line(int strIndex,int color,centity_t *cent)
|
|||
else
|
||||
{
|
||||
pixelLen = 0;
|
||||
charLen = 0;
|
||||
int charLen = 0;
|
||||
holdText2[1] = '\0';
|
||||
strBegin = str;
|
||||
|
||||
|
@ -601,7 +601,7 @@ static void ObjectivePrint_Line(int strIndex,int color,centity_t *cent)
|
|||
static int Objective_LineCnt(int strIndex,centity_t *cent)
|
||||
{
|
||||
char *str,*strBegin;
|
||||
int pixelLen,charLen;
|
||||
int pixelLen;
|
||||
char holdText[1024], holdText2[2];
|
||||
char finalText[MAX_OBJ_LENGTH];
|
||||
int len, maxPixLength;
|
||||
|
@ -629,7 +629,7 @@ static int Objective_LineCnt(int strIndex,centity_t *cent)
|
|||
else
|
||||
{
|
||||
pixelLen = 0;
|
||||
charLen = 0;
|
||||
int charLen = 0;
|
||||
holdText2[1] = '\0';
|
||||
strBegin = str;
|
||||
|
||||
|
|
|
@ -1113,12 +1113,10 @@ CG_AddFragment
|
|||
void CG_AddFragment( localEntity_t *le ) {
|
||||
vec3_t newOrigin;
|
||||
trace_t trace;
|
||||
int k;
|
||||
|
||||
if ( le->pos.trType == TR_STATIONARY ) {
|
||||
// sink into the ground if near the removal time
|
||||
int t;
|
||||
float oldZ;
|
||||
|
||||
t = le->endTime - cg.time;
|
||||
if ( t < SINK_TIME ) {
|
||||
|
@ -1127,7 +1125,7 @@ void CG_AddFragment( localEntity_t *le ) {
|
|||
// into the ground
|
||||
VectorCopy( le->refEntity.origin, le->refEntity.lightingOrigin );
|
||||
le->refEntity.renderfx |= RF_LIGHTING_ORIGIN;
|
||||
oldZ = le->refEntity.origin[2];
|
||||
float oldZ = le->refEntity.origin[2];
|
||||
le->refEntity.origin[2] -= 16 * ( 1.0 - (float)t / SINK_TIME );
|
||||
trap_R_AddRefEntityToScene( &le->refEntity );
|
||||
le->refEntity.origin[2] = oldZ;
|
||||
|
@ -1152,6 +1150,7 @@ void CG_AddFragment( localEntity_t *le ) {
|
|||
|
||||
BG_EvaluateTrajectory( &le->angles, cg.time, angles );
|
||||
AnglesToAxis( angles, le->refEntity.axis );
|
||||
int k;
|
||||
for(k = 0; k < 3; k++)
|
||||
{
|
||||
VectorScale(le->refEntity.axis[k], le->data.fragment.radius, le->refEntity.axis[k]);
|
||||
|
|
|
@ -68,12 +68,11 @@ Will allways succeed, even if it requires freeing an old active mark
|
|||
*/
|
||||
markPoly_t *CG_AllocMark( void ) {
|
||||
markPoly_t *le;
|
||||
int time;
|
||||
|
||||
if ( !cg_freeMarkPolys ) {
|
||||
// no free entities, so free the one at the end of the chain
|
||||
// remove the oldest active entity
|
||||
time = cg_activeMarkPolys.prevMark->time;
|
||||
int time = cg_activeMarkPolys.prevMark->time;
|
||||
while (cg_activeMarkPolys.prevMark && time == cg_activeMarkPolys.prevMark->time) {
|
||||
CG_FreeMarkPoly( cg_activeMarkPolys.prevMark );
|
||||
}
|
||||
|
|
|
@ -1893,7 +1893,6 @@ void CG_NewClientInfo( int clientNum ) {
|
|||
char charStr[MAX_QPATH];
|
||||
char *model;
|
||||
char *skin;
|
||||
size_t len;
|
||||
|
||||
trap_Cvar_VariableStringBuffer( "model", charStr, sizeof( charStr ) );
|
||||
if ( ( model = strchr( charStr, '/' ) ) == NULL) {
|
||||
|
@ -1901,7 +1900,7 @@ void CG_NewClientInfo( int clientNum ) {
|
|||
skin = "default";
|
||||
} else {
|
||||
*model = 0; //*model++ = 0;
|
||||
len = strlen(model);
|
||||
size_t len = strlen(model);
|
||||
|
||||
//if there was a slash, but no model afterwards
|
||||
if ( !model || !model[1] ) {
|
||||
|
@ -2095,11 +2094,9 @@ independantly of its spawner player.
|
|||
void CG_NewDecoyInfo( int decoyNum ) {
|
||||
clientInfo_t *ci;
|
||||
char *userinfo;
|
||||
int i;
|
||||
char *v;
|
||||
char *temp, *temp2;
|
||||
//char charName[MAX_QPATH], modelName[MAX_QPATH], skinName[MAX_QPATH];
|
||||
int len;
|
||||
qboolean noMemoryLeft=qfalse;
|
||||
|
||||
ci = &cgs.decoyInfo[decoyNum];
|
||||
|
@ -2157,7 +2154,7 @@ void CG_NewDecoyInfo( int decoyNum ) {
|
|||
}
|
||||
} else {
|
||||
temp++; //bypass the slash
|
||||
len = strlen(temp);
|
||||
int len = strlen(temp);
|
||||
temp2 = strchr( temp, '/' );
|
||||
|
||||
//if there was a model defined, but no skin
|
||||
|
@ -2200,7 +2197,7 @@ void CG_NewDecoyInfo( int decoyNum ) {
|
|||
//Okay... if another player actively has the skin we want, let's pilfer that rather than load it like a schmuck rofl.
|
||||
{
|
||||
clientInfo_t *match;
|
||||
|
||||
int i;
|
||||
for ( i = 0; i < cgs.maxclients; i++ ) {
|
||||
match = &cgs.clientinfo[i];
|
||||
|
||||
|
@ -2288,10 +2285,8 @@ cg.time should be between oldFrameTime and frameTime after exit
|
|||
===============
|
||||
*/
|
||||
static qboolean CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation, float speedScale ) {
|
||||
int f;
|
||||
animation_t *anim;
|
||||
qboolean newFrame = qfalse;
|
||||
float frameLerp;
|
||||
|
||||
// debugging tool to get no animations
|
||||
if ( cg_animSpeed.integer == 0 ) {
|
||||
|
@ -2324,7 +2319,7 @@ static qboolean CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnima
|
|||
|
||||
//TiM - Calc frame lerp scale here, else the frames
|
||||
//just snap to each other
|
||||
frameLerp = (float)anim->frameLerp + (anim->frameLerp*(1.0f - speedScale));
|
||||
float frameLerp = (float)anim->frameLerp + (anim->frameLerp*(1.0f - speedScale));
|
||||
if ( frameLerp < 1.0f )
|
||||
frameLerp = 1.0f;
|
||||
|
||||
|
@ -2335,7 +2330,7 @@ static qboolean CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnima
|
|||
} else {
|
||||
lf->frameTime = lf->oldFrameTime + frameLerp;//anim->frameLerp;
|
||||
}
|
||||
f = ( lf->frameTime - lf->animationTime ) / frameLerp;//anim->frameLerp;
|
||||
int f = ( lf->frameTime - lf->animationTime ) / frameLerp;//anim->frameLerp;
|
||||
//f *= speedScale; // adjust for haste, etc
|
||||
if ( f >= anim->numFrames ) {
|
||||
f -= anim->numFrames;
|
||||
|
@ -2706,7 +2701,6 @@ static void CG_PlayerAngles( centity_t *cent, vec3_t legs[3], vec3_t torso[3], v
|
|||
int dir;
|
||||
qboolean offsetPitch;
|
||||
clientInfo_t* ci;
|
||||
int i;
|
||||
|
||||
qboolean LockBodyYaw=qfalse; //RPG-X:TiM
|
||||
|
||||
|
@ -2940,6 +2934,7 @@ static void CG_PlayerAngles( centity_t *cent, vec3_t legs[3], vec3_t torso[3], v
|
|||
if ( cent->currentState.eFlags & EF_TALKING ) {
|
||||
if ( cg.time > ci->nextTalkAngle || (!ci->talkAngles[PITCH] && !ci->talkAngles[YAW] && !ci->talkAngles[ROLL]) ) {
|
||||
|
||||
int i;
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
ci->talkAngles[i] = flrandom( -4, 4 );
|
||||
}
|
||||
|
@ -3268,14 +3263,12 @@ model itself
|
|||
|
||||
void CG_CalcBeamAlpha( int powerups, beamData_t *beamData ) {
|
||||
float beamAlpha = 1.0;
|
||||
int bTime = 0;
|
||||
|
||||
|
||||
if ( ( powerups & ( 1 << PW_BEAM_OUT ) ) || ( powerups & ( 1 << PW_QUAD ) ) ) {
|
||||
//TiM - SP transporter FX, also base alpha off of phase in transport cycle
|
||||
//bTime = cg.time - beamData->beamTimeParam;
|
||||
|
||||
bTime = cg.time - beamData->beamTimeParam;
|
||||
int bTime = cg.time - beamData->beamTimeParam;
|
||||
|
||||
if (bTime > PLAYER_BEAM_FADE ) {
|
||||
if ( bTime < ( PLAYER_BEAM_FADE + PLAYER_BEAM_FADETIME) ) {
|
||||
|
|
|
@ -83,8 +83,6 @@ void CG_DamageFeedback( int yawByte, int pitchByte, int damage, int shielddamage
|
|||
float scale;
|
||||
vec3_t dir;
|
||||
vec3_t angles;
|
||||
float dist;
|
||||
float yaw, pitch;
|
||||
|
||||
// show the attacking player's head and name in corner
|
||||
cg.attackerTime = cg.time;
|
||||
|
@ -112,8 +110,8 @@ void CG_DamageFeedback( int yawByte, int pitchByte, int damage, int shielddamage
|
|||
cg.v_dmg_pitch = -kick;
|
||||
} else {
|
||||
// positional
|
||||
pitch = pitchByte / 255.0 * 360;
|
||||
yaw = yawByte / 255.0 * 360;
|
||||
float pitch = pitchByte / 255.0 * 360;
|
||||
float yaw = yawByte / 255.0 * 360;
|
||||
|
||||
angles[PITCH] = pitch;
|
||||
angles[YAW] = yaw;
|
||||
|
@ -122,14 +120,14 @@ void CG_DamageFeedback( int yawByte, int pitchByte, int damage, int shielddamage
|
|||
AngleVectors( angles, dir, NULL, NULL );
|
||||
VectorSubtract( vec3_origin, dir, dir );
|
||||
|
||||
front = DotProduct (dir, cg.refdef.viewaxis[0] );
|
||||
left = DotProduct (dir, cg.refdef.viewaxis[1] );
|
||||
up = DotProduct (dir, cg.refdef.viewaxis[2] );
|
||||
float front = DotProduct (dir, cg.refdef.viewaxis[0] );
|
||||
float left = DotProduct (dir, cg.refdef.viewaxis[1] );
|
||||
float up = DotProduct (dir, cg.refdef.viewaxis[2] );
|
||||
|
||||
dir[0] = front;
|
||||
dir[1] = left;
|
||||
dir[2] = 0;
|
||||
dist = VectorLength( dir );
|
||||
float dist = VectorLength( dir );
|
||||
if ( dist < 0.1 ) {
|
||||
dist = 0.1;
|
||||
}
|
||||
|
|
|
@ -601,7 +601,6 @@ void CG_PredictPlayerState( void ) {
|
|||
// we want to compare
|
||||
if ( cg.predictedPlayerState.commandTime == oldPlayerState.commandTime ) {
|
||||
vec3_t delta;
|
||||
float len;
|
||||
|
||||
if ( cg.thisFrameTeleport ) {
|
||||
// a teleport will not cause an error decay
|
||||
|
@ -621,7 +620,7 @@ void CG_PredictPlayerState( void ) {
|
|||
}
|
||||
}
|
||||
VectorSubtract( oldPlayerState.origin, adjusted, delta );
|
||||
len = VectorLength( delta );
|
||||
float len = VectorLength( delta );
|
||||
if ( len > 0.1 ) {
|
||||
if ( cg_showmiss.integer ) {
|
||||
CG_Printf("Prediction miss: %f\n", len);
|
||||
|
|
|
@ -252,7 +252,6 @@ static void CG_DrawClientScore_Big( int y, score_t *score, float *color, float f
|
|||
char *rpg_class;
|
||||
vec4_t rpg_color;
|
||||
vec_t *ping_txtcolor = NULL;
|
||||
int intClamp;
|
||||
|
||||
ci = &cgs.clientinfo[score->client];
|
||||
|
||||
|
@ -339,7 +338,7 @@ static void CG_DrawClientScore_Big( int y, score_t *score, float *color, float f
|
|||
|
||||
//player client Num
|
||||
//Com_sprintf(string,sizeof(string), "%i", intClamp); //RPG-X: J2J Switched Scoore to Client No.
|
||||
intClamp = Com_Clamp( 0, 128, cg_entities[score->client].currentState.clientNum );
|
||||
int intClamp = Com_Clamp( 0, 128, cg_entities[score->client].currentState.clientNum );
|
||||
UI_DrawProportionalString( SB_SCORE_X_BIG, y , va("%i", intClamp), UI_TINYFONT | UI_LEFT, colorTable[CT_WHITE]);
|
||||
|
||||
//player time
|
||||
|
@ -403,15 +402,9 @@ static void CG_DrawClientScore( int y, score_t *score, float *color, float fade,
|
|||
CG_DrawPic( SB_TOPLINE_LENGTH+32, y+321, 36, 32, cgs.media.scoreboardbotright ); //RPG-X: - RedTechie Bottom Right
|
||||
*/
|
||||
//RPG-X: - RedTechie Fixed intermissions scoreboard
|
||||
if ( !inIntermission )
|
||||
{
|
||||
//RPG-X BOOKMARK
|
||||
CG_DrawClientScore_Big(y, score, color, fade, largeFormat );
|
||||
return;
|
||||
}else{
|
||||
CG_DrawClientScore_Big(y, score, color, fade, largeFormat );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -308,8 +308,6 @@ static void CG_ConfigStringModified( void ) {
|
|||
cgs.scores1 = atoi( str );
|
||||
} else if ( num == CS_SCORES2 ) {
|
||||
cgs.scores2 = atoi( str );
|
||||
} else if ( num == CS_WARMUP ) {
|
||||
CG_ParseWarmup();
|
||||
} else if ( num == CS_LEVEL_START_TIME ) {
|
||||
cgs.levelStartTime = atoi( str );
|
||||
} else if ( num == CS_VOTE_TIME ) {
|
||||
|
|
|
@ -23,9 +23,9 @@ void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
|
|||
|
||||
|
||||
int PASSFLOAT( float x ) {
|
||||
float floatTemp;
|
||||
int floatTemp;
|
||||
floatTemp = x;
|
||||
return *(int *)&floatTemp;
|
||||
return floatTemp;
|
||||
}
|
||||
|
||||
void trap_Print( const char *fmt ) {
|
||||
|
|
|
@ -124,7 +124,6 @@ void CG_TestModelPrevSkin_f (void) {
|
|||
}
|
||||
|
||||
static void CG_AddTestModel (void) {
|
||||
int i;
|
||||
|
||||
// re-register the model, because the level may have changed
|
||||
cg.testModelEntity.hModel = trap_R_RegisterModel( cg.testModelName );
|
||||
|
@ -141,6 +140,7 @@ static void CG_AddTestModel (void) {
|
|||
VectorCopy( cg.refdef.viewaxis[2], cg.testModelEntity.axis[2] );
|
||||
|
||||
// allow the position to be adjusted
|
||||
int i;
|
||||
for (i=0 ; i<3 ; i++) {
|
||||
cg.testModelEntity.origin[i] += cg.refdef.viewaxis[0][i] * cg_gun_x.value;
|
||||
cg.testModelEntity.origin[i] += cg.refdef.viewaxis[1][i] * cg_gun_y.value;
|
||||
|
@ -390,7 +390,6 @@ Still trying to figure out how lerp actually works.
|
|||
static void CG_UpdateThirdPersonTargetDamp ( void ) {
|
||||
trace_t tr;
|
||||
vec3_t targetDiff; //difference between our aimed target and current target
|
||||
float dampFactor, dampTime, dampRatio;
|
||||
|
||||
//Just to be on the safe side, let's set the current ideal data again
|
||||
CG_CalcIdealThirdPersonViewTarget();
|
||||
|
@ -406,15 +405,16 @@ static void CG_UpdateThirdPersonTargetDamp ( void ) {
|
|||
//Ugh.... maaaaath >.<
|
||||
//The JKA code says the equation is "(Damp)^(time)", so I'm guessing it's inverse exponential to
|
||||
//get that cool slowy down effect :)
|
||||
float dampFactor;
|
||||
if ( !freeRotate )
|
||||
dampFactor = 1.0 - cg_thirdPersonTargetDamp.value; //yeh, I guess this is the inverse exponential bit.
|
||||
else
|
||||
dampFactor = 1.0 - Q_fabs( cameraFocusAngles[PITCH] ) / 90.0f;
|
||||
|
||||
dampTime = (float)(cg.time - cameraLastFrame) * (1.0f/(float)CAMERA_DAMP_INTERVAL); //chikushou! I don't know how this time factor is caluclated O_o
|
||||
float dampTime = (float)(cg.time - cameraLastFrame) * (1.0f/(float)CAMERA_DAMP_INTERVAL); //chikushou! I don't know how this time factor is caluclated O_o
|
||||
|
||||
//Square this number for each unit of dampTime
|
||||
dampRatio = Q_powf( dampFactor, dampTime);
|
||||
float dampRatio = Q_powf( dampFactor, dampTime);
|
||||
|
||||
//Okay, so our current position is calulated as the difference * -ratio + ideal... O_o
|
||||
VectorMA( cameraIdealTarget, -dampRatio, targetDiff, cameraCurTarget );
|
||||
|
@ -441,7 +441,6 @@ Looks somewhat similar to Target Damp
|
|||
static void CG_UpdateThirdPersonCameraDamp ( void ) {
|
||||
trace_t tr;
|
||||
vec3_t locationDiff;
|
||||
float dampFactor=0.0, dampTime, dampRatio;
|
||||
|
||||
//Initialise our goal angle
|
||||
CG_CalcIdealThirdPersonViewLocation();
|
||||
|
@ -461,7 +460,7 @@ static void CG_UpdateThirdPersonCameraDamp ( void ) {
|
|||
//The JKA code says these statments are to get it to damp less the more u look up.
|
||||
//Makes sense. Still looking how tho lol
|
||||
pitch /= 115.0; //magic number I guess lol.
|
||||
dampFactor = (1.0-cg_thirdPersonCameraDamp.value) * ( pitch * pitch );
|
||||
float dampFactor = (1.0-cg_thirdPersonCameraDamp.value) * ( pitch * pitch );
|
||||
|
||||
dampFactor += cg_thirdPersonCameraDamp.value;
|
||||
|
||||
|
@ -484,10 +483,10 @@ static void CG_UpdateThirdPersonCameraDamp ( void ) {
|
|||
//The JKA code says the equation is "(Damp)^(time)", so I'm guessing it's inverse exponential to
|
||||
//get that cool slowy down effect :)
|
||||
dampFactor = 1.0 - dampFactor; //yeh, I guess this is the inverse exponential bit.
|
||||
dampTime = (float)(cg.time - cameraLastFrame) * (1.0/(float)CAMERA_DAMP_INTERVAL); //chikushou! I don't know how this time factor is caluclated O_o
|
||||
float dampTime = (float)(cg.time - cameraLastFrame) * (1.0/(float)CAMERA_DAMP_INTERVAL); //chikushou! I don't know how this time factor is caluclated O_o
|
||||
|
||||
//Square this number for each unit of dampTime
|
||||
dampRatio = Q_powf( dampFactor, dampTime);
|
||||
float dampRatio = Q_powf( dampFactor, dampTime);
|
||||
|
||||
//Okay, so our current position is calulated as the difference * -ratio + ideal... O_o
|
||||
VectorMA( cameraIdealLoc, -dampRatio, locationDiff, cameraCurLoc );
|
||||
|
@ -516,7 +515,6 @@ Let's see if I can understand this in any way lol
|
|||
*/
|
||||
static void CG_OffsetThirdPersonView( void ) {
|
||||
vec3_t diff;
|
||||
float deltaYaw;
|
||||
qboolean neg=qfalse;
|
||||
|
||||
cameraStiffFactor = 0.0f;
|
||||
|
@ -562,7 +560,7 @@ static void CG_OffsetThirdPersonView( void ) {
|
|||
|
||||
AngleVectors( cameraFocusAngles, cameraForward, cameraRight, cameraUp );
|
||||
|
||||
deltaYaw = fabs( cameraFocusAngles[YAW] - cameraLastYaw );
|
||||
float deltaYaw = fabs( cameraFocusAngles[YAW] - cameraLastYaw );
|
||||
//if we exceeded our norms, stick it back
|
||||
if (deltaYaw > 180.0f ) {
|
||||
deltaYaw = fabs( deltaYaw - 360.0f );
|
||||
|
@ -771,7 +769,6 @@ static void CG_OffsetFirstPersonView( void ) {
|
|||
float *origin;
|
||||
float *angles;
|
||||
float bob;
|
||||
float ratio;
|
||||
float delta;
|
||||
float speed;
|
||||
float f;
|
||||
|
@ -828,7 +825,7 @@ static void CG_OffsetFirstPersonView( void ) {
|
|||
|
||||
// add angles based on damage kick
|
||||
if ( cg.damageTime ) {
|
||||
ratio = cg.time - cg.damageTime;
|
||||
float ratio = cg.time - cg.damageTime;
|
||||
if ( ratio < DAMAGE_DEFLECT_TIME ) {
|
||||
ratio /= DAMAGE_DEFLECT_TIME;
|
||||
angles[PITCH] += ratio * cg.v_dmg_pitch;
|
||||
|
@ -1179,8 +1176,6 @@ static int CG_CalcFov( void ) {
|
|||
float v;
|
||||
int contents;
|
||||
float fov_x, fov_y;
|
||||
float zoomFov;
|
||||
float f;
|
||||
int inwater;
|
||||
qboolean warpEffect=qfalse;
|
||||
|
||||
|
@ -1202,7 +1197,7 @@ static int CG_CalcFov( void ) {
|
|||
}
|
||||
|
||||
// account for zooms
|
||||
zoomFov = cg_zoomFov.value;
|
||||
float zoomFov = cg_zoomFov.value;
|
||||
if ( zoomFov < 1 ) {
|
||||
zoomFov = 1;
|
||||
} else if ( zoomFov > FOV_MAX) {
|
||||
|
@ -1241,10 +1236,8 @@ static int CG_CalcFov( void ) {
|
|||
|
||||
fov_x = cg_zoomFov.value;
|
||||
} else {
|
||||
f = ( cg.time - cg.zoomTime ) / (float)ZOOM_OUT_TIME;
|
||||
if ( f > 1.0 ) {
|
||||
fov_x = fov_x;
|
||||
} else {
|
||||
float f = ( cg.time - cg.zoomTime ) / (float)ZOOM_OUT_TIME;
|
||||
if ( f <= 1.0 ) {
|
||||
fov_x = zoomFov + f * ( fov_x - zoomFov );
|
||||
}
|
||||
}
|
||||
|
@ -1268,8 +1261,8 @@ static int CG_CalcFov( void ) {
|
|||
|
||||
if ( warpEffect ){
|
||||
//phase = cg.time / 1000.0 * WAVE_FREQUENCY * M_PI * 2;
|
||||
phase = cg.time * 0.001 * WAVE_FREQUENCY * M_PI * 2;
|
||||
v = WAVE_AMPLITUDE * sin( phase );
|
||||
float phase = cg.time * 0.001 * WAVE_FREQUENCY * M_PI * 2;
|
||||
float v = WAVE_AMPLITUDE * sin( phase );
|
||||
fov_x += v;
|
||||
fov_y -= v;
|
||||
inwater = qtrue;
|
||||
|
|
|
@ -786,11 +786,9 @@ CG_MachinegunSpinAngle
|
|||
#define SPIN_SPEED 0.9
|
||||
#define COAST_TIME 1000
|
||||
static float CG_MachinegunSpinAngle( centity_t *cent ) {
|
||||
int delta;
|
||||
float angle;
|
||||
float speed;
|
||||
|
||||
delta = cg.time - cent->pe.barrelTime;
|
||||
int delta = cg.time - cent->pe.barrelTime;
|
||||
if ( cent->pe.barrelSpinning ) {
|
||||
angle = cent->pe.barrelAngle + delta * SPIN_SPEED;
|
||||
} else {
|
||||
|
@ -798,7 +796,7 @@ static float CG_MachinegunSpinAngle( centity_t *cent ) {
|
|||
delta = COAST_TIME;
|
||||
}
|
||||
|
||||
speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
|
||||
float speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
|
||||
angle = cent->pe.barrelAngle + delta * speed;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ void FX_CompressionShot( vec3_t start, vec3_t dir )
|
|||
trace_t trace;
|
||||
qboolean render_impact = qtrue;
|
||||
centity_t *traceEnt = NULL;
|
||||
int clientNum = -1;
|
||||
|
||||
VectorMA(start, MAXRANGE_CRIFLE, dir, end);
|
||||
CG_Trace( &trace, start, NULL, NULL, end, 0, MASK_SHOT );
|
||||
|
@ -78,8 +77,8 @@ void FX_CompressionShot( vec3_t start, vec3_t dir )
|
|||
if ( render_impact )
|
||||
{
|
||||
traceEnt = &cg_entities[trace.entityNum];
|
||||
clientNum = traceEnt->currentState.clientNum;
|
||||
if ( (trace.entityNum != ENTITYNUM_WORLD) && (clientNum >= 0 || clientNum < MAX_CLIENTS) )
|
||||
int clientNum = traceEnt->currentState.clientNum;
|
||||
if ( (trace.entityNum != ENTITYNUM_WORLD) && clientNum >= 0 && clientNum < MAX_CLIENTS )
|
||||
{
|
||||
FX_CompressionHit(trace.endpos);
|
||||
}
|
||||
|
@ -100,7 +99,6 @@ void FX_CompressionAltShot( vec3_t start, vec3_t dir )
|
|||
trace_t trace;
|
||||
qboolean render_impact = qtrue;
|
||||
centity_t *traceEnt = NULL;
|
||||
int clientNum = -1;
|
||||
|
||||
VectorMA(start, MAXRANGE_CRIFLE, dir, end);
|
||||
CG_Trace( &trace, start, NULL, NULL, end, cg_entities[cg.predictedPlayerState.clientNum].currentState.number, MASK_SHOT );
|
||||
|
@ -121,8 +119,8 @@ void FX_CompressionAltShot( vec3_t start, vec3_t dir )
|
|||
if ( render_impact )
|
||||
{
|
||||
traceEnt = &cg_entities[trace.entityNum];
|
||||
clientNum = traceEnt->currentState.clientNum;
|
||||
if ( (trace.entityNum != ENTITYNUM_WORLD) && (clientNum >= 0 || clientNum < MAX_CLIENTS) )
|
||||
int clientNum = traceEnt->currentState.clientNum;
|
||||
if ( (trace.entityNum != ENTITYNUM_WORLD) && clientNum >= 0 && clientNum < MAX_CLIENTS )
|
||||
{
|
||||
FX_CompressionHit(trace.endpos);
|
||||
}
|
||||
|
@ -152,7 +150,6 @@ void FX_CompressionExplosion( vec3_t start, vec3_t origin, vec3_t normal, qboole
|
|||
|
||||
vec3_t color = {0.7, 0.43, 0.44};
|
||||
|
||||
int size = 2;
|
||||
|
||||
//FX_CompressionHit( origin ); //TiM: let's test if the rifle doesn't make stuff explode when its shot :)
|
||||
//return;
|
||||
|
@ -225,6 +222,7 @@ void FX_CompressionExplosion( vec3_t start, vec3_t origin, vec3_t normal, qboole
|
|||
|
||||
if (!altfire)
|
||||
{
|
||||
int size = 2;
|
||||
CG_InitLensFlare( origin,
|
||||
350, 350,
|
||||
color, 1.2, 2.0, 1600, 200,
|
||||
|
@ -299,9 +297,7 @@ void FX_PrifleBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean
|
|||
{
|
||||
refEntity_t beam;
|
||||
sfxHandle_t sfx;
|
||||
float size;
|
||||
vec3_t velocity;
|
||||
int sparks;
|
||||
vec3_t rgb = { 1,0.9,0.6}, rgb2={1,0.3,0};
|
||||
|
||||
//vec3_t rgb3 = { 1.0, 1.0, 1.0 };
|
||||
|
@ -412,10 +408,10 @@ void FX_PrifleBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean
|
|||
// "Fun" sparks... Not when empty.
|
||||
if ( spark && !empty)
|
||||
{
|
||||
sparks = (rand() & 1) + 1;
|
||||
int sparks = (rand() & 1) + 1;
|
||||
for(;sparks>0;sparks--)
|
||||
{
|
||||
size = 0.2f + (random() * 0.4);
|
||||
float size = 0.2f + (random() * 0.4);
|
||||
FXE_Spray( normal, 200, 75, 0.8f, velocity);
|
||||
if (rand() & LEF_USE_COLLISION)
|
||||
{ // This spark bounces.
|
||||
|
|
|
@ -163,9 +163,7 @@ void FX_DisruptorBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboole
|
|||
{
|
||||
refEntity_t beam;
|
||||
sfxHandle_t sfx;
|
||||
float size;
|
||||
vec3_t velocity;
|
||||
int sparks;
|
||||
vec3_t rgb = { 1,0.9,0.6}, rgb2={1,0.3,0};
|
||||
|
||||
//vec3_t rgb3 = { 1.0, 1.0, 1.0 };
|
||||
|
@ -276,10 +274,10 @@ void FX_DisruptorBeamFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboole
|
|||
// "Fun" sparks... Not when empty.
|
||||
if ( spark && !empty)
|
||||
{
|
||||
sparks = (rand() & 1) + 1;
|
||||
int sparks = (rand() & 1) + 1;
|
||||
for(;sparks>0;sparks--)
|
||||
{
|
||||
size = 0.2f + (random() * 0.4);
|
||||
float size = 0.2f + (random() * 0.4);
|
||||
FXE_Spray( normal, 200, 75, 0.8f, velocity);
|
||||
if (rand() & LEF_USE_COLLISION)
|
||||
{ // This spark bounces.
|
||||
|
|
|
@ -39,9 +39,7 @@ void FX_PhaserFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean spar
|
|||
{
|
||||
refEntity_t beam;
|
||||
sfxHandle_t sfx;
|
||||
float size;
|
||||
vec3_t velocity;
|
||||
int sparks;
|
||||
vec3_t rgb = { 1,0.9,0.6}, rgb2={1,0.3,0};
|
||||
|
||||
//vec3_t rgb3 = { 1.0, 1.0, 1.0 };
|
||||
|
@ -152,10 +150,10 @@ void FX_PhaserFire( vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean spar
|
|||
// "Fun" sparks... Not when empty.
|
||||
if ( spark && !empty)
|
||||
{
|
||||
sparks = (rand() & 1) + 1;
|
||||
int sparks = (rand() & 1) + 1;
|
||||
for(;sparks>0;sparks--)
|
||||
{
|
||||
size = 0.2f + (random() * 0.4);
|
||||
float size = 0.2f + (random() * 0.4);
|
||||
FXE_Spray( normal, 200, 75, 0.8f, velocity);
|
||||
if (rand() & LEF_USE_COLLISION)
|
||||
{ // This spark bounces.
|
||||
|
@ -183,7 +181,6 @@ void FX_PhaserAltFire( vec3_t start, vec3_t end, vec3_t normal, qboolean spark,
|
|||
{
|
||||
float scale = flrandom(13.0f, 17.0f), scale2 = flrandom(2.0f, 6.0f);
|
||||
vec3_t vel, diff, end2;
|
||||
int i = 0, sparks = 0;
|
||||
refEntity_t beam;
|
||||
vec3_t rgb = { 1,0.6,0.5}, rgb2={1,0.3,0};
|
||||
float len;
|
||||
|
@ -325,12 +322,13 @@ void FX_PhaserAltFire( vec3_t start, vec3_t end, vec3_t normal, qboolean spark,
|
|||
{
|
||||
// kef -- fixme. dunno what the deal is with this velocity vector
|
||||
VectorClear(vel);
|
||||
sparks = (rand() & 3) + 1;
|
||||
int sparks = (rand() & 3) + 1;
|
||||
|
||||
// Set random starting pos...
|
||||
end2[0] = flrandom(-1.0, 1.0) + end[0];
|
||||
end2[1] = flrandom(-1.0, 1.0) + end[1];
|
||||
end2[2] = flrandom(-1.0, 1.0) + end[2];
|
||||
int 1;
|
||||
for( i = 0; i < sparks; i++ )
|
||||
{
|
||||
scale = 0.5f + (random() * 0.5);
|
||||
|
|
Loading…
Reference in a new issue