mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Same shit, different diff
git-svn-id: https://svn.eduke32.com/eduke32@7156 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
59fde95785
commit
1cae4ce7e3
5 changed files with 140 additions and 141 deletions
|
@ -204,8 +204,8 @@ enum osdflags_t
|
|||
OSD_PROTECTED = 0x00000080,
|
||||
};
|
||||
|
||||
#define OSD_ALIAS (int32_t (*)(osdcmdptr_t))0x1337
|
||||
#define OSD_UNALIASED (int32_t (*)(osdcmdptr_t))0xDEAD
|
||||
#define OSD_ALIAS (int (*)(osdcmdptr_t))0x1337
|
||||
#define OSD_UNALIASED (int (*)(osdcmdptr_t))0xDEAD
|
||||
|
||||
#define OSDCMD_OK 0
|
||||
#define OSDCMD_SHOWHELP 1
|
||||
|
@ -214,12 +214,12 @@ int OSD_ParsingScript(void);
|
|||
|
||||
int OSD_OSDKey(void);
|
||||
int OSD_GetTextMode(void);
|
||||
void OSD_SetTextMode(int32_t mode);
|
||||
void OSD_SetTextMode(int mode);
|
||||
|
||||
int OSD_Exec(const char *szScript);
|
||||
|
||||
// Get shade and pal index from the OSD format buffer.
|
||||
void OSD_GetShadePal(const char *ch, int32_t *shadeptr, int32_t *palptr);
|
||||
void OSD_GetShadePal(const char *ch, int *shd, int *pal);
|
||||
|
||||
int OSD_GetCols(void);
|
||||
int OSD_IsMoving(void);
|
||||
|
@ -235,17 +235,17 @@ void OSD_Cleanup(void);
|
|||
void OSD_SetLogFile(const char *fn);
|
||||
|
||||
// sets the functions the OSD will call to interrogate the environment
|
||||
void OSD_SetFunctions(void (*drawchar)(int32_t, int32_t, char, int32_t, int32_t),
|
||||
void (*drawstr)(int32_t, int32_t, const char *, int32_t, int32_t, int32_t),
|
||||
void (*drawcursor)(int32_t, int32_t, int32_t, int32_t),
|
||||
int32_t (*colwidth)(int32_t),
|
||||
int32_t (*rowheight)(int32_t),
|
||||
void (*clearbg)(int32_t, int32_t),
|
||||
void OSD_SetFunctions(void (*drawchar)(int, int, char, int, int),
|
||||
void (*drawstr)(int, int, const char *, int, int, int),
|
||||
void (*drawcursor)(int, int, int, int),
|
||||
int (*colwidth)(int),
|
||||
int (*rowheight)(int),
|
||||
void (*clearbg)(int, int),
|
||||
int32_t (*gtime)(void),
|
||||
void (*showosd)(int32_t));
|
||||
void (*showosd)(int));
|
||||
|
||||
// sets the parameters for presenting the text
|
||||
void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal,
|
||||
void OSD_SetParameters(int promptShade, int promptPal, int editShade, int editPal, int textShade, int textPal,
|
||||
char const *errorStr, char const *highlight, uint32_t flags);
|
||||
|
||||
// sets the scancode for the key which activates the onscreen display
|
||||
|
@ -254,19 +254,19 @@ void OSD_CaptureKey(uint8_t scanCode);
|
|||
// handles keyboard input when capturing input. returns 0 if key was handled
|
||||
// or the scancode if it should be handled by the game.
|
||||
int OSD_HandleScanCode(uint8_t scanCode, int keyDown);
|
||||
int32_t OSD_HandleChar(char ch);
|
||||
int OSD_HandleChar(char ch);
|
||||
|
||||
// handles the readjustment when screen resolution changes
|
||||
void OSD_ResizeDisplay(int32_t w,int32_t h);
|
||||
void OSD_ResizeDisplay(int w,int h);
|
||||
|
||||
// captures and frees osd input
|
||||
void OSD_CaptureInput(int32_t cap);
|
||||
void OSD_CaptureInput(int cap);
|
||||
|
||||
// sets the console version string
|
||||
void OSD_SetVersion(const char *pszVersion, int osdShade, int osdPal);
|
||||
|
||||
// shows or hides the onscreen display
|
||||
void OSD_ShowDisplay(int32_t onf);
|
||||
void OSD_ShowDisplay(int onf);
|
||||
|
||||
// draw the osd to the screen
|
||||
void OSD_Draw(void);
|
||||
|
@ -287,17 +287,17 @@ void OSD_Dispatch(const char *cmd);
|
|||
// name = name of the function
|
||||
// help = a short help string
|
||||
// func = the entry point to the function
|
||||
int OSD_RegisterFunction(const char *pszName, const char *pszDesc, int32_t (*func)(osdcmdptr_t));
|
||||
int OSD_RegisterFunction(const char *pszName, const char *pszDesc, int (*func)(osdcmdptr_t));
|
||||
|
||||
int osdcmd_cvar_set(osdcmdptr_t parm);
|
||||
void OSD_RegisterCvar(osdcvardata_t * cvar, int32_t (*func)(osdcmdptr_t));
|
||||
void OSD_RegisterCvar(osdcvardata_t * cvar, int (*func)(osdcmdptr_t));
|
||||
void OSD_WriteAliases(FILE *fp);
|
||||
void OSD_WriteCvars(FILE *fp);
|
||||
|
||||
static inline void OSD_SetHistory(int32_t histIdx, const char *src)
|
||||
static inline void OSD_SetHistory(int idx, const char *src)
|
||||
{
|
||||
osd->history.buf[histIdx] = (char *)Xmalloc(OSDEDITLENGTH);
|
||||
Bstrncpyz(osd->history.buf[histIdx], src, OSDEDITLENGTH);
|
||||
osd->history.buf[idx] = (char *)Xmalloc(OSDEDITLENGTH);
|
||||
Bstrncpyz(osd->history.buf[idx], src, OSDEDITLENGTH);
|
||||
}
|
||||
|
||||
extern int osdcmd_restartvid(osdcmdptr_t parm);
|
||||
|
|
|
@ -562,7 +562,7 @@ void M32_DrawRoomsAndMasks(void)
|
|||
}
|
||||
}
|
||||
|
||||
void M32_OnShowOSD(int32_t shown)
|
||||
void M32_OnShowOSD(int shown)
|
||||
{
|
||||
mouseLockToWindow((!shown) + 2);
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ int32_t FindDistance3D(int32_t x, int32_t y, int32_t z)
|
|||
|
||||
|
||||
// Clear OSD background
|
||||
void COMMON_clearbackground(int32_t numcols, int32_t numrows)
|
||||
void COMMON_clearbackground(int numcols, int numrows)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(numcols);
|
||||
|
||||
|
|
|
@ -212,15 +212,15 @@ int OSD_IsMoving(void) { return (osdrowscur != -1 && osdrowscur != osd->dra
|
|||
int OSD_GetRowsCur(void) { return osdrowscur; }
|
||||
int OSD_GetTextMode(void) { return osd->draw.mode; }
|
||||
|
||||
void OSD_GetShadePal(const char *ch, int32_t *shadeptr, int32_t *palptr)
|
||||
void OSD_GetShadePal(const char *ch, int *shd, int *pal)
|
||||
{
|
||||
auto &t = osd->text;
|
||||
|
||||
if (ch < t.buf || ch >= t.buf + OSDBUFFERSIZE)
|
||||
return;
|
||||
|
||||
*shadeptr = (t.fmt[ch - t.buf] & ~0x1F) >> 4;
|
||||
*palptr = t.fmt[ch - t.buf] & ~0xE0;
|
||||
*shd = (t.fmt[ch-t.buf] & ~0x1F)>>4;
|
||||
*pal = (t.fmt[ch-t.buf] & ~0xE0);
|
||||
}
|
||||
|
||||
// XXX: well, converting function pointers to "data pointers" (void *) is
|
||||
|
@ -238,7 +238,7 @@ static inline void swaposdptrs(void)
|
|||
swapptr(&_getrowheight, &getrowheight);
|
||||
}
|
||||
|
||||
void OSD_SetTextMode(int32_t mode)
|
||||
void OSD_SetTextMode(int mode)
|
||||
{
|
||||
osd->draw.mode = (mode != 0);
|
||||
|
||||
|
@ -328,7 +328,7 @@ static int osdfunc_fileinfo(osdcmdptr_t parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static void _internal_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
||||
static void _internal_drawosdchar(int x, int y, char ch, int shade, int pal)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(shade);
|
||||
UNREFERENCED_PARAMETER(pal);
|
||||
|
@ -338,7 +338,7 @@ static void _internal_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade,
|
|||
printext256(4+(x<<3),4+(y<<3), whiteColorIdx, -1, st, 0);
|
||||
}
|
||||
|
||||
static void _internal_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
static void _internal_drawosdstr(int x, int y, const char *ch, int len, int shade, int pal)
|
||||
{
|
||||
char st[1024];
|
||||
|
||||
|
@ -356,7 +356,7 @@ static void _internal_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t l
|
|||
}
|
||||
}
|
||||
|
||||
static void _internal_drawosdcursor(int32_t x, int32_t y, int32_t flags, int32_t lastkeypress)
|
||||
static void _internal_drawosdcursor(int x, int y, int flags, int lastkeypress)
|
||||
{
|
||||
char st[2] = { '_',0 };
|
||||
|
||||
|
@ -370,14 +370,12 @@ static void _internal_drawosdcursor(int32_t x, int32_t y, int32_t flags, int32_t
|
|||
return;
|
||||
}
|
||||
|
||||
int32_t i, k;
|
||||
// Find the palette index closest to Duke3D's brightest blue
|
||||
// "foreground" color. (Index 79, or the last column of the 5th row,
|
||||
// if the palette is laid out in a 16x16 pattern.)
|
||||
k = INT32_MAX;
|
||||
for (i=0; i<256; i++)
|
||||
for (int i=0, k=UINT8_MAX+1; i<256; i++)
|
||||
{
|
||||
int32_t j =
|
||||
int const j =
|
||||
klabs(curpalette[i].r - 4*47) +
|
||||
klabs(curpalette[i].g - 4*55) +
|
||||
klabs(curpalette[i].b - 4*63);
|
||||
|
@ -385,17 +383,17 @@ static void _internal_drawosdcursor(int32_t x, int32_t y, int32_t flags, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
static int32_t _internal_getcolumnwidth(int32_t w)
|
||||
static int _internal_getcolumnwidth(int w)
|
||||
{
|
||||
return w/8 - 1;
|
||||
}
|
||||
|
||||
static int32_t _internal_getrowheight(int32_t w)
|
||||
static int _internal_getrowheight(int w)
|
||||
{
|
||||
return w/8;
|
||||
}
|
||||
|
||||
static void _internal_clearbackground(int32_t cols, int32_t rows)
|
||||
static void _internal_clearbackground(int cols, int rows)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(cols);
|
||||
UNREFERENCED_PARAMETER(rows);
|
||||
|
@ -406,7 +404,7 @@ static int32_t _internal_gettime(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void _internal_onshowosd(int32_t a)
|
||||
static void _internal_onshowosd(int a)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(a);
|
||||
}
|
||||
|
@ -421,14 +419,14 @@ static int osdfunc_alias(osdcmdptr_t parm)
|
|||
|
||||
OSD_Printf("Alias listing:\n");
|
||||
|
||||
for (auto &symbptr : osd->symbptrs)
|
||||
for (auto &symb : osd->symbptrs)
|
||||
{
|
||||
if (!symbptr->func || !symbptr->name)
|
||||
if (!symb->func || !symb->name)
|
||||
break;
|
||||
else if (symbptr->func == OSD_ALIAS)
|
||||
else if (symb->func == OSD_ALIAS)
|
||||
{
|
||||
cnt++;
|
||||
OSD_Printf(" %s \"%s\"\n", symbptr->name, symbptr->help);
|
||||
OSD_Printf(" %s \"%s\"\n", symb->name, symb->help);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,22 +436,22 @@ static int osdfunc_alias(osdcmdptr_t parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
for (auto &symbptr : osd->symbptrs)
|
||||
for (auto &symb : osd->symbptrs)
|
||||
{
|
||||
if (!symbptr->func || !symbptr->name)
|
||||
if (!symb->func || !symb->name)
|
||||
break;
|
||||
else if (!Bstrcasecmp(parm->parms[0], symbptr->name))
|
||||
else if (!Bstrcasecmp(parm->parms[0], symb->name))
|
||||
{
|
||||
if (parm->numparms < 2)
|
||||
{
|
||||
if (symbptr->func == OSD_ALIAS)
|
||||
OSD_Printf("alias %s \"%s\"\n", symbptr->name, symbptr->help);
|
||||
if (symb->func == OSD_ALIAS)
|
||||
OSD_Printf("alias %s \"%s\"\n", symb->name, symb->help);
|
||||
else
|
||||
OSD_Printf("%s is not an alias\n", symbptr->name);
|
||||
OSD_Printf("%s is not an alias\n", symb->name);
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
else if (symbptr->func != OSD_ALIAS && symbptr->func != OSD_UNALIASED)
|
||||
else if (symb->func != OSD_ALIAS && symb->func != OSD_UNALIASED)
|
||||
{
|
||||
OSD_Printf("Cannot override a function or cvar with an alias\n");
|
||||
|
||||
|
@ -612,8 +610,8 @@ void OSD_Cleanup(void)
|
|||
hash_free(&h_osd);
|
||||
hash_free(&h_cvars);
|
||||
|
||||
for (auto &symbptr : osd->symbptrs)
|
||||
DO_FREE_AND_NULL(symbptr);
|
||||
for (auto &symb : osd->symbptrs)
|
||||
DO_FREE_AND_NULL(symb);
|
||||
|
||||
osd->symbols = NULL;
|
||||
|
||||
|
@ -784,14 +782,14 @@ void OSD_SetLogFile(const char *fn)
|
|||
//
|
||||
// OSD_SetFunctions() -- Sets some callbacks which the OSD uses to understand its world
|
||||
//
|
||||
void OSD_SetFunctions(void (*drawchar)(int32_t, int32_t, char, int32_t, int32_t),
|
||||
void (*drawstr)(int32_t, int32_t, const char *, int32_t, int32_t, int32_t),
|
||||
void (*drawcursor)(int32_t, int32_t, int32_t, int32_t),
|
||||
int32_t (*colwidth)(int32_t),
|
||||
int32_t (*rowheight)(int32_t),
|
||||
void (*clearbg)(int32_t, int32_t),
|
||||
void OSD_SetFunctions(void (*drawchar)(int, int, char, int, int),
|
||||
void (*drawstr)(int, int, const char *, int, int, int),
|
||||
void (*drawcursor)(int, int, int, int),
|
||||
int (*colwidth)(int),
|
||||
int (*rowheight)(int),
|
||||
void (*clearbg)(int, int),
|
||||
int32_t (*gtime)(void),
|
||||
void (*showosd)(int32_t))
|
||||
void (*showosd)(int))
|
||||
{
|
||||
drawosdchar = drawchar ? drawchar : _internal_drawosdchar;
|
||||
drawosdstr = drawstr ? drawstr : _internal_drawosdstr;
|
||||
|
@ -807,8 +805,8 @@ void OSD_SetFunctions(void (*drawchar)(int32_t, int32_t, char, int32_t, int32_t)
|
|||
//
|
||||
// OSD_SetParameters() -- Sets the parameters for presenting the text
|
||||
//
|
||||
void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal,
|
||||
char const *const errorStr, char const *const highlight, uint32_t flags)
|
||||
void OSD_SetParameters(int promptShade, int promptPal, int editShade, int editPal, int textShade, int textPal,
|
||||
char const *errorStr, char const *highlight, uint32_t flags)
|
||||
{
|
||||
osddraw_t &draw = osd->draw;
|
||||
|
||||
|
@ -838,7 +836,7 @@ void OSD_CaptureKey(uint8_t scanCode)
|
|||
//
|
||||
static int OSD_FindDiffPoint(const char *str1, const char *str2)
|
||||
{
|
||||
int32_t i;
|
||||
int i;
|
||||
|
||||
for (i = 0; Btolower(str1[i]) == Btolower(str2[i]); i++)
|
||||
if (str1[i] == 0 || str2[i] == 0)
|
||||
|
@ -876,7 +874,8 @@ static void OSD_HistoryPrev(void)
|
|||
{
|
||||
osdhist_t &h = osd->history;
|
||||
|
||||
if (h.pos >= h.lines-1) return;
|
||||
if (h.pos >= h.lines - 1)
|
||||
return;
|
||||
|
||||
osdedit_t &e = osd->editor;
|
||||
|
||||
|
@ -889,7 +888,8 @@ static void OSD_HistoryNext(void)
|
|||
{
|
||||
osdhist_t &h = osd->history;
|
||||
|
||||
if (h.pos < 0) return;
|
||||
if (h.pos < 0)
|
||||
return;
|
||||
|
||||
osdedit_t &e = osd->editor;
|
||||
|
||||
|
@ -900,6 +900,7 @@ static void OSD_HistoryNext(void)
|
|||
e.start = 0;
|
||||
e.end = OSD_EDIT_LINE_WIDTH;
|
||||
h.pos = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -938,7 +939,7 @@ int OSD_HandleChar(char ch)
|
|||
|
||||
case asc_Ctrl_B: // move one character left
|
||||
if (ed.pos > 0)
|
||||
ed.pos--;
|
||||
--ed.pos;
|
||||
return 0;
|
||||
|
||||
case asc_Ctrl_C: // discard line
|
||||
|
@ -993,7 +994,7 @@ int OSD_HandleChar(char ch)
|
|||
|
||||
case asc_Tab: // tab
|
||||
{
|
||||
int32_t commonsize = 512;
|
||||
int commonsize = INT_MAX;
|
||||
|
||||
if (!lastmatch)
|
||||
{
|
||||
|
@ -1014,8 +1015,8 @@ int OSD_HandleChar(char ch)
|
|||
|
||||
if (tabc && tabc->next && osd_findsymbol(ed.tmp, tabc->next))
|
||||
{
|
||||
osdsymbol_t *symb = tabc;
|
||||
int32_t maxwidth = 0, x = 0, num = 0, diffpt;
|
||||
auto symb = tabc;
|
||||
int maxwidth = 0, x = 0, num = 0, diffpt;
|
||||
|
||||
while (symb && symb != lastmatch)
|
||||
{
|
||||
|
@ -1262,12 +1263,12 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
|
|||
|
||||
case sc_PgUp:
|
||||
if (draw.head < osd->text.lines-1)
|
||||
draw.head++;
|
||||
++draw.head;
|
||||
break;
|
||||
|
||||
case sc_PgDn:
|
||||
if (draw.head > 0)
|
||||
draw.head--;
|
||||
--draw.head;
|
||||
break;
|
||||
|
||||
case sc_Home:
|
||||
|
@ -1312,7 +1313,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
|
|||
if (ed.buf[ed.pos-1] != asc_Space)
|
||||
break;
|
||||
|
||||
ed.pos--;
|
||||
--ed.pos;
|
||||
}
|
||||
|
||||
while (ed.pos > 0)
|
||||
|
@ -1320,10 +1321,10 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
|
|||
if (ed.buf[ed.pos-1] == asc_Space)
|
||||
break;
|
||||
|
||||
ed.pos--;
|
||||
--ed.pos;
|
||||
}
|
||||
}
|
||||
else ed.pos--;
|
||||
else --ed.pos;
|
||||
}
|
||||
|
||||
if (ed.pos < ed.start)
|
||||
|
@ -1405,46 +1406,47 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
|
|||
// OSD_ResizeDisplay() -- Handles readjustment of the display when the screen resolution
|
||||
// changes on us.
|
||||
//
|
||||
void OSD_ResizeDisplay(int32_t w, int32_t h)
|
||||
void OSD_ResizeDisplay(int w, int h)
|
||||
{
|
||||
int32_t newcols, newmaxlines;
|
||||
char *newtext, *newfmt;
|
||||
int32_t i,j,k;
|
||||
auto &t = osd->text;
|
||||
auto &d = osd->draw;
|
||||
|
||||
newcols = getcolumnwidth(w);
|
||||
newmaxlines = OSDBUFFERSIZE / newcols;
|
||||
int const newcols = getcolumnwidth(w);
|
||||
int const newmaxlines = OSDBUFFERSIZE / newcols;
|
||||
|
||||
j = min(newmaxlines, osd->text.maxlines);
|
||||
k = min(newcols, osd->draw.cols);
|
||||
|
||||
newtext = (char *)Xmalloc(OSDBUFFERSIZE);
|
||||
newfmt = (char *)Xmalloc(OSDBUFFERSIZE);
|
||||
auto newtext = (char *)Xmalloc(OSDBUFFERSIZE);
|
||||
auto newfmt = (char *)Xmalloc(OSDBUFFERSIZE);
|
||||
|
||||
Bmemset(newtext, asc_Space, OSDBUFFERSIZE);
|
||||
|
||||
for (i=j-1; i>=0; i--)
|
||||
int const copylines = min(newmaxlines, t.maxlines);
|
||||
int const copycols = min(newcols, d.cols);
|
||||
|
||||
for (int i = 0; i < copylines; ++i)
|
||||
{
|
||||
Bmemcpy(newtext+newcols*i, osd->text.buf+osd->draw.cols*i, k);
|
||||
Bmemcpy(newfmt+newcols*i, osd->text.fmt+osd->draw.cols*i, k);
|
||||
Bmemcpy(newtext + newcols * i, t.buf + d.cols * i, copycols);
|
||||
Bmemcpy(newfmt + newcols * i, t.fmt + d.cols * i, copycols);
|
||||
}
|
||||
|
||||
Bfree(osd->text.buf);
|
||||
osd->text.buf = newtext;
|
||||
Bfree(t.buf);
|
||||
t.buf = newtext;
|
||||
|
||||
Bfree(osd->text.fmt);
|
||||
osd->text.fmt = newfmt;
|
||||
Bfree(t.fmt);
|
||||
t.fmt = newfmt;
|
||||
|
||||
osd->text.maxlines = newmaxlines;
|
||||
t.maxlines = newmaxlines;
|
||||
osdmaxrows = getrowheight(h) - 2;
|
||||
d.cols = newcols;
|
||||
|
||||
osd->draw.cols = newcols;
|
||||
osdmaxrows = getrowheight(h)-2;
|
||||
if (d.rows > osdmaxrows)
|
||||
d.rows = osdmaxrows;
|
||||
|
||||
if (osd->draw.rows > osdmaxrows) osd->draw.rows = osdmaxrows;
|
||||
t.pos = 0;
|
||||
d.head = 0;
|
||||
|
||||
osd->text.pos = 0;
|
||||
osd->draw.head = 0;
|
||||
osd->editor.start = 0;
|
||||
osd->editor.end = OSD_EDIT_LINE_WIDTH;
|
||||
osd->editor.end = OSD_EDIT_LINE_WIDTH;
|
||||
|
||||
whiteColorIdx = -1;
|
||||
}
|
||||
|
||||
|
@ -1452,7 +1454,7 @@ void OSD_ResizeDisplay(int32_t w, int32_t h)
|
|||
//
|
||||
// OSD_CaptureInput()
|
||||
//
|
||||
void OSD_CaptureInput(int32_t cap)
|
||||
void OSD_CaptureInput(int cap)
|
||||
{
|
||||
osd->flags = (osd->flags & ~(OSD_CAPTURE|OSD_CTRL|OSD_SHIFT)) | (-cap & OSD_CAPTURE);
|
||||
|
||||
|
@ -1466,7 +1468,7 @@ void OSD_CaptureInput(int32_t cap)
|
|||
//
|
||||
// OSD_ShowDisplay() -- Shows or hides the onscreen display
|
||||
//
|
||||
void OSD_ShowDisplay(int32_t onf)
|
||||
void OSD_ShowDisplay(int onf)
|
||||
{
|
||||
osd->flags = (osd->flags & ~OSD_DRAW) | (-onf & OSD_DRAW);
|
||||
OSD_CaptureInput(onf);
|
||||
|
@ -1491,23 +1493,23 @@ void OSD_Draw(void)
|
|||
{
|
||||
if ((osdrowscur < osd->draw.rows && osd->draw.scrolling == 1) || osdrowscur < -1)
|
||||
{
|
||||
int32_t j = (timerGetTicks()-osdscrtime);
|
||||
while (j >= 0)
|
||||
uint32_t j = (timerGetTicks() - osdscrtime);
|
||||
|
||||
while (j < UINT32_MAX)
|
||||
{
|
||||
osdrowscur++;
|
||||
j -= tabledivide32_noinline(200, osd->draw.rows);
|
||||
if (osdrowscur > osd->draw.rows-1)
|
||||
if (++osdrowscur > osd->draw.rows-1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((osdrowscur > -1 && osd->draw.scrolling == -1) || osdrowscur > osd->draw.rows)
|
||||
{
|
||||
int32_t j = (timerGetTicks()-osdscrtime);
|
||||
while (j >= 0)
|
||||
uint32_t j = (timerGetTicks() - osdscrtime);
|
||||
|
||||
while (j < UINT32_MAX)
|
||||
{
|
||||
osdrowscur--;
|
||||
j -= tabledivide32_noinline(200, osd->draw.rows);
|
||||
if (osdrowscur < 1)
|
||||
if (--osdrowscur < 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1621,8 +1623,8 @@ void OSD_Puts(const char *tmpstr)
|
|||
|
||||
const char *chp;
|
||||
|
||||
uint8_t textPal = osd->draw.textpal;
|
||||
uint8_t textShade = osd->draw.textshade;
|
||||
int textPal = osd->draw.textpal;
|
||||
int textShade = osd->draw.textshade;
|
||||
|
||||
mutex_lock(&osd->mutex);
|
||||
|
||||
|
@ -1658,15 +1660,15 @@ void OSD_Puts(const char *tmpstr)
|
|||
{
|
||||
if (*chp == '\n')
|
||||
{
|
||||
osd->text.pos=0;
|
||||
log.lines++;
|
||||
osd->text.pos = 0;
|
||||
++log.lines;
|
||||
OSD_LineFeed();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*chp == '\r')
|
||||
{
|
||||
osd->text.pos=0;
|
||||
osd->text.pos = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1701,7 +1703,7 @@ void OSD_Puts(const char *tmpstr)
|
|||
if (Btoupper(*(chp+1)) == 'O')
|
||||
{
|
||||
chp++;
|
||||
textPal = osd->draw.textpal;
|
||||
textPal = osd->draw.textpal;
|
||||
textShade = osd->draw.textshade;
|
||||
continue;
|
||||
}
|
||||
|
@ -2176,7 +2178,7 @@ void OSD_WriteAliases(FILE *fp)
|
|||
{
|
||||
Bassert(fp);
|
||||
|
||||
for (auto symb=osd->symbols; symb!=NULL; symb=symb->next)
|
||||
for (auto &symb : osd->symbptrs)
|
||||
{
|
||||
if (symb->func == (void *)OSD_ALIAS)
|
||||
Bfprintf(fp, "alias \"%s\" \"%s\"\n", symb->name, symb->help);
|
||||
|
|
|
@ -35,30 +35,30 @@ float osdscale = 2.f, osdrscale = 0.5f;
|
|||
float osdscale = 1.f, osdrscale = 1.f;
|
||||
#endif
|
||||
|
||||
#define OSD_SCALE(x) (int32_t)(osdscale != 1.f ? Blrintf(osdscale*(float)(x)) : (x))
|
||||
#define OSD_SCALEDIV(x) (int32_t)Blrintf((float)(x) * osdrscale)
|
||||
#define OSD_SCALE(x) (osdscale != 1.f ? Blrintf(osdscale*(float)(x)) : (x))
|
||||
#define OSD_SCALEDIV(x) Blrintf((float)(x) * osdrscale)
|
||||
|
||||
#define OSDCHAR_WIDTH (tilesiz[STARTALPHANUM + 'A' - '!'].x)
|
||||
#define OSDCHAR_HEIGHT (tilesiz[STARTALPHANUM + 'A' - '!'].y + 1)
|
||||
|
||||
static inline int32_t GAME_isspace(int32_t ch)
|
||||
static inline CONSTEXPR int GAME_isspace(int ch)
|
||||
{
|
||||
return (ch==32 || ch==9);
|
||||
}
|
||||
|
||||
static inline int32_t GAME_getchartile(int32_t ch)
|
||||
static inline int GAME_getchartile(int ch)
|
||||
{
|
||||
const int32_t ac = ch-'!'+STARTALPHANUM;
|
||||
const int ac = ch-'!'+STARTALPHANUM;
|
||||
return (ac < STARTALPHANUM || ac > ENDALPHANUM) ? -1 : ac;
|
||||
}
|
||||
|
||||
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
||||
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal)
|
||||
{
|
||||
int16_t ac;
|
||||
int ac;
|
||||
#ifndef USE_OPENGL
|
||||
int32_t usehightile = 0;
|
||||
int usehightile = 0;
|
||||
#endif
|
||||
int32_t ht = usehightile;
|
||||
int ht = usehightile;
|
||||
|
||||
if (GAME_isspace(ch)) return;
|
||||
if ((ac = GAME_getchartile(ch)) == -1)
|
||||
|
@ -71,11 +71,11 @@ void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
|||
usehightile = ht;
|
||||
}
|
||||
|
||||
void GAME_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t shade, int32_t pal)
|
||||
void GAME_drawosdstr(int x, int y, const char *ch, int len, int shade, int pal)
|
||||
{
|
||||
int16_t ac;
|
||||
int ac;
|
||||
#ifdef USE_OPENGL
|
||||
const int32_t ht = usehightile;
|
||||
const int ht = usehightile;
|
||||
usehightile = (osdhightile && ht);
|
||||
#endif
|
||||
|
||||
|
@ -101,12 +101,9 @@ void GAME_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t
|
|||
#endif
|
||||
}
|
||||
|
||||
void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress)
|
||||
void GAME_drawosdcursor(int x, int y, int type, int32_t lastkeypress)
|
||||
{
|
||||
int16_t ac;
|
||||
|
||||
if (type) ac = SMALLFNTCURSOR;
|
||||
else ac = '_'-'!'+STARTALPHANUM;
|
||||
int ac = (type) ? SMALLFNTCURSOR : '_' - '!' + STARTALPHANUM;
|
||||
|
||||
if (((BGetTime()-lastkeypress) & 0x40)==0)
|
||||
rotatesprite_fs(OSD_SCALE((OSDCHAR_WIDTH*x)<<16),
|
||||
|
@ -114,17 +111,17 @@ void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress
|
|||
OSD_SCALE(65536.f), 0, ac, 0, 8, 8|16);
|
||||
}
|
||||
|
||||
int32_t GAME_getcolumnwidth(int32_t w)
|
||||
int GAME_getcolumnwidth(int w)
|
||||
{
|
||||
return OSD_SCALEDIV(w/OSDCHAR_WIDTH);
|
||||
}
|
||||
|
||||
int32_t GAME_getrowheight(int32_t h)
|
||||
int GAME_getrowheight(int h)
|
||||
{
|
||||
return OSD_SCALEDIV(h/OSDCHAR_HEIGHT);
|
||||
}
|
||||
|
||||
void GAME_onshowosd(int32_t shown)
|
||||
void GAME_onshowosd(int shown)
|
||||
{
|
||||
G_UpdateScreenArea();
|
||||
|
||||
|
@ -137,15 +134,15 @@ void GAME_onshowosd(int32_t shown)
|
|||
// KB_KeyDown[sc_Pause] = 1;
|
||||
}
|
||||
|
||||
void GAME_clearbackground(int32_t numcols, int32_t numrows)
|
||||
void GAME_clearbackground(int numcols, int numrows)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(numcols);
|
||||
|
||||
# ifdef USE_OPENGL
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST && in3dmode())
|
||||
{
|
||||
const int32_t i8n8 = OSD_SCALE(OSDCHAR_HEIGHT*numrows);
|
||||
// glPushAttrib(GL_FOG_BIT);
|
||||
int const i8n8 = OSD_SCALE(OSDCHAR_HEIGHT*numrows);
|
||||
|
||||
polymost_setFogEnabled(false);
|
||||
polymost_useColorOnly(true);
|
||||
|
||||
|
@ -157,15 +154,15 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows)
|
|||
glRecti(0, i8n8+4, xdim, i8n8+OSDCHAR_HEIGHT);
|
||||
|
||||
polymost_useColorOnly(false);
|
||||
|
||||
if (!nofog)
|
||||
polymost_setFogEnabled(true);
|
||||
// glPopAttrib();
|
||||
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
CLEARLINES2D(0, min(ydim, OSD_SCALE(numrows*OSDCHAR_HEIGHT+OSDCHAR_HEIGHT)), editorcolors[16]);
|
||||
CLEARLINES2D(0, min(ydim, OSD_SCALE(numrows * OSDCHAR_HEIGHT + OSDCHAR_HEIGHT)), editorcolors[16]);
|
||||
}
|
||||
|
||||
#undef OSD_SCALE
|
||||
|
|
Loading…
Reference in a new issue