mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Better line wrapping for multiplayer chat messages
git-svn-id: https://svn.eduke32.com/eduke32@867 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2b85433e4f
commit
f98227d6f3
5 changed files with 59 additions and 32 deletions
|
@ -119,6 +119,11 @@ const char *stripcolorcodes(const char *t)
|
||||||
t++;
|
t++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (*t == '^' && (Btoupper(*(t+1)) == 'S'||Btoupper(*(t+1)) == 'O'))
|
||||||
|
{
|
||||||
|
t += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
colstrip[i] = *t;
|
colstrip[i] = *t;
|
||||||
i++,t++;
|
i++,t++;
|
||||||
}
|
}
|
||||||
|
@ -1340,6 +1345,12 @@ void OSD_Printf(const char *fmt, ...)
|
||||||
if (isdigit(*(++chp)))
|
if (isdigit(*(++chp)))
|
||||||
s = *chp;
|
s = *chp;
|
||||||
}
|
}
|
||||||
|
else if (*chp == '^' && Btoupper(*(chp+1)) == 'O')
|
||||||
|
{
|
||||||
|
chp++;
|
||||||
|
p = osdtextpal;
|
||||||
|
s = osdtextshade;
|
||||||
|
}
|
||||||
else if (*chp == '\r') osdpos=0;
|
else if (*chp == '\r') osdpos=0;
|
||||||
else if (*chp == '\n')
|
else if (*chp == '\n')
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,6 +151,9 @@ static char recbuf[180];
|
||||||
|
|
||||||
extern void computergetinput(int snum, input *syn);
|
extern void computergetinput(int snum, input *syn);
|
||||||
|
|
||||||
|
#define USERQUOTE_LEFTOFFSET 5
|
||||||
|
#define USERQUOTE_RIGHTOFFSET 14
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
T_EOF = -2,
|
T_EOF = -2,
|
||||||
|
@ -275,8 +278,6 @@ void setgamepalette(player_struct *player, char *pal, int set)
|
||||||
player->palette = pal;
|
player->palette = pal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TEXTWRAPLEN (scale(39,ud.config.ScreenWidth,320))
|
|
||||||
|
|
||||||
int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2, int z)
|
int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2, int z)
|
||||||
{
|
{
|
||||||
int ac,newx,oldx=x;
|
int ac,newx,oldx=x;
|
||||||
|
@ -342,7 +343,7 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
|
||||||
}
|
}
|
||||||
if (*t == 32)
|
if (*t == 32)
|
||||||
{
|
{
|
||||||
x+=8*z/65536;
|
x+=5*z/65536;
|
||||||
t++;
|
t++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +357,36 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
|
||||||
if ((*t >= '0' && *t <= '9'))
|
if ((*t >= '0' && *t <= '9'))
|
||||||
x += 8*z/65536;
|
x += 8*z/65536;
|
||||||
else x += tilesizx[ac]*z/65536;//(tilesizx[ac]>>small);
|
else x += tilesizx[ac]*z/65536;//(tilesizx[ac]>>small);
|
||||||
if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = (char *)t, x = oldx, y+=8*z/65536;
|
if (x > (ud.config.ScreenWidth - 14)) oldt = (char *)t, x = oldx, y+=8*z/65536;
|
||||||
|
t++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (x);
|
||||||
|
}
|
||||||
|
|
||||||
|
int gametextlen(int x,const char *t)
|
||||||
|
{
|
||||||
|
int ac;
|
||||||
|
|
||||||
|
if (t == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
while (*t)
|
||||||
|
{
|
||||||
|
if (*t == 32)
|
||||||
|
{
|
||||||
|
x+=5;
|
||||||
|
t++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else ac = *t - '!' + STARTALPHANUM;
|
||||||
|
|
||||||
|
if (ac < STARTALPHANUM || ac > (STARTALPHANUM + 93))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ((*t >= '0' && *t <= '9'))
|
||||||
|
x += 8;
|
||||||
|
else x += tilesizx[ac];
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2404,10 +2434,10 @@ static void operatefta(void)
|
||||||
{
|
{
|
||||||
if (user_quote_time[i] <= 0) break;
|
if (user_quote_time[i] <= 0) break;
|
||||||
k = user_quote_time[i];
|
k = user_quote_time[i];
|
||||||
l = Bstrlen(user_quote[i]);
|
l = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(user_quote[i]));
|
||||||
while (l > TEXTWRAPLEN)
|
while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
|
||||||
{
|
{
|
||||||
l -= TEXTWRAPLEN;
|
l -= (ud.config.ScreenWidth-USERQUOTE_RIGHTOFFSET);
|
||||||
j -= 8;
|
j -= 8;
|
||||||
}
|
}
|
||||||
if (k > 4)
|
if (k > 4)
|
||||||
|
@ -2446,18 +2476,6 @@ static void operatefta(void)
|
||||||
if (g_player[screenpeek].ps->ftq == 115 || g_player[screenpeek].ps->ftq == 116 || g_player[screenpeek].ps->ftq == 117)
|
if (g_player[screenpeek].ps->ftq == 115 || g_player[screenpeek].ps->ftq == 116 || g_player[screenpeek].ps->ftq == 117)
|
||||||
{
|
{
|
||||||
k = quotebot-8-4;
|
k = quotebot-8-4;
|
||||||
/* for(i=0;i<MAXUSERQUOTES;i++)
|
|
||||||
{
|
|
||||||
if (user_quote_time[i] <= 0) break;
|
|
||||||
k -= 8;
|
|
||||||
l = Bstrlen(user_quote[i]);
|
|
||||||
while(l > TEXTWRAPLEN)
|
|
||||||
{
|
|
||||||
l -= TEXTWRAPLEN;
|
|
||||||
k -= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
k -= 4; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
j = g_player[screenpeek].ps->fta;
|
j = g_player[screenpeek].ps->fta;
|
||||||
|
@ -2676,10 +2694,10 @@ static int strget_(int small,int x,int y,char *t,int dalen,int c)
|
||||||
}
|
}
|
||||||
c = 4-(sintable[(totalclock<<4)&2047]>>11);
|
c = 4-(sintable[(totalclock<<4)&2047]>>11);
|
||||||
|
|
||||||
i = Bstrlen(t);
|
i = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(t));
|
||||||
while (i > TEXTWRAPLEN-!small)
|
while (i > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
|
||||||
{
|
{
|
||||||
i -= TEXTWRAPLEN-!small;
|
i -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET);
|
||||||
y += 8;
|
y += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2754,10 +2772,10 @@ static void typemode(void)
|
||||||
}
|
}
|
||||||
adduserquote(recbuf);
|
adduserquote(recbuf);
|
||||||
quotebot += 8;
|
quotebot += 8;
|
||||||
l = Bstrlen(recbuf);
|
l = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(recbuf));
|
||||||
while (l > TEXTWRAPLEN)
|
while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
|
||||||
{
|
{
|
||||||
l -= TEXTWRAPLEN;
|
l -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET);
|
||||||
quotebot += 8;
|
quotebot += 8;
|
||||||
}
|
}
|
||||||
quotebotgoal = quotebot;
|
quotebotgoal = quotebot;
|
||||||
|
|
|
@ -2734,7 +2734,7 @@ cheat_for_port_credits:
|
||||||
"Parental lock",
|
"Parental lock",
|
||||||
"-",
|
"-",
|
||||||
"Game messages",
|
"Game messages",
|
||||||
"HUD weapon",
|
"HUD weapon display",
|
||||||
"FPS counter",
|
"FPS counter",
|
||||||
"-",
|
"-",
|
||||||
"Automatic voting",
|
"Automatic voting",
|
||||||
|
@ -2812,7 +2812,7 @@ cheat_for_port_credits:
|
||||||
}
|
}
|
||||||
modval(0,2,(int *)&ud.drawweapon,1,probey==io);
|
modval(0,2,(int *)&ud.drawweapon,1,probey==io);
|
||||||
{
|
{
|
||||||
char *s[] = { "Off", "On", "Icon" };
|
char *s[] = { "Disabled", "Normal", "Item" };
|
||||||
gametextpal(d,yy, s[ud.drawweapon], MENUHIGHLIGHT(io), 0);
|
gametextpal(d,yy, s[ud.drawweapon], MENUHIGHLIGHT(io), 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "namesdyn.h"
|
#include "namesdyn.h"
|
||||||
|
#include "osdfuncs.h"
|
||||||
|
|
||||||
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal)
|
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal)
|
||||||
{
|
{
|
||||||
|
@ -13,16 +14,11 @@ void GAME_drawosdchar(int x, int y, char ch, int shade, int pal)
|
||||||
rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1);
|
rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OSDCHAR_WIDTH 8
|
|
||||||
|
|
||||||
void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal)
|
void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal)
|
||||||
{
|
{
|
||||||
short ac;
|
short ac;
|
||||||
char *ptr = OSD_GetTextPtr();
|
char *ptr = OSD_GetTextPtr();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(shade);
|
|
||||||
UNREFERENCED_PARAMETER(pal);
|
|
||||||
|
|
||||||
for (x = (x<<3)+x; len>0; len--, ch++, x++)
|
for (x = (x<<3)+x; len>0; len--, ch++, x++)
|
||||||
{
|
{
|
||||||
if (*ch == 32)
|
if (*ch == 32)
|
||||||
|
|
|
@ -5,3 +5,5 @@ int GAME_getcolumnwidth(int w);
|
||||||
int GAME_getrowheight(int w);
|
int GAME_getrowheight(int w);
|
||||||
void GAME_clearbackground(int c, int r);
|
void GAME_clearbackground(int c, int r);
|
||||||
void GAME_onshowosd(int shown);
|
void GAME_onshowosd(int shown);
|
||||||
|
|
||||||
|
#define OSDCHAR_WIDTH 8
|
Loading…
Reference in a new issue