//4 feature darkplaces csqc: add builtins to clientside qc for gl calls
sfx_t *S_FindName(const char *name);
-int Sbar_GetPlayer (int index);
+int Sbar_GetSortedPlayerIndex (int index);
void Sbar_SortFrags (void);
void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius);
void CSQC_RelinkAllEntities (int drawmask);
if( mod ) {
// TODO: check if this breaks needed consistency and maybe add a cvar for it too?? [1/10/2008 Black]
//SetMinMaxSize (e, mod->normalmins, mod->normalmaxs);
- }
+ }
else
{
SetMinMaxSize (e, vec3_origin, vec3_origin);
PRVM_G_INT(OFS_RETURN) = OFS_NULL;
Sbar_SortFrags();
- i = Sbar_GetPlayer(i);
- if(i < 0)
+ if (i < 0)
+ i = Sbar_GetSortedPlayerIndex(-1-i);
+ if(i < 0 || i >= cl.maxclients)
return;
t[0] = 0;
}
*out = 0;
}
-int Sbar_GetPlayer (int index); // <- safety?
// Now it becomes TRICKY :D --blub
static char Nicks_list[MAX_SCOREBOARD][MAX_SCOREBOARDNAME]; // contains the nicks with colors and all that
return Nicks_strncasecmp_nospaces(a, b, a_len);
return strncasecmp(a, b, a_len);
}
-
+
space_char = (con_nickcompletion_flags.integer & NICKS_NO_SPACES) ? 'a' : ' ';
-
+
// ignore non alphanumerics of B
// if A contains a non-alphanumeric, B must contain it as well though!
while(a_len)
{
qboolean alnum_a, alnum_b;
-
+
if(tolower(*a) == tolower(*b))
{
if(*a == 0) // end of both strings, they're equal
int match;
int spos;
int count = 0;
-
+
if(!con_nickcompletion.integer)
return 0;
// changed that to 1
if(!line[0])// || !line[1]) // we want at least... 2 written characters
return 0;
-
+
for(i = 0; i < cl.maxclients; ++i)
{
- /*p = Sbar_GetPlayer(i);
- if(p < 0)
- break;*/
p = i;
if(!cl.scores[p].name[0])
continue;
SanitizeString(cl.scores[p].name, name);
//Con_Printf("Sanitized: %s^7 -> %s", cl.scores[p].name, name);
-
+
if(!name[0])
continue;
-
+
length = strlen(name);
match = -1;
spos = pos - 1; // no need for a minimum of characters :)
-
+
while(spos >= 0 && (spos - pos) < length) // search-string-length < name length
{
if(spos > 0 && line[spos-1] != ' ' && line[spos-1] != ';' && line[spos-1] != '\"' && line[spos-1] != '\'')
{
Nicks_matchpos = match;
}
-
+
Nicks_offset[count] = s - (&line[match]);
//Con_Printf("offset for %s: %i\n", name, Nicks_offset[count]);
l = strlen(Nicks_sanlist[i]) - 1;
if(l < c)
c = l;
-
+
for(l = 0; l <= c; ++l)
if(tolower(Nicks_sanlist[0][l]) != tolower(Nicks_sanlist[i][l]))
{
char tempstr[sizeof(Nicks_sanlist[0])];
char *a, *b;
char space_char = (con_nickcompletion_flags.integer & NICKS_NO_SPACES) ? 'a' : ' '; // yes this is correct, we want NO spaces when no spaces
-
+
c = strlen(Nicks_sanlist[0]);
for(i = 0, l = 0; i < (int)c; ++i)
{
}
}
tempstr[l] = 0;
-
+
for(i = 1; i < count; ++i)
{
a = tempstr;
unsigned int c, l;
char tempstr[sizeof(Nicks_sanlist[0])];
char *a, *b;
-
+
c = strlen(Nicks_sanlist[0]);
for(i = 0, l = 0; i < (int)c; ++i)
{
}
}
tempstr[l] = 0;
-
+
for(i = 1; i < count; ++i)
{
a = tempstr;
buf[bpos] = Nicks_sanlist[bpos] + Nicks_offset[bpos];
Nicks_CutMatches(count);
-
+
buf[bpos] = NULL;
return buf;
}
qboolean quote_added = false;
int match;
char color = '7';
-
+
if(con_nickcompletion_flags.integer & NICKS_ADD_QUOTE && buffer[Nicks_matchpos-1] == '\"')
{
// we'll have to add a quote :)
buffer[pos++] = '\"';
quote_added = true;
}
-
+
if((!quote_added && con_nickcompletion_flags.integer & NICKS_ADD_COLOR) || con_nickcompletion_flags.integer & NICKS_FORCE_COLOR)
{
// add color when no quote was added, or when flags &4?
{
size_t len;
char *msg;
-
+
msg = Nicks_list[0];
len = min(size - Nicks_matchpos - 3, strlen(msg));
memcpy(&buffer[Nicks_matchpos], msg, len);
int c, v, a, i, cmd_len, pos, k;
int n; // nicks --blub
const char *space, *patterns;
-
+
//find what we want to complete
pos = key_linepos;
while(--pos)
}
if (!(c + v + a + n)) // No possible matches
- {
+ {
if(s2[0])
strlcpy(&key_lines[edit_line][key_linepos], s2, sizeof(key_lines[edit_line]) - key_linepos);
return;
cmd = *(list[2] = Cmd_CompleteAliasBuildList(s));
if (n)
cmd = *(list[3] = Nicks_CompleteBuildList(n));
-
+
for (cmd_len = (int)strlen(s);;cmd_len++)
{
const char **l;