1
0
Fork 0
forked from fte/fteqw

Fix for the random missing strings.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1409 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-10-01 14:16:57 +00:00
parent 9f279a025c
commit 32da3157b4

View file

@ -5526,6 +5526,7 @@ static int chrconv_punct(int i, int base, int conv)
} }
return i + base; return i + base;
} }
static int chrchar_alpha(int i, int basec, int baset, int convc, int convt, int charnum) static int chrchar_alpha(int i, int basec, int baset, int convc, int convt, int charnum)
{ {
//convert case and colour seperatly... //convert case and colour seperatly...
@ -5568,18 +5569,17 @@ static int chrchar_alpha(int i, int basec, int baset, int convc, int convt, int
void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
int ccase = G_FLOAT(OFS_PARM0); //0 same, 1 lower, 2 upper int ccase = G_FLOAT(OFS_PARM0); //0 same, 1 lower, 2 upper
int redalpha = G_FLOAT(OFS_PARM1); //0 same, 1 white, 2 red int redalpha = G_FLOAT(OFS_PARM1); //0 same, 1 white, 2 red, 5 alternate, 6 alternate-alternate
int redchars = G_FLOAT(OFS_PARM2); //0 same, 1 white, 2 red, 3 redspecial, 4 whitespecial int redchars = G_FLOAT(OFS_PARM2); //0 same, 1 white, 2 red, 3 redspecial, 4 whitespecial, 5 alternate, 6 alternate-alternate
unsigned char *string = PF_VarString(prinst, 3, pr_globals); unsigned char *string = PF_VarString(prinst, 3, pr_globals);
int len = strlen(string); int len = strlen(string);
int i; int i;
unsigned char *result = PF_TempStr(prinst); unsigned char *result = PF_TempStr(prinst);
unsigned char *resbuf = result;
if (len >= MAXTEMPBUFFERLEN) if (len >= MAXTEMPBUFFERLEN)
len = MAXTEMPBUFFERLEN-1; len = MAXTEMPBUFFERLEN-1;
RETURN_SSTRING(((char*)result));
for (i = 0; i < len; i++, string++, result++) //do this backwards for (i = 0; i < len; i++, string++, result++) //do this backwards
{ {
if (*string >= '0' && *string <= '9') //normal numbers... if (*string >= '0' && *string <= '9') //normal numbers...
@ -5608,6 +5608,8 @@ void PF_strconv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
*result = chrconv_punct(*string, 128, redalpha); *result = chrconv_punct(*string, 128, redalpha);
} }
*result = '\0'; *result = '\0';
RETURN_TSTRING(((char*)resbuf));
} }
//FTE_STRINGS //FTE_STRINGS
@ -6197,7 +6199,7 @@ lh_extension_t QSG_Extensions[] = {
//eperimental advanced strings functions. //eperimental advanced strings functions.
//reuses the FRIK_FILE builtins (with substring extension) //reuses the FRIK_FILE builtins (with substring extension)
{"FTE_STRINGS", 18, NULL, {"stof", "strlen","strcat","substring","stov","strzone","strunzone", {"FTE_STRINGS", 16, NULL, {"stof", "strlen","strcat","substring","stov","strzone","strunzone",
"strstrofs", "str2chr", "chr2str", "strconv", "infoadd", "infoget", "strncmp", "strcasecmp", "strncasecmp"}}, "strstrofs", "str2chr", "chr2str", "strconv", "infoadd", "infoget", "strncmp", "strcasecmp", "strncasecmp"}},
{"FTE_TE_STANDARDEFFECTBUILTINS", 16, NULL, {"te_gunshot", "te_spike", "te_superspike", "te_explosion", "te_tarexplosion", "te_wizspike", "te_knightspike", "te_lavasplash", {"FTE_TE_STANDARDEFFECTBUILTINS", 16, NULL, {"te_gunshot", "te_spike", "te_superspike", "te_explosion", "te_tarexplosion", "te_wizspike", "te_knightspike", "te_lavasplash",
@ -6537,7 +6539,7 @@ void PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals)
pad = 0; pad = 0;
Q_strncpyz(dest+pad, src, MAXTEMPBUFFERLEN-pad); Q_strncpyz(dest+pad, src, MAXTEMPBUFFERLEN-pad);
while(pad) while(pad--)
{ {
pad--; pad--;
dest[pad] = ' '; dest[pad] = ' ';
@ -6553,6 +6555,7 @@ void PF_strpad (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Q_strncpyz(dest, src, MAXTEMPBUFFERLEN); Q_strncpyz(dest, src, MAXTEMPBUFFERLEN);
dest+=strlen(dest); dest+=strlen(dest);
while(pad-->0) while(pad-->0)
*dest++ = ' '; *dest++ = ' ';
*dest = '\0'; *dest = '\0';