git-svn-id: https://svn.eduke32.com/eduke32@1015 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-08-24 05:39:28 +00:00
parent cf2f7927ea
commit b58833d730
2 changed files with 60 additions and 60 deletions

View file

@ -126,7 +126,7 @@ const char *stripcolorcodes(const char *in, char *out)
{ {
char *ptr = out; char *ptr = out;
while (*in) do
{ {
if (*in == '^' && isdigit(*(in+1))) if (*in == '^' && isdigit(*(in+1)))
{ {
@ -146,7 +146,8 @@ const char *stripcolorcodes(const char *in, char *out)
continue; continue;
} }
*(out++) = *(in++); *(out++) = *(in++);
} } while (*in);
*out = '\0'; *out = '\0';
return(ptr); return(ptr);
} }
@ -1248,7 +1249,7 @@ void OSD_ResizeDisplay(int w, int h)
k = min(newcols, osdcols); k = min(newcols, osdcols);
memset(newtext, 32, TEXTSIZE); memset(newtext, 32, TEXTSIZE);
for (i=0;i<j;i++) for (i=j-1;i>=0;i--)
{ {
memcpy(newtext+newcols*i, osdtext+osdcols*i, k); memcpy(newtext+newcols*i, osdtext+osdcols*i, k);
memcpy(newfmt+newcols*i, osdfmt+osdcols*i, k); memcpy(newfmt+newcols*i, osdfmt+osdcols*i, k);
@ -1364,7 +1365,7 @@ void OSD_Draw(void)
if (osdeditshift) drawosdchar(1,osdrowscur,'H',osdpromptshade,osdpromptpal); if (osdeditshift) drawosdchar(1,osdrowscur,'H',osdpromptshade,osdpromptpal);
len = min(osdcols-1-3, osdeditlen-osdeditwinstart); len = min(osdcols-1-3, osdeditlen-osdeditwinstart);
for (x=0; x<len; x++) for (x=len-1; x>=0; x--)
drawosdchar(3+x,osdrowscur,osdeditbuf[osdeditwinstart+x],osdeditshade<<1,osdeditpal); drawosdchar(3+x,osdrowscur,osdeditbuf[osdeditwinstart+x],osdeditshade<<1,osdeditpal);
drawosdcursor(3+osdeditcursor-osdeditwinstart,osdrowscur,osdovertype,keytime); drawosdcursor(3+osdeditcursor-osdeditwinstart,osdrowscur,osdovertype,keytime);
@ -1424,56 +1425,65 @@ void OSD_Printf(const char *fmt, ...)
linecnt=logcutoff+1; linecnt=logcutoff+1;
} }
for (chp = tmpstr; *chp; chp++) chp = tmpstr;
do
{ {
if (*chp == '^' && isdigit(*(chp+1))) if (*chp == '\n')
{
char smallbuf[4];
chp++;
if (isdigit(*(chp+1)))
{
smallbuf[0] = *(chp++);
smallbuf[1] = *(chp);
smallbuf[2] = '\0';
p = atol(smallbuf);
}
else
{
smallbuf[0] = *(chp);
smallbuf[1] = '\0';
p = atol(smallbuf);
}
}
else if (*chp == '^' && Btoupper(*(chp+1)) == 'S')
{
chp++;
if (isdigit(*(++chp)))
s = *chp;
}
else if (*chp == '^' && Btoupper(*(chp+1)) == 'O')
{
chp++;
p = osdtextpal;
s = osdtextshade;
}
else if (*chp == '\r') osdpos=0;
else if (*chp == '\n')
{ {
osdpos=0; osdpos=0;
linecnt++; linecnt++;
linefeed(); linefeed();
continue;
} }
else if (*chp == '\r')
{ {
osdtext[osdpos] = *chp; osdpos=0;
osdfmt[osdpos++] = p+(s<<5); continue;
if (osdpos == osdcols) }
if (*chp == '^')
{
if (isdigit(*(chp+1)))
{ {
osdpos = 0; char smallbuf[4];
linefeed(); chp++;
if (isdigit(*(chp+1)))
{
smallbuf[0] = *(chp++);
smallbuf[1] = *(chp);
smallbuf[2] = '\0';
p = atol(smallbuf);
}
else
{
smallbuf[0] = *(chp);
smallbuf[1] = '\0';
p = atol(smallbuf);
}
continue;
}
if (Btoupper(*(chp+1)) == 'S')
{
chp++;
if (isdigit(*(++chp)))
s = *chp;
continue;
}
if (Btoupper(*(chp+1)) == 'O')
{
chp++;
p = osdtextpal;
s = osdtextshade;
continue;
} }
} }
} osdtext[osdpos] = *chp;
osdfmt[osdpos++] = p+(s<<5);
if (osdpos == osdcols)
{
osdpos = 0;
linefeed();
}
} while (*(++chp));
} }

View file

@ -425,14 +425,6 @@ void CONTROL_MapDigitalAxis(int32 whichaxis, int32 whichfunction, int32 directio
} }
} }
void CONTROL_ClearFlags(void)
{
int32 i;
for (i=0;i<CONTROL_NUM_FLAGS;i++)
CONTROL_Flags[i].used = false;
}
void CONTROL_ClearAssignments(void) void CONTROL_ClearAssignments(void)
{ {
int32 i; int32 i;
@ -462,9 +454,9 @@ static void DoGetDeviceButtons(
byte *ButtonClickedCount byte *ButtonClickedCount
) )
{ {
int32 i, bs; int32 i=NumButtons-1, bs;
for (i=0;i<NumButtons;i++) for (;i>=0;i--)
{ {
bs = (buttons >> i) & 1; bs = (buttons >> i) & 1;
@ -493,14 +485,12 @@ static void DoGetDeviceButtons(
{ {
ButtonClickedState[i] = true; ButtonClickedState[i] = true;
} }
continue;
} }
else if (ButtonClickedCount[i] == 2)
{ ButtonClickedCount[i] = 0;
if (ButtonClickedCount[i] == 2)
ButtonClickedCount[i] = 0;
ButtonClicked[i] = false; ButtonClicked[i] = false;
}
} }
} }