mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 20:50:42 +00:00
Merge a few more lines into queue_character, and prepare for optimizing gl Draw_nString.
This commit is contained in:
parent
1828cbff5a
commit
a49177c605
1 changed files with 22 additions and 25 deletions
|
@ -371,8 +371,13 @@ flush_text (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
queue_character (int x, int y, float frow, float fcol)
|
queue_character (int x, int y, int num)
|
||||||
{
|
{
|
||||||
|
float frow, fcol;
|
||||||
|
|
||||||
|
frow = (num >> 4) * CELL_SIZE;
|
||||||
|
fcol = (num & 15) * CELL_SIZE;
|
||||||
|
|
||||||
*tC++ = fcol;
|
*tC++ = fcol;
|
||||||
*tC++ = frow;
|
*tC++ = frow;
|
||||||
*tC++ = fcol + CELL_SIZE;
|
*tC++ = fcol + CELL_SIZE;
|
||||||
|
@ -389,7 +394,12 @@ queue_character (int x, int y, float frow, float fcol)
|
||||||
*tV++ = y + 8;
|
*tV++ = y + 8;
|
||||||
*tV++ = x;
|
*tV++ = x;
|
||||||
*tV++ = y + 8;
|
*tV++ = y + 8;
|
||||||
tVAcount += 4;
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
tVA_increment (void)
|
||||||
|
{
|
||||||
|
tVAcount +=4;
|
||||||
if (tVAcount + 4 > tVAsize)
|
if (tVAcount + 4 > tVAsize)
|
||||||
flush_text ();
|
flush_text ();
|
||||||
}
|
}
|
||||||
|
@ -404,8 +414,6 @@ queue_character (int x, int y, float frow, float fcol)
|
||||||
void
|
void
|
||||||
Draw_Character (int x, int y, unsigned int num)
|
Draw_Character (int x, int y, unsigned int num)
|
||||||
{
|
{
|
||||||
float frow, fcol;
|
|
||||||
|
|
||||||
if (num == 32)
|
if (num == 32)
|
||||||
return; // space
|
return; // space
|
||||||
if (y <= -8)
|
if (y <= -8)
|
||||||
|
@ -413,17 +421,14 @@ Draw_Character (int x, int y, unsigned int num)
|
||||||
|
|
||||||
num &= 255;
|
num &= 255;
|
||||||
|
|
||||||
frow = (num >> 4) * CELL_SIZE;
|
queue_character (x, y, num);
|
||||||
fcol = (num & 15) * CELL_SIZE;
|
tVA_increment ();
|
||||||
|
|
||||||
queue_character (x, y, frow, fcol);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Draw_String (int x, int y, const char *str)
|
Draw_String (int x, int y, const char *str)
|
||||||
{
|
{
|
||||||
unsigned char num;
|
unsigned char num;
|
||||||
float frow, fcol;
|
|
||||||
|
|
||||||
if (!str || !str[0])
|
if (!str || !str[0])
|
||||||
return;
|
return;
|
||||||
|
@ -432,10 +437,8 @@ Draw_String (int x, int y, const char *str)
|
||||||
|
|
||||||
while (*str) {
|
while (*str) {
|
||||||
if ((num = *str++) != 32) { // Don't render spaces
|
if ((num = *str++) != 32) { // Don't render spaces
|
||||||
frow = (num >> 4) * CELL_SIZE;
|
queue_character (x, y, num);
|
||||||
fcol = (num & 15) * CELL_SIZE;
|
tVA_increment ();
|
||||||
|
|
||||||
queue_character (x, y, frow, fcol);
|
|
||||||
}
|
}
|
||||||
x += 8;
|
x += 8;
|
||||||
}
|
}
|
||||||
|
@ -444,8 +447,7 @@ Draw_String (int x, int y, const char *str)
|
||||||
void
|
void
|
||||||
Draw_nString (int x, int y, const char *str, int count)
|
Draw_nString (int x, int y, const char *str, int count)
|
||||||
{
|
{
|
||||||
unsigned char num;
|
unsigned char num;
|
||||||
float frow, fcol;
|
|
||||||
|
|
||||||
if (!str || !str[0])
|
if (!str || !str[0])
|
||||||
return;
|
return;
|
||||||
|
@ -454,10 +456,8 @@ Draw_nString (int x, int y, const char *str, int count)
|
||||||
|
|
||||||
while (count-- && *str) {
|
while (count-- && *str) {
|
||||||
if ((num = *str++) != 32) { // Don't render spaces
|
if ((num = *str++) != 32) { // Don't render spaces
|
||||||
frow = (num >> 4) * CELL_SIZE;
|
queue_character (x, y, num);
|
||||||
fcol = (num & 15) * CELL_SIZE;
|
tVA_increment ();
|
||||||
|
|
||||||
queue_character (x, y, frow, fcol);
|
|
||||||
}
|
}
|
||||||
x += 8;
|
x += 8;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,6 @@ void
|
||||||
Draw_AltString (int x, int y, const char *str)
|
Draw_AltString (int x, int y, const char *str)
|
||||||
{
|
{
|
||||||
unsigned char num;
|
unsigned char num;
|
||||||
float frow, fcol;
|
|
||||||
|
|
||||||
if (!str || !str[0])
|
if (!str || !str[0])
|
||||||
return;
|
return;
|
||||||
|
@ -477,10 +476,8 @@ Draw_AltString (int x, int y, const char *str)
|
||||||
while (*str) {
|
while (*str) {
|
||||||
if ((num = *str++ | 0x80) != (0x80 | 32)) // Don't render spaces
|
if ((num = *str++ | 0x80) != (0x80 | 32)) // Don't render spaces
|
||||||
{
|
{
|
||||||
frow = (num >> 4) * CELL_SIZE;
|
queue_character (x, y, num);
|
||||||
fcol = (num & 15) * CELL_SIZE;
|
tVA_increment ();
|
||||||
|
|
||||||
queue_character (x, y, frow, fcol);
|
|
||||||
}
|
}
|
||||||
x += 8;
|
x += 8;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue