mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Use screentext in viewDrawText
This commit is contained in:
parent
90dc59749d
commit
182d5d2eb5
3 changed files with 77 additions and 59 deletions
|
@ -794,7 +794,6 @@ vec2_t G_ScreenText(const int32_t font,
|
|||
return size;
|
||||
}
|
||||
|
||||
#if 0
|
||||
vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy,
|
||||
const int32_t font,
|
||||
int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle,
|
||||
|
@ -830,6 +829,7 @@ vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy,
|
|||
return size;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void G_PrintGameText(int32_t tile, int32_t x, int32_t y, const char *t,
|
||||
int32_t s, int32_t p, int32_t o,
|
||||
int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
|
|
|
@ -59,35 +59,35 @@ enum ScreenTextFlags_t {
|
|||
// TEXT_GRAYFONT = 0x00200000,
|
||||
};
|
||||
|
||||
extern int32_t minitext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t sb);
|
||||
extern void menutext_(int32_t x, int32_t y, int32_t s, char const *t, int32_t o, int32_t f);
|
||||
extern void captionmenutext(int32_t x, int32_t y, char const *t);
|
||||
extern vec2_t gametext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t o, int32_t a, int32_t f);
|
||||
extern void gametext_simple(int32_t x, int32_t y, const char *t);
|
||||
#define mpgametext_x (5<<16)
|
||||
extern vec2_t mpgametext(int32_t x, int32_t y, char const * t, int32_t s, int32_t o, int32_t a, int32_t f);
|
||||
extern vec2_t mpgametextsize(char const * t, int32_t f);
|
||||
extern int32_t textsc(int32_t sc);
|
||||
|
||||
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
|
||||
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
|
||||
#define menutext(x, y, t) menutext_((x), (y), 0, (t), 10|16, 0)
|
||||
#define menutext_centeralign(x, y, t) menutext_((x), (y), 0, (t), 10|16, TEXT_XCENTER|TEXT_YCENTER)
|
||||
#define menutext_center(y, t) menutext_(160<<16, (y)<<16, 0, (t), 10|16, TEXT_XCENTER)
|
||||
#define gametext(x, y, t) gametext_simple((x)<<16, (y)<<16, (t))
|
||||
#define gametext_widenumber(x, y, t) gametext_((x)<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 1024, 0, TEXT_GAMETEXTNUMHACK)
|
||||
#define gametext_number(x, y, t) gametext_((x)<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_GAMETEXTNUMHACK)
|
||||
#define gametext_pal(x, y, t, p) gametext_((x)<<16, (y)<<16, (t), 0, (p), 0, 0, 0)
|
||||
#define gametext_center(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER)
|
||||
#define gametext_center_number(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER|TEXT_GAMETEXTNUMHACK)
|
||||
#define gametext_center_shade(y, t, s) gametext_(160<<16, (y)<<16, (t), (s), MF_Bluefont.pal, 0, 0, TEXT_XCENTER)
|
||||
#define gametext_center_shade_pal(y, t, s, p) gametext_(160<<16, (y)<<16, (t), (s), (p), 0, 0, TEXT_XCENTER)
|
||||
|
||||
extern void G_PrintGameText(int32_t tile, int32_t x, int32_t y, const char *t,
|
||||
int32_t s, int32_t p, int32_t o,
|
||||
int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
int32_t z, int32_t a);
|
||||
|
||||
//extern int32_t minitext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t sb);
|
||||
//extern void menutext_(int32_t x, int32_t y, int32_t s, char const *t, int32_t o, int32_t f);
|
||||
//extern void captionmenutext(int32_t x, int32_t y, char const *t);
|
||||
//extern vec2_t gametext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t o, int32_t a, int32_t f);
|
||||
//extern void gametext_simple(int32_t x, int32_t y, const char *t);
|
||||
//#define mpgametext_x (5<<16)
|
||||
//extern vec2_t mpgametext(int32_t x, int32_t y, char const * t, int32_t s, int32_t o, int32_t a, int32_t f);
|
||||
//extern vec2_t mpgametextsize(char const * t, int32_t f);
|
||||
//extern int32_t textsc(int32_t sc);
|
||||
//
|
||||
//#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
|
||||
//#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
|
||||
//#define menutext(x, y, t) menutext_((x), (y), 0, (t), 10|16, 0)
|
||||
//#define menutext_centeralign(x, y, t) menutext_((x), (y), 0, (t), 10|16, TEXT_XCENTER|TEXT_YCENTER)
|
||||
//#define menutext_center(y, t) menutext_(160<<16, (y)<<16, 0, (t), 10|16, TEXT_XCENTER)
|
||||
//#define gametext(x, y, t) gametext_simple((x)<<16, (y)<<16, (t))
|
||||
//#define gametext_widenumber(x, y, t) gametext_((x)<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 1024, 0, TEXT_GAMETEXTNUMHACK)
|
||||
//#define gametext_number(x, y, t) gametext_((x)<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_GAMETEXTNUMHACK)
|
||||
//#define gametext_pal(x, y, t, p) gametext_((x)<<16, (y)<<16, (t), 0, (p), 0, 0, 0)
|
||||
//#define gametext_center(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER)
|
||||
//#define gametext_center_number(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER|TEXT_GAMETEXTNUMHACK)
|
||||
//#define gametext_center_shade(y, t, s) gametext_(160<<16, (y)<<16, (t), (s), MF_Bluefont.pal, 0, 0, TEXT_XCENTER)
|
||||
//#define gametext_center_shade_pal(y, t, s, p) gametext_(160<<16, (y)<<16, (t), (s), (p), 0, 0, TEXT_XCENTER)
|
||||
//
|
||||
//extern void G_PrintGameText(int32_t tile, int32_t x, int32_t y, const char *t,
|
||||
// int32_t s, int32_t p, int32_t o,
|
||||
// int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
// int32_t z, int32_t a);
|
||||
//
|
||||
extern int32_t G_GetStringLineLength(const char *text, const char *end, int32_t iter);
|
||||
extern int32_t G_GetStringNumLines(const char *text, const char *end, int32_t iter);
|
||||
extern char* G_GetSubString(const char *text, const char *end, int32_t iter, int32_t length);
|
||||
|
|
|
@ -53,6 +53,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "player.h"
|
||||
#include "replace.h"
|
||||
#include "screen.h"
|
||||
#include "screentext.h"
|
||||
#include "sectorfx.h"
|
||||
#include "tile.h"
|
||||
#include "trig.h"
|
||||
|
@ -982,37 +983,54 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int
|
|||
{
|
||||
if (nFont < 0 || nFont >= 5 || !pString) return;
|
||||
FONT *pFont = &gFont[nFont];
|
||||
|
||||
if (position)
|
||||
int nFlags = TEXT_INTERNALSPACE;
|
||||
switch (position)
|
||||
{
|
||||
const char *s = pString;
|
||||
int width = -pFont->space;
|
||||
while (*s)
|
||||
{
|
||||
int nTile = ((*s-' ')&127)+pFont->tile;
|
||||
if (tilesiz[nTile].x && tilesiz[nTile].y)
|
||||
width += tilesiz[nTile].x+pFont->space;
|
||||
s++;
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
nFlags |= TEXT_XCENTER;
|
||||
break;
|
||||
case 2:
|
||||
nFlags |= TEXT_XRIGHT;
|
||||
break;
|
||||
}
|
||||
if (position == 1)
|
||||
width >>= 1;
|
||||
x -= width;
|
||||
}
|
||||
const char *s = pString;
|
||||
while (*s)
|
||||
{
|
||||
int nTile = ((*s-' ')&127) + pFont->tile;
|
||||
if (tilesiz[nTile].x && tilesiz[nTile].y)
|
||||
{
|
||||
if (shadow)
|
||||
{
|
||||
rotatesprite_fs_alpha((x+1)<<16, (y+1)<<16, 65536, 0, nTile, 127, nPalette, 26|nStat, alpha);
|
||||
}
|
||||
rotatesprite_fs_alpha(x<<16, y<<16, 65536, 0, nTile, nShade, nPalette, 26|nStat, alpha);
|
||||
x += tilesiz[nTile].x+pFont->space;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
G_ScreenText(pFont->tile, x + 1, y + 1, 65536, 0, 0, pString, 127, nPalette, 2|8|16, alpha, 0, 0, pFont->space, 0, nFlags, 0, 0, xdim-1, ydim-1);
|
||||
G_ScreenText(pFont->tile, x, y, 65536, 0, 0, pString, nShade, nPalette, 2|8|16, alpha, 0, 0, pFont->space, 0, nFlags, 0, 0, xdim-1, ydim-1);
|
||||
//if (nFont < 0 || nFont >= 5 || !pString) return;
|
||||
//FONT *pFont = &gFont[nFont];
|
||||
//
|
||||
//if (position)
|
||||
//{
|
||||
// const char *s = pString;
|
||||
// int width = -pFont->space;
|
||||
// while (*s)
|
||||
// {
|
||||
// int nTile = ((*s-' ')&127)+pFont->tile;
|
||||
// if (tilesiz[nTile].x && tilesiz[nTile].y)
|
||||
// width += tilesiz[nTile].x+pFont->space;
|
||||
// s++;
|
||||
// }
|
||||
// if (position == 1)
|
||||
// width >>= 1;
|
||||
// x -= width;
|
||||
//}
|
||||
//const char *s = pString;
|
||||
//while (*s)
|
||||
//{
|
||||
// int nTile = ((*s-' ')&127) + pFont->tile;
|
||||
// if (tilesiz[nTile].x && tilesiz[nTile].y)
|
||||
// {
|
||||
// if (shadow)
|
||||
// {
|
||||
// rotatesprite_fs_alpha((x+1)<<16, (y+1)<<16, 65536, 0, nTile, 127, nPalette, 26|nStat, alpha);
|
||||
// }
|
||||
// rotatesprite_fs_alpha(x<<16, y<<16, 65536, 0, nTile, nShade, nPalette, 26|nStat, alpha);
|
||||
// x += tilesiz[nTile].x+pFont->space;
|
||||
// }
|
||||
// s++;
|
||||
//}
|
||||
}
|
||||
|
||||
void viewTileSprite(int nTile, int nShade, int nPalette, int x1, int y1, int x2, int y2)
|
||||
|
|
Loading…
Reference in a new issue