Improve I_ErrorI for 32-bit output

This commit is contained in:
Lephenixnoir 2021-07-17 10:47:37 +02:00
parent 58e22d75d4
commit 670e3a4b50
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 17 additions and 4 deletions

View File

@ -125,6 +125,19 @@ void CGDAppendNum0_999(const char *pszText,int iNum,int iMinDigits,char *pszBuf)
pszBuf[i+1] = 0;
}
void CGDAppendHex32(const char *pszText,int iNum,int iDigits,char *pszBuf)
{
CGDstrcpy(pszBuf, pszText);
pszBuf += CGDstrlen(pszText);
for(int i = 0; i < iDigits; i++)
{
int c = (iNum >> (i * 4)) & 0xf;
c = c + '0' + 7 * (c > 9);
pszBuf[iDigits-i-1] = c;
}
pszBuf[iDigits] = 0;
}
int CGDstrlen(const char *pszText)
{

View File

@ -127,10 +127,10 @@ void I_ErrorI (char *error, int i1,int i2,int i3,int i4)
PrintLine( "ERROR:", 21 );
locate_OS( 1, 2 );
PrintLine( (unsigned char *)error, 21 );
locate_OS( 1, 3 );CGDAppendNum0_999("i1",i1,0,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 4 );CGDAppendNum0_999("i2",i2,0,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 5 );CGDAppendNum0_999("i3",i3,0,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 6 );CGDAppendNum0_999("i4",i4,0,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 3 );CGDAppendHex32("i1:",i1,8,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 4 );CGDAppendHex32("i2:",i2,8,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 5 );CGDAppendHex32("i3:",i3,8,buf);PrintLine( (unsigned char *)buf, 21 );
locate_OS( 1, 6 );CGDAppendHex32("i4:",i4,8,buf);PrintLine( (unsigned char *)buf, 21 );
{
if(key == 31)GetKey( &key );
}