git-svn-id: https://svn.eduke32.com/eduke32@929 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-08-03 11:45:15 +00:00
parent 2dc6f66dca
commit 900195a093
10 changed files with 81 additions and 74 deletions

View file

@ -23,7 +23,7 @@ typedef struct _symbol
} symbol_t; } symbol_t;
symbol_t *symbols; symbol_t *symbols;
const char *stripcolorcodes(const char *t); const char *stripcolorcodes(const char *in, char *out);
#define OSD_ALIAS 1337 #define OSD_ALIAS 1337
#define OSD_UNALIASED 1338 #define OSD_UNALIASED 1338

View file

@ -5628,12 +5628,12 @@ static int preinitcalled = 0;
#define DYNALLOC_ARRAYS #define DYNALLOC_ARRAYS
#ifndef DYNALLOC_ARRAYS #ifndef DYNALLOC_ARRAYS
spriteexttype spriteext_s[MAXSPRITES+MAXUNIQHUDID]; static spriteexttype spriteext_s[MAXSPRITES+MAXUNIQHUDID];
spritesmoothtype spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; static spritesmoothtype spritesmooth_s[MAXSPRITES+MAXUNIQHUDID];
sectortype sector_s[MAXSECTORS]; static sectortype sector_s[MAXSECTORS];
walltype wall_s[MAXWALLS]; static walltype wall_s[MAXWALLS];
spritetype sprite_s[MAXSPRITES]; static spritetype sprite_s[MAXSPRITES];
spritetype tsprite_s[MAXSPRITESONSCREEN]; static spritetype tsprite_s[MAXSPRITESONSCREEN];
#endif #endif
int preinitengine(void) int preinitengine(void)

View file

@ -116,35 +116,38 @@ static void (*_drawosdcursor)(int, int, int, int) = _internal_drawosdcursor;
static int (*_getcolumnwidth)(int) = _internal_getcolumnwidth; static int (*_getcolumnwidth)(int) = _internal_getcolumnwidth;
static int (*_getrowheight)(int) = _internal_getrowheight; static int (*_getrowheight)(int) = _internal_getrowheight;
const char *stripcolorcodes(const char *t) // color code format is as follows:
{ // ^## sets a color, where ## is the palette number
int i = 0; // ^S# sets a shade, range is 0-7 equiv to shades 0-14
static char colstrip[1024]; // ^O resets formatting to defaults
while (*t) const char *stripcolorcodes(const char *in, char *out)
{
char *ptr = out;
while (*in)
{ {
if (*t == '^' && isdigit(*(t+1))) if (*in == '^' && isdigit(*(in+1)))
{ {
t += 2; in += 2;
if (isdigit(*t)) if (isdigit(*in))
t++; in++;
continue; continue;
} }
if (*t == '^' && (Btoupper(*(t+1)) == 'S')) if (*in == '^' && (Btoupper(*(in+1)) == 'S') && isdigit(*(in+2)))
{ {
t += 3; in += 3;
continue; continue;
} }
if (*t == '^' && (Btoupper(*(t+1)) == 'O')) if (*in == '^' && (Btoupper(*(in+1)) == 'O'))
{ {
t += 2; in += 2;
continue; continue;
} }
colstrip[i] = *t; *(out++) = *(in++);
i++,t++;
} }
colstrip[i] = '\0'; *out = '\0';
return(colstrip); return(ptr);
} }
int OSD_Exec(const char *szScript) int OSD_Exec(const char *szScript)
@ -1380,7 +1383,8 @@ static inline void linefeed(void)
void OSD_Printf(const char *fmt, ...) void OSD_Printf(const char *fmt, ...)
{ {
char tmpstr[1024], *chp, p=osdtextpal, s=osdtextshade; static char tmpstr[1024];
char *chp, p=osdtextpal, s=osdtextshade;
va_list va; va_list va;
if (!osdinited) OSD_Init(); if (!osdinited) OSD_Init();
@ -1392,7 +1396,11 @@ void OSD_Printf(const char *fmt, ...)
if (linecnt<logcutoff) if (linecnt<logcutoff)
{ {
if (osdlog&&(!logcutoff||linecnt<logcutoff)) if (osdlog&&(!logcutoff||linecnt<logcutoff))
Bfputs(stripcolorcodes(tmpstr), osdlog); {
chp = Bstrdup(tmpstr);
Bfputs(stripcolorcodes(tmpstr,chp), osdlog);
Bfree(chp);
}
} }
else if (linecnt==logcutoff) else if (linecnt==logcutoff)
{ {
@ -1400,7 +1408,6 @@ void OSD_Printf(const char *fmt, ...)
linecnt=logcutoff+1; linecnt=logcutoff+1;
} }
for (chp = tmpstr; *chp; chp++) for (chp = tmpstr; *chp; chp++)
{ {
if (*chp == '^' && isdigit(*(chp+1))) if (*chp == '^' && isdigit(*(chp+1)))

View file

@ -620,7 +620,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
while (Bstrlen(stripcolorcodes(tempbuf)) > 10) while (Bstrlen(stripcolorcodes(tempbuf,tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0'; tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1); Bstrncpy(myname,tempbuf,sizeof(myname)-1);

View file

@ -511,7 +511,7 @@ typedef struct {
char return_to_center, reloading, name[32]; char return_to_center, reloading, name[32];
} player_struct; } player_struct;
extern char tempbuf[2048], packbuf[576]; extern char tempbuf[2048], packbuf[576], menutextbuf[128];
extern int gc; extern int gc;

View file

@ -107,7 +107,8 @@ extern void savetemp(const char *fn,int daptr,int dasiz);
// extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr); // extern int loadpheader(char spot,int32 *vn,int32 *ln,int32 *psk,int32 *numplr);
extern int loadplayer(int spot); extern int loadplayer(int spot);
extern int saveplayer(int spot); extern int saveplayer(int spot);
extern int menutext(int x,int y,int s,int p,char *t); extern int menutext_(int x,int y,int s,int p,char *t);
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)stripcolorcodes(t,menutextbuf))
extern void menus(void); extern void menus(void);
extern void palto(int r,int g,int b,int e); extern void palto(int r,int g,int b,int e);
extern void playanm(const char *fn,char); extern void playanm(const char *fn,char);

View file

@ -2443,7 +2443,7 @@ 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 = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(user_quote[i])); l = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(user_quote[i],tempbuf));
while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET)) while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
{ {
l -= (ud.config.ScreenWidth-USERQUOTE_RIGHTOFFSET); l -= (ud.config.ScreenWidth-USERQUOTE_RIGHTOFFSET);
@ -2714,7 +2714,7 @@ 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 = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(t)); i = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(t,tempbuf));
while (i > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET)) while (i > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
{ {
i -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET); i -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET);
@ -2792,7 +2792,7 @@ static void typemode(void)
} }
adduserquote(recbuf); adduserquote(recbuf);
quotebot += 8; quotebot += 8;
l = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(recbuf)); l = gametextlen(USERQUOTE_LEFTOFFSET,stripcolorcodes(recbuf,tempbuf));
while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET)) while (l > (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET))
{ {
l -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET); l -= (ud.config.ScreenWidth - USERQUOTE_RIGHTOFFSET);
@ -9874,7 +9874,7 @@ static void Startup(void)
// myname[10] = '\0'; // myname[10] = '\0';
Bstrcpy(tempbuf,CommandName); Bstrcpy(tempbuf,CommandName);
while (Bstrlen(stripcolorcodes(tempbuf)) > 10) while (Bstrlen(stripcolorcodes(tempbuf,tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0'; tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1); Bstrncpy(myname,tempbuf,sizeof(myname)-1);
@ -9925,36 +9925,6 @@ static void Startup(void)
if (ud.executions >= 50) initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n"); if (ud.executions >= 50) initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n");
} }
if (CONTROL_Startup(1, &GetTime, TICRATE))
{
uninitengine();
exit(1);
}
SetupGameButtons();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0;i<joynumaxes;i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
inittimer(TICRATE);
//initprintf("* Hold Esc to Abort. *\n");
// initprintf("Loading art header...\n");
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
gameexit("Failed loading art.");
// initprintf("Loading palette/lookups...\n");
genspriteremaps();
readsavenames();
tilesizx[MIRROR] = tilesizy[MIRROR] = 0;
for (i=0;i<MAXPLAYERS;i++) for (i=0;i<MAXPLAYERS;i++)
g_player[i].playerreadyflag = 0; g_player[i].playerreadyflag = 0;
@ -9991,6 +9961,36 @@ static void Startup(void)
if (numplayers > 1) if (numplayers > 1)
initprintf("Multiplayer initialized.\n"); initprintf("Multiplayer initialized.\n");
if (CONTROL_Startup(1, &GetTime, TICRATE))
{
uninitengine();
exit(1);
}
SetupGameButtons();
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent);
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0;i<joynumaxes;i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
inittimer(TICRATE);
//initprintf("* Hold Esc to Abort. *\n");
// initprintf("Loading art header...\n");
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
gameexit("Failed loading art.");
// initprintf("Loading palette/lookups...\n");
genspriteremaps();
readsavenames();
tilesizx[MIRROR] = tilesizy[MIRROR] = 0;
screenpeek = myconnectindex; screenpeek = myconnectindex;
if (networkmode == 255) if (networkmode == 255)
@ -12821,11 +12821,9 @@ void spriteglass(int i,int n)
void ceilingglass(int i,int sectnum,int n) void ceilingglass(int i,int sectnum,int n)
{ {
int j, xv, yv, z, x1, y1; int j, xv, yv, z, x1, y1, a,s;
int a,s, startwall,endwall; int startwall = sector[sectnum].wallptr;
int endwall = startwall+sector[sectnum].wallnum;
startwall = sector[sectnum].wallptr;
endwall = startwall+sector[sectnum].wallnum;
for (s=startwall;s<(endwall-1);s++) for (s=startwall;s<(endwall-1);s++)
{ {

View file

@ -48,7 +48,7 @@ short cyclers[MAXCYCLERS][6],numcyclers;
char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES]; char *fta_quotes[MAXQUOTES],*redefined_quotes[MAXQUOTES];
char tempbuf[2048], packbuf[576]; char tempbuf[2048], packbuf[576], menutextbuf[128];
char buf[1024]; char buf[1024];

View file

@ -193,12 +193,11 @@ static inline int probesm(int x,int y,int i,int n)
return probe_(1,x,y,i,n); return probe_(1,x,y,i,n);
} }
int menutext(int x,int y,int s,int p,char *t) int menutext_(int x,int y,int s,int p,char *t)
{ {
short i, ac, centre; short i, ac, centre;
int ht = usehightile; int ht = usehightile;
t = (char *)stripcolorcodes(t);
y -= 12; y -= 12;
i = centre = 0; i = centre = 0;
@ -873,7 +872,7 @@ void menus(void)
{ {
x = strget(d-50,37,buf,30,0); x = strget(d-50,37,buf,30,0);
while (Bstrlen(stripcolorcodes(buf)) > 10) while (Bstrlen(stripcolorcodes(buf,tempbuf)) > 10)
{ {
buf[Bstrlen(buf)-1] = '\0'; buf[Bstrlen(buf)-1] = '\0';
inputloc--; inputloc--;

View file

@ -926,6 +926,8 @@ static int osdcmd_usemousejoy(const osdfuncparm_t *parm)
static int osdcmd_name(const osdfuncparm_t *parm) static int osdcmd_name(const osdfuncparm_t *parm)
{ {
char namebuf[32];
if (parm->numparms != 1) if (parm->numparms != 1)
{ {
OSD_Printf("\"name\" is \"%s\"\n",myname); OSD_Printf("\"name\" is \"%s\"\n",myname);
@ -934,7 +936,7 @@ static int osdcmd_name(const osdfuncparm_t *parm)
Bstrcpy(tempbuf,parm->parms[0]); Bstrcpy(tempbuf,parm->parms[0]);
while (Bstrlen(stripcolorcodes(tempbuf)) > 10) while (Bstrlen(stripcolorcodes(tempbuf,namebuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0'; tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1); Bstrncpy(myname,tempbuf,sizeof(myname)-1);