Skip to content

Commit

Permalink
Revision 333
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrochart committed Nov 22, 2022
1 parent 5298455 commit 3fff6eb
Show file tree
Hide file tree
Showing 27 changed files with 201 additions and 202 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Revision 310: Display damage indicator thru the walls.
Fix duplicate damages with shotgun when they are multiple targets.
Add cg_damagePlum: Controls which weapons will draw damage plumes.
Default is all: "/g/mg/sg/gl/rl/lg/rg/pg/bfg/cg/ng/pl/".
Revision 311: Added new features for cg_drawGun (4,5,6).
Revision 311: Add new feature for cg_drawGun (4,5,6).
Same as 1,2,3 but the weapons are transparent.
Revision 312: Some bug fixes from ioquake3.
Revision 313: Add double jump, air control and extra
Expand Down Expand Up @@ -49,3 +49,4 @@ Revision 330: Better fix for cg_drawTeamOverlay.
Fix the main spec model in multiview windows.
Revision 331: Improve the scoreboard.
Revision 332: Fix various bugs.
Revision 333: Bug fixes and cleanup, allow keywords in the text chat.
45 changes: 16 additions & 29 deletions code/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3052,7 +3052,11 @@ static void CG_DrawLagometer ( void ) {
CG_DrawStringHud ( HUD_NETGRAPHPING, qtrue, ( const char* ) va ( "%ims", cg.snap->ping ) );

if ( cg_nopredict.integer || cg_synchronousClients.integer ) {
CG_DrawBigString ( ax, ay, "snc", 1.0 );
if ( !cgs.hud[HUD_NETGRAPHPING].inuse ) {
ax = 640 - 48;
ay = 480 - 48;
CG_DrawBigString ( ax, ay, "snc", 1.0 );
}
}

CG_DrawDisconnect();
Expand Down Expand Up @@ -3561,7 +3565,6 @@ static void CG_DrawCrosshair3D ( void ) {
}



/*
=================
CG_ScanForCrosshairEntity
Expand Down Expand Up @@ -3595,14 +3598,8 @@ static void CG_ScanForCrosshairEntity ( int window ) {
}

// update the fade timer
if ( window ) {
cg.chcn[window] = trace.entityNum;
cg.chct[window] = cg.time;
}
else {
cg.crosshairClientNum = trace.entityNum;
cg.crosshairClientTime = cg.time;
}
cg.crosshairClientNum[window] = trace.entityNum;
cg.crosshairClientTime[window] = cg.time;
}


Expand All @@ -3615,7 +3612,6 @@ static void CG_DrawCrosshairNames ( int window ) {
float *color;
char *name;
int armorcolor, healthcolor;
int crosshairClientNum, crosshairClientTime;

if ( !cgs.hud[HUD_TARGETNAME].inuse )
return;
Expand All @@ -3631,23 +3627,14 @@ static void CG_DrawCrosshairNames ( int window ) {
// scan the known entities to see if the crosshair is sighted on one
CG_ScanForCrosshairEntity( window );

if ( window ) {
crosshairClientNum = cg.chcn[window];
crosshairClientTime = cg.chct[window];
}
else {
crosshairClientNum = cg.crosshairClientNum;
crosshairClientTime = cg.crosshairClientTime;
}

// draw the name of the player being looked at
color = CG_FadeColor ( crosshairClientTime, cgs.hud[HUD_TARGETNAME].time );
color = CG_FadeColor ( cg.crosshairClientTime[window], cgs.hud[HUD_TARGETNAME].time );
if ( !color ) {
trap_R_SetColor ( NULL );
return;
}

name = cgs.clientinfo[ crosshairClientNum ].name;
name = cgs.clientinfo[ cg.crosshairClientNum[window] ].name;

CG_DrawStringHud ( HUD_TARGETNAME, qtrue, name );

Expand All @@ -3656,27 +3643,27 @@ static void CG_DrawCrosshairNames ( int window ) {
if ( cg.snap->ps.persistant[PERS_TEAM] != TEAM_RED && cg.snap->ps.persistant[PERS_TEAM] != TEAM_BLUE )
return;

if ( cg.snap->ps.persistant[PERS_TEAM] != cgs.clientinfo[ crosshairClientNum ].team )
if ( cg.snap->ps.persistant[PERS_TEAM] != cgs.clientinfo[ cg.crosshairClientNum[window] ].team )
return;

if ( ( cgs.hud[HUD_TARGETSTATUS].inuse ) && ( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR ) ) {
if ( cgs.clientinfo[ crosshairClientNum ].health >= 100 )
if ( cgs.clientinfo[ cg.crosshairClientNum[window] ].health >= 100 )
healthcolor = 2;
else if ( cgs.clientinfo[ crosshairClientNum ].health >= 50 )
else if ( cgs.clientinfo[ cg.crosshairClientNum[window] ].health >= 50 )
healthcolor = 3;
else
healthcolor = 1;

if ( cgs.clientinfo[ crosshairClientNum ].armor >= 100 )
if ( cgs.clientinfo[ cg.crosshairClientNum[window] ].armor >= 100 )
armorcolor = 2;
else if ( cgs.clientinfo[ crosshairClientNum ].armor >= 50 )
else if ( cgs.clientinfo[ cg.crosshairClientNum[window] ].armor >= 50 )
armorcolor = 3;
else
armorcolor = 1;

CG_DrawStringHud ( HUD_TARGETSTATUS, qfalse, va ( "(^%i%i^7|^%i%i^7)", healthcolor,
cgs.clientinfo[ crosshairClientNum ].health, armorcolor,
cgs.clientinfo[ crosshairClientNum ].armor ) );
cgs.clientinfo[ cg.crosshairClientNum[window] ].health, armorcolor,
cgs.clientinfo[ cg.crosshairClientNum[window] ].armor ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void CG_DamagePlum( int client, vec3_t org, int damage, int mod ) {
retDamagePlum = CG_ParseDamagePlum ( mod );

// only visualize for the client that damaged
if (client != cg.predictedPlayerState.clientNum || !cg_damagePlums.integer || !retDamagePlum) {
if (client != cg.predictedPlayerState.clientNum || cg_damagePlums.integer == 0 || !retDamagePlum) {
return;
}

Expand Down
9 changes: 3 additions & 6 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,6 @@ enum{

//=========================SUPERHUD END==================================

#define MAX_MULTIVIEW 4

#define MAX_REWARDSTACK 10
#define MAX_SOUNDBUFFER 20

Expand Down Expand Up @@ -753,8 +751,8 @@ typedef struct {
int lastKillTime;

// crosshair client ID
int crosshairClientNum;
int crosshairClientTime;
int crosshairClientNum[MAX_MULTIVIEW];
int crosshairClientTime[MAX_MULTIVIEW];

// powerup active flashing
int powerupActive;
Expand Down Expand Up @@ -869,8 +867,6 @@ typedef struct {
int spawnTeam[MAX_SPAWNPOINTS];
int numSpawnpoints;
qboolean forceChat;
int chcn[MAX_MULTIVIEW];
int chct[MAX_MULTIVIEW];
int window;
} cg_t;

Expand Down Expand Up @@ -1756,6 +1752,7 @@ extern vmCvar_t cg_drawSpawnpoints;
extern vmCvar_t cg_mapoverview;
extern vmCvar_t cg_damagePlums;
extern vmCvar_t cg_damagePlum;
extern vmCvar_t cg_damagePlumScale;
extern vmCvar_t cg_waterWarp;
extern vmCvar_t cg_hudFullScreen;
extern vmCvar_t cg_fovAdjust;
Expand Down
11 changes: 6 additions & 5 deletions code/cgame/cg_localents.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ CG_AddDamagePlum
void CG_AddDamagePlum( localEntity_t *le ) {
refEntity_t *re;
vec3_t origin, delta, dir, vec, up = {0, 0, 1};
float c, len, scale;
float c, len, scale, cgscale;
int i, damage, digits[10], numdigits, negative;

re = &le->refEntity;
Expand Down Expand Up @@ -844,12 +844,13 @@ void CG_AddDamagePlum( localEntity_t *le ) {
VectorNormalize(vec);

VectorMA(origin, -8 + 6 * sin(c * 2 * M_PI), vec, origin);
cgscale = Com_Clamp(1, 2, cg_damagePlumScale.value);

// if the view would be "inside" the sprite, kill the sprite
// so it doesn't add too much overdraw
VectorSubtract( origin, cg.refdef.vieworg, delta );
len = VectorLength( delta );
if ( len < 20 ) {
if ( len < 20 * cgscale ) {
CG_FreeLocalEntity( le );
return;
}
Expand All @@ -864,8 +865,8 @@ void CG_AddDamagePlum( localEntity_t *le ) {
( ( cg.time - cg.zoomTime ) / (float)( cg_zoomScaling.value * ZOOM_TIME ) > 1 ) ) )
scale = (float)len / MAX_DISTANCE_ZOOM_NOSCALE;

origin[2] += 49 - cos (c * 4.8) * 34 * scale;
re->radius = NUMBER_SIZE / 2 * scale;
origin[2] += 49 - cos (c * 4.8) * 34 * scale * cgscale;
re->radius = NUMBER_SIZE / 2 * scale * cgscale;

negative = qfalse;
if (damage < 0) {
Expand All @@ -884,7 +885,7 @@ void CG_AddDamagePlum( localEntity_t *le ) {
}

for (i = 0; i < numdigits; i++) {
VectorMA(origin, (float) (((float) numdigits / 2) - i) * NUMBER_SIZE * scale, vec, re->origin);
VectorMA(origin, (float) (((float) numdigits / 2) - i) * NUMBER_SIZE * scale * cgscale, vec, re->origin);
re->customShader = cgs.media.numberShaders[digits[numdigits-1-i]];
re->renderfx = RF_DEPTHHACK;
trap_R_AddRefEntityToScene( re );
Expand Down
6 changes: 4 additions & 2 deletions code/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ vmCvar_t cg_drawSpawnpoints;
vmCvar_t cg_mapoverview;
vmCvar_t cg_damagePlums;
vmCvar_t cg_damagePlum;
vmCvar_t cg_damagePlumScale;
vmCvar_t cg_waterWarp;
vmCvar_t cg_hudFullScreen;
vmCvar_t cg_fovAdjust;
Expand Down Expand Up @@ -634,6 +635,7 @@ static cvarTable_t cvarTable[] = { // bk001129
{&cg_mapoverview, "cg_mapoverview", "0", CVAR_ARCHIVE | CVAR_CHEAT },
{&cg_damagePlums, "cg_damagePlums", "1", CVAR_USERINFO | CVAR_ARCHIVE },
{&cg_damagePlum, "cg_damagePlum", "/g/mg/sg/gl/rl/lg/rg/pg/bfg/cg/ng/pl/", CVAR_USERINFO | CVAR_ARCHIVE },
{&cg_damagePlumScale, "cg_damagePlumScale", "1.0", CVAR_USERINFO | CVAR_ARCHIVE },
{&cg_waterWarp, "cg_waterWarp", "1", CVAR_ARCHIVE },
{&cg_hudFullScreen, "cg_hudFullScreen", "0", CVAR_ARCHIVE},
{&cg_fovAdjust, "cg_fovAdjust", "0", CVAR_ARCHIVE},
Expand Down Expand Up @@ -841,10 +843,10 @@ void CG_UpdateCvars( void ) {
}

int CG_CrosshairPlayer( void ) {
if ( cg.time > ( cg.crosshairClientTime + 1000 ) ) {
if ( cg.time > ( cg.crosshairClientTime[0] + 1000 ) ) {
return -1;
}
return cg.crosshairClientNum;
return cg.crosshairClientNum[0];
}

int CG_LastAttacker( void ) {
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_playerstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void CG_DamageFeedback( int yawByte, int pitchByte, int damage ) {

vectoangles(dir, angles);

cg.v_dmg_roll = kick * left;
cg.v_dmg_roll = kick * left;
cg.v_dmg_pitch = -kick * front;
cg.v_dmg_angle = angles[YAW];

Expand Down
3 changes: 1 addition & 2 deletions code/cgame/cg_predict.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ static void CG_ClipMoveToEntities ( const vec3_t start, const vec3_t mins, const
VectorCopy( cent->lerpOrigin, origin );
}


trap_CM_TransformedBoxTrace ( &trace, start, end,
mins, maxs, cmodel, mask, origin, angles);
mins, maxs, cmodel, mask, origin, angles);

if (trace.allsolid || trace.fraction < tr->fraction) {
trace.entityNum = ent->number;
Expand Down
Loading

0 comments on commit 3fff6eb

Please sign in to comment.