Improved the text input buffer changes; this works reasonably well now.

git-svn-id: https://svn.eduke32.com/eduke32@81 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-21 07:34:05 +00:00
parent bff34ebbfb
commit 75896562df
3 changed files with 15 additions and 14 deletions

View file

@ -306,7 +306,7 @@ struct animwalltype {
extern struct animwalltype animwall[MAXANIMWALLS]; extern struct animwalltype animwall[MAXANIMWALLS];
extern short numanimwalls,probey,lastprobey; extern short numanimwalls,probey,lastprobey;
extern char typebuflen,typebuf[91]; extern char typebuflen,typebuf[141];
extern char MusicPtr[72000*2]; extern char MusicPtr[72000*2];
extern long msx[2048],msy[2048]; extern long msx[2048],msy[2048];
extern short cyclers[MAXCYCLERS][6],numcyclers; extern short cyclers[MAXCYCLERS][6],numcyclers;

View file

@ -161,9 +161,12 @@ void setgamepalette(struct player_struct *player, char *pal, int set)
player->palette = pal; player->palette = pal;
} }
#define MPTEXT(x,y) ((xdim >= 640 && ydim >= 480)?x:y)
#define QUOTEWRAPLEN 75
int txgametext_(int small, int starttile, int x,int y,char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2) int txgametext_(int small, int starttile, int x,int y,char *t,char s,char p,short orientation,long x1, long y1, long x2, long y2)
{ {
short ac,newx; short ac,newx,oldx=x;
char centre, *oldt; char centre, *oldt;
centre = ( x == (320>>1) ); centre = ( x == (320>>1) );
@ -201,7 +204,7 @@ int txgametext_(int small, int starttile, int x,int y,char *t,char s,char p,shor
if(*t >= '0' && *t <= '9') if(*t >= '0' && *t <= '9')
x += small?4:8; x += small?4:8;
else x += (tilesizx[ac]>>small); else x += (tilesizx[ac]>>small);
if(x > 310) x = 0, y+=small?4:8; if((t-oldt >= QUOTEWRAPLEN-5 && *t == 32) || t-oldt > QUOTEWRAPLEN) oldt = t, x = oldx, y+=small?4:8;
t++; t++;
} }
@ -226,8 +229,8 @@ inline int gametext(int x,int y,char *t,char s,short dabits)
inline int mpgametext(int x,int y,char *t,char s,short dabits) inline int mpgametext(int x,int y,char *t,char s,short dabits)
{ {
if(xdim >= 640 && ydim >= 480) if(xdim >= 640 && ydim >= 480)
return(txgametextsm(STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); return(txgametextsm(STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
else return(txgametext(STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); else return(txgametext(STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
} }
inline int gametextpal(int x,int y,char *t,char s,char p) inline int gametextpal(int x,int y,char *t,char s,char p)
@ -271,7 +274,7 @@ void gamenumber(long x,long y,long n,char s)
gametext(x,y,b,s,2+8+16); gametext(x,y,b,s,2+8+16);
} }
char recbuf[130]; char recbuf[180];
void allowtimetocorrecterrorswhenquitting(void) void allowtimetocorrecterrorswhenquitting(void)
{ {
long i, j, oldtotalclock; long i, j, oldtotalclock;
@ -300,11 +303,9 @@ void allowtimetocorrecterrorswhenquitting(void)
#define MAXUSERQUOTES 4 #define MAXUSERQUOTES 4
long quotebot, quotebotgoal; long quotebot, quotebotgoal;
short user_quote_time[MAXUSERQUOTES]; short user_quote_time[MAXUSERQUOTES];
char user_quote[MAXUSERQUOTES][128]; char user_quote[MAXUSERQUOTES][178];
// char typebuflen,typebuf[41]; // char typebuflen,typebuf[41];
#define MPTEXT(x,y) ((xdim >= 640 && ydim >= 480)?x:y)
void adduserquote(char *daquote) void adduserquote(char *daquote)
{ {
long i; long i;
@ -2002,7 +2003,7 @@ void operatefta(void)
for(i=0;i<MAXUSERQUOTES;i++) for(i=0;i<MAXUSERQUOTES;i++)
{ {
k = user_quote_time[i]; if (k <= 0) break; k = user_quote_time[i]; if (k <= 0) break;
if(Bstrlen(user_quote[i]) >= QUOTEWRAPLEN) j -= MPTEXT(4,8);
if (k > 4) if (k > 4)
mpgametext(320>>1,j,user_quote[i],0,2+8+16); mpgametext(320>>1,j,user_quote[i],0,2+8+16);
else if (k > 2) mpgametext(320>>1,j,user_quote[i],0,2+8+16+1); else if (k > 2) mpgametext(320>>1,j,user_quote[i],0,2+8+16+1);
@ -2030,7 +2031,7 @@ void operatefta(void)
for(i=0;i<MAXUSERQUOTES;i++) for(i=0;i<MAXUSERQUOTES;i++)
{ {
if (user_quote_time[i] <= 0) break; if (user_quote_time[i] <= 0) break;
k -= MPTEXT(4,8); k -= MPTEXT(4,8)<<(Bstrlen(user_quote[i]) >= QUOTEWRAPLEN);
} }
k -= MPTEXT(2,4); k -= MPTEXT(2,4);
} }
@ -2245,7 +2246,7 @@ void typemode(void)
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
} }
adduserquote(recbuf); adduserquote(recbuf);
quotebot += MPTEXT(4,8); quotebot += MPTEXT(4,8)<<(Bstrlen(recbuf) >= QUOTEWRAPLEN);
quotebotgoal = quotebot; quotebotgoal = quotebot;
} }
else if(sendmessagecommand >= 0) else if(sendmessagecommand >= 0)
@ -2320,7 +2321,7 @@ void typemode(void)
else else
{ {
if(ud.screen_size > 0) j = 200-45; else j = 200-8; if(ud.screen_size > 0) j = 200-45; else j = 200-8;
hitstate = strget(320>>1,j,typebuf,MPTEXT(70,30),1); hitstate = strget(320>>1,j,typebuf,MPTEXT(120,30),1);
if(hitstate == 1) if(hitstate == 1)
{ {

View file

@ -118,7 +118,7 @@ char *music_pointer;
char actortype[MAXTILES]; char actortype[MAXTILES];
long script[MAXSCRIPTSIZE+16]; long script[MAXSCRIPTSIZE+16];
char display_mirror,typebuflen,typebuf[91]; char display_mirror,typebuflen,typebuf[141];
char music_fn[MAXVOLUMES+1][11][13],music_select; char music_fn[MAXVOLUMES+1][11][13],music_select;
char env_music_fn[MAXVOLUMES+1][13]; char env_music_fn[MAXVOLUMES+1][13];