mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- Added a strbin1 function that does the same as strbin but creates a copy
instead of overwriting the original string. ACS performing this operation in place caused crashes with RTC-3057. - fixed: FScriptPosition::Message did not print the message if it was not a fatal error. SVN r1313 (trunk)
This commit is contained in:
parent
081658d3d5
commit
11d1c41873
5 changed files with 101 additions and 3 deletions
|
@ -1,4 +1,9 @@
|
|||
December 7, 2008 (Changes by Graf Zahl)
|
||||
- Added a strbin1 function that does the same as strbin but creates a copy
|
||||
instead of overwriting the original string. ACS performing this operation
|
||||
in place caused crashes with RTC-3057.
|
||||
- fixed: FScriptPosition::Message did not print the message if it was not
|
||||
a fatal error.
|
||||
- Fixed: The save percentage for Doom's green armor was slightly too low
|
||||
which caused roundoff errors that made it less than 1/3 effective.
|
||||
- Added support for "RRGGBB" strings to V_GetColor.
|
||||
|
|
|
@ -470,6 +470,97 @@ int strbin (char *str)
|
|||
return str - start;
|
||||
}
|
||||
|
||||
// [RH] Replaces the escape sequences in a string with actual escaped characters.
|
||||
// This operation is done in-place. The result is the new length of the string.
|
||||
|
||||
FString strbin1 (const char *start)
|
||||
{
|
||||
FString result;
|
||||
const char *p = start;
|
||||
char c;
|
||||
int i;
|
||||
|
||||
while ( (c = *p++) ) {
|
||||
if (c != '\\') {
|
||||
result << c;
|
||||
} else {
|
||||
switch (*p) {
|
||||
case 'a':
|
||||
result << '\a';
|
||||
break;
|
||||
case 'b':
|
||||
result << '\b';
|
||||
break;
|
||||
case 'c':
|
||||
result << '\034'; // TEXTCOLOR_ESCAPE
|
||||
break;
|
||||
case 'f':
|
||||
result << '\f';
|
||||
break;
|
||||
case 'n':
|
||||
result << '\n';
|
||||
break;
|
||||
case 't':
|
||||
result << '\t';
|
||||
break;
|
||||
case 'r':
|
||||
result << '\r';
|
||||
break;
|
||||
case 'v':
|
||||
result << '\v';
|
||||
break;
|
||||
case '?':
|
||||
result << '\?';
|
||||
break;
|
||||
case '\n':
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
c = 0;
|
||||
p++;
|
||||
for (i = 0; i < 2; i++) {
|
||||
c <<= 4;
|
||||
if (*p >= '0' && *p <= '9')
|
||||
c += *p-'0';
|
||||
else if (*p >= 'a' && *p <= 'f')
|
||||
c += 10 + *p-'a';
|
||||
else if (*p >= 'A' && *p <= 'F')
|
||||
c += 10 + *p-'A';
|
||||
else
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
result << c;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
c = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
c <<= 3;
|
||||
if (*p >= '0' && *p <= '7')
|
||||
c += *p-'0';
|
||||
else
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
result << c;
|
||||
break;
|
||||
default:
|
||||
result << *p;
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ExpandEnvVars
|
||||
|
@ -534,3 +625,4 @@ FString ExpandEnvVars(const char *searchpathstring)
|
|||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ void FormatGUID (char *buffer, size_t buffsize, const GUID &guid);
|
|||
const char *myasctime ();
|
||||
|
||||
int strbin (char *str);
|
||||
FString strbin1 (const char *start);
|
||||
|
||||
void CreatePath(const char * fn);
|
||||
|
||||
|
|
|
@ -4070,9 +4070,7 @@ int DLevelScript::RunScript ()
|
|||
case PCD_ENDPRINTBOLD:
|
||||
case PCD_MOREHUDMESSAGE:
|
||||
case PCD_ENDLOG:
|
||||
strbin (work.LockBuffer());
|
||||
work.Truncate ((long)strlen(work));
|
||||
work.UnlockBuffer();
|
||||
work = strbin1 (work);
|
||||
if (pcd == PCD_ENDLOG)
|
||||
{
|
||||
Printf ("%s\n", work.GetChars());
|
||||
|
|
|
@ -1109,6 +1109,8 @@ void STACK_ARGS FScriptPosition::Message (int severity, const char *message, ...
|
|||
I_Error ("Script error, \"%s\" line %d:\n%s\n",
|
||||
FileName.GetChars(), ScriptLine, composed.GetChars());
|
||||
}
|
||||
Printf (level, "Script %s, \"%s\" line %d:\n%s\n",
|
||||
type, FileName.GetChars(), ScriptLine, composed.GetChars());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue