diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-14 23:56:20 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:51 +0000 |
commit | fc8352965d47d726086baae033a283839bb1358c (patch) | |
tree | a46dd5f6e7885dd3b0fcc3d818e671b875e8ac4d | |
parent | 20b6c68b9511adddf32030f5785eb2667a7f0e8c (diff) |
* Various small style fixes/corrections/changes (Undeference, Timbo, benmachine)
* Restore /ignore functionality to a couple message types I forgot (Undeference)
* Fix some color bleeds on names (Rezyn)
* Fix an uninitialized buffer in featured labels (Rezyn)
* Apply team colors to only the letter and not the brackets too, in cg_chatteamprefix (Undeference)
* Default cg_drawcrosshairs 2, crosshairs for everything (kevlarman)
-rw-r--r-- | src/cgame/cg_draw.c | 33 | ||||
-rw-r--r-- | src/cgame/cg_drawtools.c | 10 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 35 | ||||
-rw-r--r-- | src/client/cl_main.c | 2 | ||||
-rw-r--r-- | src/game/bg_public.h | 12 | ||||
-rw-r--r-- | src/game/g_team.c | 13 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 11 |
8 files changed, 57 insertions, 61 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 111cb12f..296932d6 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1620,24 +1620,23 @@ static void CG_DrawTimer( rectDef_t *rect, float text_x, float text_y, CG_DrawTeamOverlay ================= */ - static void CG_DrawTeamOverlay( rectDef_t *rect, float scale, vec4_t color ) { - char *s; - int i; - float x = rect->x; - float y, dx; + char *s; + int i; + float x = rect->x; + float y, dx; clientInfo_t *ci, *pci; - vec4_t tcolor; - float iconSize = rect->h/8.0f; - float leftMargin = 4.0f; - float iconTopMargin = 2.0f; - float midSep = 2.0f; - float backgroundWidth = rect->w; - float fontScale = 0.30f; - int maxDisplayCount = 0; - int displayCount = 0; - weapon_t curWeapon = WP_NONE; + vec4_t tcolor; + float iconSize = rect->h / 8.0f; + float leftMargin = 4.0f; + float iconTopMargin = 2.0f; + float midSep = 2.0f; + float backgroundWidth = rect->w; + float fontScale = 0.30f; + int maxDisplayCount = 0; + int displayCount = 0; + weapon_t curWeapon = WP_NONE; if( cg.predictedPlayerState.pm_type == PM_SPECTATOR ) return; @@ -1645,11 +1644,11 @@ static void CG_DrawTeamOverlay( rectDef_t *rect, float scale, vec4_t color ) if( !cg_drawTeamOverlay.integer || !cg_teamOverlayMaxPlayers.integer ) return; - if( !cgs.teaminfoReceievedTime ) return; + if( !cgs.teaminfoReceievedTime ) + return; pci = cgs.clientinfo + cg.snap->ps.clientNum; - for( i = 0; i < MAX_CLIENTS; i++ ) { ci = cgs.clientinfo + i; diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c index 17eb7ac6..726c4de9 100644 --- a/src/cgame/cg_drawtools.c +++ b/src/cgame/cg_drawtools.c @@ -412,17 +412,17 @@ CG_GetColorCharForHealth char CG_GetColorCharForHealth( int clientnum ) { char health_char = '2'; - int healthPercent; - int maxHealth; - int curWeaponClass = cgs.clientinfo[ clientnum ].curWeaponClass; + int healthPercent; + int maxHealth; + int curWeaponClass = cgs.clientinfo[ clientnum ].curWeaponClass; if( cgs.clientinfo[ clientnum ].team == TEAM_ALIENS ) maxHealth = BG_Class( curWeaponClass )->health; else maxHealth = BG_Class( PCL_HUMAN )->health; - healthPercent = (int) ( 100.0f * (float) cgs.clientinfo[ clientnum ].health - / (float) maxHealth ); + healthPercent = (int) ( 100.0f * (float) cgs.clientinfo[ clientnum ].health / + (float) maxHealth ); if( healthPercent < 33 ) health_char = '1'; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 562b8038..cf1e1eff 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -241,7 +241,7 @@ static cvarTable_t cvarTable[ ] = { &cg_drawDemoState, "cg_drawDemoState", "1", CVAR_ARCHIVE }, { &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE }, { &cg_drawChargeBar, "cg_drawChargeBar", "1", CVAR_ARCHIVE }, - { &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE }, + { &cg_drawCrosshair, "cg_drawCrosshair", "2", CVAR_ARCHIVE }, { &cg_drawCrosshairNames, "cg_drawCrosshairNames", "1", CVAR_ARCHIVE }, { &cg_crosshairSize, "cg_crosshairSize", "1", CVAR_ARCHIVE }, { &cg_addMarks, "cg_marks", "1", CVAR_ARCHIVE }, diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index fb290db3..0cf7f144 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -916,7 +916,7 @@ static void CG_Say( int clientNum, saymode_t mode, const char *text ) { clientInfo_t *ci; char *prefix, *name; - qboolean isIgnored = qfalse; + char *ignore = ""; char *location = ""; char tcolor = COLOR_WHITE; char color; @@ -929,7 +929,7 @@ static void CG_Say( int clientNum, saymode_t mode, const char *text ) if( ci ) { - name = ci->name; + name = va( "%s" S_COLOR_WHITE, ci->name ); if( ci->team == TEAM_ALIENS ) tcolor = COLOR_RED; else if( ci->team == TEAM_HUMANS ) @@ -939,7 +939,7 @@ static void CG_Say( int clientNum, saymode_t mode, const char *text ) name = "console"; if( ci && cg_chatTeamPrefix.integer ) - prefix = va( "^%c[%c] " S_COLOR_WHITE, + prefix = va( "[^%c%c" S_COLOR_WHITE "] " S_COLOR_WHITE, tcolor, toupper( *( BG_TeamName( ci->team ) ) ) ); else prefix = ""; @@ -954,44 +954,39 @@ static void CG_Say( int clientNum, saymode_t mode, const char *text ) } if( ci && Com_ClientListContains( &cgs.ignoreList, clientNum ) ) - isIgnored = qtrue; + ignore = "[skipnotify]"; switch( mode ) { case SAY_ALL: - if( isIgnored || ( ci && cg_teamChatsOnly.integer ) ) + if( cg_teamChatsOnly.integer ) CG_Printf( "[skipnotify]%s%s: " S_COLOR_GREEN "%s\n", prefix, name, text ); else - CG_Printf( "%s%s: " S_COLOR_GREEN "%s\n", prefix, name, text ); + CG_Printf( "%s%s%s: " S_COLOR_GREEN "%s\n", ignore, prefix, name, text ); break; case SAY_TEAM: - CG_Printf( "%s(%s)%s: " S_COLOR_CYAN "%s\n", - prefix, name, location, text ); + CG_Printf( "%s%s(%s)%s: " S_COLOR_CYAN "%s\n", + ignore, prefix, name, location, text ); break; case SAY_ADMINS: - CG_Printf( "%s[ADMIN]%s: " S_COLOR_MAGENTA "%s\n", prefix, name, text ); + CG_Printf( "%s%s[ADMIN]%s: " S_COLOR_MAGENTA "%s\n", ignore, prefix, name, text ); break; case SAY_ADMINS_PUBLIC: - CG_Printf( "%s[PLAYER]%s: " S_COLOR_MAGENTA "%s\n", prefix, name, text ); + CG_Printf( "%s%s[PLAYER]%s: " S_COLOR_MAGENTA "%s\n", ignore, prefix, name, text ); break; case SAY_AREA: - CG_Printf( "%s<%s>: " S_COLOR_BLUE "%s\n", prefix, name, text ); + CG_Printf( "%s%s<%s>: " S_COLOR_BLUE "%s\n", ignore, prefix, name, text ); break; case SAY_PRIVMSG: case SAY_TPRIVMSG: color = ( mode == SAY_TPRIVMSG ) ? COLOR_CYAN : COLOR_GREEN; - if( isIgnored ) - CG_Printf( "[skipnotify]%s" S_COLOR_YELLOW " -> " S_COLOR_WHITE "%s: " - "^%c%s\n", name, cgs.clientinfo[ cg.clientNum ].name, color, - text ); - else - { - CG_Printf( "%s" S_COLOR_YELLOW " -> " S_COLOR_WHITE "%s: ^%c%s\n", - name, cgs.clientinfo[ cg.clientNum ].name, color, text ); + CG_Printf( "%s%s" S_COLOR_YELLOW " -> " S_COLOR_WHITE "%s" S_COLOR_WHITE ": " + "^%c%s\n", ignore, name, cgs.clientinfo[ cg.clientNum ].name, color, + text ); + if( ignore[0] ) CG_CenterPrint( va( "^%cPrivate message from: " S_COLOR_WHITE "%s", color, name ), 200, GIANTCHAR_WIDTH * 4 ); - } break; case SAY_RAW: CG_Printf( "%s\n", text ); diff --git a/src/client/cl_main.c b/src/client/cl_main.c index a8b59c27..5246ccd8 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -2387,7 +2387,7 @@ void CL_ServersResponsePacket( const netadr_t* from, msg_t *msg, qboolean extend int numservers; byte* buffptr; byte* buffend; - char label[MAX_FEATLABEL_CHARS]; + char label[MAX_FEATLABEL_CHARS] = ""; Com_DPrintf("CL_ServersResponsePacket%s\n", (extended) ? " (extended)" : ""); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index d1cc4572..8d74c18c 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -837,6 +837,18 @@ typedef enum NUM_TEAMS } team_t; +// modes of text communication +typedef enum +{ + SAY_ALL, + SAY_TEAM, + SAY_PRIVMSG, + SAY_TPRIVMSG, + SAY_AREA, + SAY_ADMINS, + SAY_ADMINS_PUBLIC, + SAY_RAW +} saymode_t; // means of death typedef enum diff --git a/src/game/g_team.c b/src/game/g_team.c index dbaf2b40..62805b3c 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -289,14 +289,15 @@ Format: */ void TeamplayInfoMessage( gentity_t *ent ) { - char entry[ 19 ], string[ 1143 ]; - int i, j, team, stringlength; - int sent = 0; + char entry[ 19 ], string[ 1143 ]; + int i, j; + int team, stringlength; + int sent = 0; gentity_t *player; gclient_t *cl; upgrade_t upgrade = UP_NONE; - int curWeaponClass = WP_NONE ; // sends weapon for humans, class for aliens - char *tmp; + int curWeaponClass = WP_NONE ; // sends weapon for humans, class for aliens + char *tmp; if( !g_allowTeamOverlay.integer ) return; @@ -332,7 +333,7 @@ void TeamplayInfoMessage( gentity_t *ent ) curWeaponClass = WP_NONE; upgrade = UP_NONE; } - else if (cl->pers.teamSelection == TEAM_HUMANS ) + else if ( cl->pers.teamSelection == TEAM_HUMANS ) { curWeaponClass = cl->ps.weapon; diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 8cdc5ae6..c37f09d2 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -1379,17 +1379,6 @@ typedef enum { #define MAX_PINGREQUESTS 32 #define MAX_SERVERSTATUSREQUESTS 16 -typedef enum { - SAY_ALL, - SAY_TEAM, - SAY_PRIVMSG, - SAY_TPRIVMSG, - SAY_AREA, - SAY_ADMINS, - SAY_ADMINS_PUBLIC, - SAY_RAW -} saymode_t; - #define MAX_EMOTICON_NAME_LEN 16 #define MAX_EMOTICONS 64 |