use player.team instead of infokey team
use player.name instead of infokey name add weak per team hash for cl_standardchat/cl_standardmsg for cl.teamplay use obtained freq for SDL git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1552 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
e3db3df028
commit
c916e40299
4 changed files with 53 additions and 42 deletions
|
@ -1059,7 +1059,7 @@ void CL_ParseDownload (void)
|
||||||
|
|
||||||
if (!*cls.downloadname) //huh... that's not right...
|
if (!*cls.downloadname) //huh... that's not right...
|
||||||
{
|
{
|
||||||
Con_Printf("^1Warning: Server sending unknown file.\n");
|
Con_Printf("^1Warning^7: Server sending unknown file.\n");
|
||||||
strcpy(cls.downloadname, "unknown.txt");
|
strcpy(cls.downloadname, "unknown.txt");
|
||||||
strcpy(cls.downloadtempname, "unknown.tmp");
|
strcpy(cls.downloadtempname, "unknown.tmp");
|
||||||
}
|
}
|
||||||
|
@ -3191,6 +3191,32 @@ int CL_PlayerColor(player_info_t *plr, int *name_ormask)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (cl.teamplay)
|
||||||
|
{
|
||||||
|
// team name hacks
|
||||||
|
if (!strcmp(plr->team, "red"))
|
||||||
|
c = 1;
|
||||||
|
else if (!strcmp(plr->team, "blue"))
|
||||||
|
c = 6;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *t;
|
||||||
|
|
||||||
|
t = plr->team;
|
||||||
|
c = 0;
|
||||||
|
|
||||||
|
for (t = plr->team; *t; t++)
|
||||||
|
{
|
||||||
|
c >>= 1;
|
||||||
|
c ^= *t; // TODO: very weak hash, replace
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((c / 7) & 1)
|
||||||
|
*name_ormask = CON_STANDARDMASK;
|
||||||
|
|
||||||
|
c = 1 + (c % 7);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// override chat color with tc infokey
|
// override chat color with tc infokey
|
||||||
|
@ -3360,9 +3386,9 @@ void CL_PrintStandardMessage(char *msg)
|
||||||
int ormask;
|
int ormask;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if (!p->name[0])
|
name = p->name;
|
||||||
|
if (!(*name))
|
||||||
continue;
|
continue;
|
||||||
name = Info_ValueForKey (p->userinfo, "name");
|
|
||||||
len = strlen(name);
|
len = strlen(name);
|
||||||
v = strstr(msg, name);
|
v = strstr(msg, name);
|
||||||
while (v)
|
while (v)
|
||||||
|
|
|
@ -1119,8 +1119,8 @@ void Sbar_SortTeams (void)
|
||||||
|
|
||||||
// find his team in the list
|
// find his team in the list
|
||||||
t[16] = 0;
|
t[16] = 0;
|
||||||
Q_strncpyz(t, Info_ValueForKey(s->userinfo, "team"), sizeof(t));
|
Q_strncpyz(t, s->team, sizeof(t));
|
||||||
if (!t || !t[0])
|
if (!t[0])
|
||||||
continue; // not on team
|
continue; // not on team
|
||||||
for (j = 0; j < scoreboardteams; j++)
|
for (j = 0; j < scoreboardteams; j++)
|
||||||
if (!strcmp(teams[j].team, t)) {
|
if (!strcmp(teams[j].team, t)) {
|
||||||
|
@ -1881,8 +1881,7 @@ void Sbar_TeamOverlay (void)
|
||||||
sprintf (num, "%5i", tm->players);
|
sprintf (num, "%5i", tm->players);
|
||||||
Draw_String (x + 104 + 88, y, num);
|
Draw_String (x + 104 + 88, y, num);
|
||||||
|
|
||||||
if (!strncmp(Info_ValueForKey(cl.players[cl.playernum[0]].userinfo,
|
if (!strncmp(cl.players[cl.playernum[0]].team, tm->team, 16)) {
|
||||||
"team"), tm->team, 16)) {
|
|
||||||
Draw_Character ( x + 104 - 8, y, 16);
|
Draw_Character ( x + 104 - 8, y, 16);
|
||||||
Draw_Character ( x + 104 + 32, y, 17);
|
Draw_Character ( x + 104 + 32, y, 17);
|
||||||
}
|
}
|
||||||
|
@ -1911,7 +1910,6 @@ void Sbar_DeathmatchOverlay (int start)
|
||||||
int total;
|
int total;
|
||||||
int minutes;
|
int minutes;
|
||||||
int p;
|
int p;
|
||||||
char team[64];
|
|
||||||
int skip = 10;
|
int skip = 10;
|
||||||
|
|
||||||
if (largegame)
|
if (largegame)
|
||||||
|
@ -2044,10 +2042,7 @@ void Sbar_DeathmatchOverlay (int start)
|
||||||
|
|
||||||
// team
|
// team
|
||||||
if (cl.teamplay)
|
if (cl.teamplay)
|
||||||
{
|
Draw_FunStringLen (x+152, y, s->team, 4);
|
||||||
Q_strncpyz (team, Info_ValueForKey(s->userinfo, "team"), sizeof(team));
|
|
||||||
Draw_FunStringLen (x+152, y, team, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw name
|
// draw name
|
||||||
if (cl.teamplay)
|
if (cl.teamplay)
|
||||||
|
@ -2091,9 +2086,9 @@ void Sbar_ChatModeOverlay(void)
|
||||||
Sbar_SortFrags (true);
|
Sbar_SortFrags (true);
|
||||||
|
|
||||||
if (Cam_TrackNum(0)>=0)
|
if (Cam_TrackNum(0)>=0)
|
||||||
Q_strncpyz (team, Info_ValueForKey(cl.players[Cam_TrackNum(0)].userinfo, "team"), sizeof(team));
|
Q_strncpyz (team, cl.players[Cam_TrackNum(0)].team, sizeof(team));
|
||||||
else if (cl.playernum[0]>=0 && cl.playernum[0]<MAX_CLIENTS)
|
else if (cl.playernum[0]>=0 && cl.playernum[0]<MAX_CLIENTS)
|
||||||
Q_strncpyz (team, Info_ValueForKey(cl.players[cl.playernum[0]].userinfo, "team"), sizeof(team));
|
Q_strncpyz (team, cl.players[cl.playernum[0]].team, sizeof(team));
|
||||||
else
|
else
|
||||||
*team = '\0';
|
*team = '\0';
|
||||||
|
|
||||||
|
@ -2143,7 +2138,7 @@ void Sbar_ChatModeOverlay(void)
|
||||||
}
|
}
|
||||||
else if (cl.teamplay)
|
else if (cl.teamplay)
|
||||||
{
|
{
|
||||||
if (!stricmp(Info_ValueForKey(s->userinfo, "team"), team))
|
if (!stricmp(s->team, team))
|
||||||
{
|
{
|
||||||
Draw_Character ( x, y, '[');
|
Draw_Character ( x, y, '[');
|
||||||
Draw_Character ( x+8*3, y, ']');
|
Draw_Character ( x+8*3, y, ']');
|
||||||
|
@ -2181,7 +2176,6 @@ void Sbar_MiniDeathmatchOverlay (void)
|
||||||
int x, y, f;
|
int x, y, f;
|
||||||
char num[12];
|
char num[12];
|
||||||
player_info_t *s;
|
player_info_t *s;
|
||||||
char team[64];
|
|
||||||
int numlines;
|
int numlines;
|
||||||
char name[64+1];
|
char name[64+1];
|
||||||
team_t *tm;
|
team_t *tm;
|
||||||
|
@ -2258,9 +2252,7 @@ void Sbar_MiniDeathmatchOverlay (void)
|
||||||
// team and name
|
// team and name
|
||||||
if (cl.teamplay)
|
if (cl.teamplay)
|
||||||
{
|
{
|
||||||
Q_strncpyz (team, Info_ValueForKey(s->userinfo, "team"), sizeof(team));
|
Draw_FunStringLen (x+48, y, s->team, 4);
|
||||||
Draw_FunStringLen (x+48, y, team, 4);
|
|
||||||
|
|
||||||
Draw_FunStringLen (x+48+40, y, name, MAX_DISPLAYEDNAME);
|
Draw_FunStringLen (x+48+40, y, name, MAX_DISPLAYEDNAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2286,15 +2278,13 @@ void Sbar_MiniDeathmatchOverlay (void)
|
||||||
tm = teams + k;
|
tm = teams + k;
|
||||||
|
|
||||||
// draw pings
|
// draw pings
|
||||||
Q_strncpyz (team, tm->team, sizeof(team));
|
Draw_FunStringLen (x, y, tm->team, 4);
|
||||||
Draw_FunStringLen (x, y, team, 4);
|
|
||||||
|
|
||||||
// draw total
|
// draw total
|
||||||
sprintf (num, "%5i", tm->frags);
|
sprintf (num, "%5i", tm->frags);
|
||||||
Draw_FunString(x + 40, y, num);
|
Draw_FunString(x + 40, y, num);
|
||||||
|
|
||||||
if (!strncmp(Info_ValueForKey(cl.players[cl.playernum[0]].userinfo,
|
if (!strncmp(cl.players[cl.playernum[0]].team, tm->team, 16)) {
|
||||||
"team"), tm->team, 16)) {
|
|
||||||
Draw_Character ( x - 8, y, 16);
|
Draw_Character ( x - 8, y, 16);
|
||||||
Draw_Character ( x + 32, y, 17);
|
Draw_Character ( x + 32, y, 17);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ Con_Printf("SDL AUDIO INITING\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sc->sn.numchannels = obtained.channels;
|
sc->sn.numchannels = obtained.channels;
|
||||||
sc->sn.speed = desired.freq;
|
sc->sn.speed = obtained.freq;
|
||||||
sc->sn.samplebits = 16;
|
sc->sn.samplebits = 16;
|
||||||
sc->sn.samples = SOUND_BUFFER_SIZE;
|
sc->sn.samples = SOUND_BUFFER_SIZE;
|
||||||
sc->sn.buffer = malloc(SOUND_BUFFER_SIZE*sc->sn.samplebits/8);
|
sc->sn.buffer = malloc(SOUND_BUFFER_SIZE*sc->sn.samplebits/8);
|
||||||
|
|
|
@ -1745,19 +1745,22 @@ int TP_CountPlayers (void)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *TP_PlayerTeam (void)
|
||||||
|
{
|
||||||
|
return cl.players[cl.playernum[SP]].team;
|
||||||
|
}
|
||||||
|
|
||||||
char *TP_EnemyTeam (void)
|
char *TP_EnemyTeam (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char myteam[MAX_INFO_KEY];
|
|
||||||
static char enemyteam[MAX_INFO_KEY];
|
static char enemyteam[MAX_INFO_KEY];
|
||||||
|
char *myteam = TP_PlayerTeam();
|
||||||
strcpy (myteam, Info_ValueForKey(cls.userinfo, "team"));
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_CLIENTS ; i++) {
|
for (i = 0; i < MAX_CLIENTS ; i++) {
|
||||||
if (cl.players[i].name[0] && !cl.players[i].spectator)
|
if (cl.players[i].name[0] && !cl.players[i].spectator)
|
||||||
{
|
{
|
||||||
strcpy (enemyteam, Info_ValueForKey(cl.players[i].userinfo, "team"));
|
strcpy (enemyteam, cl.players[i].team);
|
||||||
if (strcmp(myteam, enemyteam) != 0)
|
if (strcmp(myteam, cl.players[i].team) != 0)
|
||||||
return enemyteam;
|
return enemyteam;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1766,30 +1769,22 @@ char *TP_EnemyTeam (void)
|
||||||
|
|
||||||
char *TP_PlayerName (void)
|
char *TP_PlayerName (void)
|
||||||
{
|
{
|
||||||
static char myname[MAX_INFO_KEY];
|
return cl.players[cl.playernum[SP]].name;
|
||||||
strcpy (myname, Info_ValueForKey(cl.players[cl.playernum[SP]].userinfo, "name"));
|
|
||||||
return myname;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *TP_PlayerTeam (void)
|
|
||||||
{
|
|
||||||
static char myteam[MAX_INFO_KEY];
|
|
||||||
strcpy (myteam, Info_ValueForKey(cl.players[cl.playernum[SP]].userinfo, "team"));
|
|
||||||
return myteam;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *TP_EnemyName (void)
|
char *TP_EnemyName (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *myname;
|
char *myname;
|
||||||
static char enemyname[MAX_INFO_KEY];
|
static char enemyname[MAX_SCOREBOARDNAME];
|
||||||
|
|
||||||
myname = TP_PlayerName ();
|
myname = TP_PlayerName ();
|
||||||
|
|
||||||
for (i = 0; i < MAX_CLIENTS ; i++) {
|
for (i = 0; i < MAX_CLIENTS ; i++) {
|
||||||
if (cl.players[i].name[0] && !cl.players[i].spectator)
|
if (cl.players[i].name[0] && !cl.players[i].spectator)
|
||||||
{
|
{
|
||||||
strcpy (enemyname, Info_ValueForKey(cl.players[i].userinfo, "name"));
|
strcpy (enemyname, cl.players[i].name);
|
||||||
if (!strcmp(enemyname, myname))
|
if (!strcmp(enemyname, myname))
|
||||||
return enemyname;
|
return enemyname;
|
||||||
}
|
}
|
||||||
|
@ -1975,9 +1970,9 @@ int TP_CategorizeMessage (char *s, int *offset, player_info_t **plr)
|
||||||
|
|
||||||
for (i=0, player=cl.players ; i < MAX_CLIENTS ; i++, player++)
|
for (i=0, player=cl.players ; i < MAX_CLIENTS ; i++, player++)
|
||||||
{
|
{
|
||||||
if (!player->name[0])
|
name = player->name;
|
||||||
|
if (!(*name))
|
||||||
continue;
|
continue;
|
||||||
name = Info_ValueForKey (player->userinfo, "name");
|
|
||||||
len = strlen(name);
|
len = strlen(name);
|
||||||
// check messagemode1
|
// check messagemode1
|
||||||
if (len+2 <= msglen && s[len] == ':' && s[len+1] == ' ' &&
|
if (len+2 <= msglen && s[len] == ':' && s[len+1] == ' ' &&
|
||||||
|
|
Loading…
Reference in a new issue