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

This commit is contained in:
terminx 2008-07-23 03:56:50 +00:00
parent 8838d469c1
commit d1c4c8d7e2
7 changed files with 100 additions and 85 deletions

View file

@ -80,7 +80,7 @@ extern int *joyaxis, *joyhat, joyb;
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats; extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
extern int joyaxespresent; extern int joyaxespresent;
extern int qsetmode;
int initsystem(void); int initsystem(void);
void uninitsystem(void); void uninitsystem(void);

View file

@ -34,7 +34,8 @@ const char *stripcolorcodes(const char *t);
int OSD_ParsingScript(void); int OSD_ParsingScript(void);
int OSD_OSDKey(void); int OSD_OSDKey(void);
int OSD_TextMode(void); int OSD_GetTextMode(void);
void OSD_SetTextMode(int mode);
int OSD_Exec(const char *szScript); int OSD_Exec(const char *szScript);

View file

@ -85,8 +85,11 @@ static int osdexeccount=0; // number of lines from the head of the history buf
static int logcutoff=120000; static int logcutoff=120000;
static int linecnt; static int linecnt;
static int osdexecscript=0; static int osdexecscript=0;
#ifdef _WIN32
static int osdtextmode=0; static int osdtextmode=0;
#else
static int osdtextmode=1;
#endif
// presentation parameters // presentation parameters
static int osdpromptshade=0; static int osdpromptshade=0;
static int osdpromptpal=0; static int osdpromptpal=0;
@ -163,6 +166,62 @@ int OSD_Exec(const char *szScript)
return 1; return 1;
} }
int OSD_ParsingScript(void)
{
return osdexecscript;
}
int OSD_OSDKey(void)
{
return osdkey;
}
char *OSD_GetTextPtr(void)
{
return (&osdtext[0]);
}
char *OSD_GetFmtPtr(void)
{
return (&osdfmt[0]);
}
char *OSD_GetFmt(char *ptr)
{
return (ptr - &osdtext[0] + &osdfmt[0]);
}
int OSD_GetTextMode(void)
{
return osdtextmode;
}
void OSD_SetTextMode(int mode)
{
osdtextmode = (mode != 0);
if (osdtextmode)
{
if (drawosdchar != _internal_drawosdchar)
{
swaplong(&_drawosdchar,&drawosdchar);
swaplong(&_drawosdstr,&drawosdstr);
swaplong(&_drawosdcursor,&drawosdcursor);
swaplong(&_getcolumnwidth,&getcolumnwidth);
swaplong(&_getrowheight,&getrowheight);
}
}
else if (drawosdchar == _internal_drawosdchar)
{
swaplong(&_drawosdchar,&drawosdchar);
swaplong(&_drawosdstr,&drawosdstr);
swaplong(&_drawosdcursor,&drawosdcursor);
swaplong(&_getcolumnwidth,&getcolumnwidth);
swaplong(&_getrowheight,&getrowheight);
}
if (qsetmode == 200)
OSD_ResizeDisplay(xdim, ydim);
}
static int _internal_osdfunc_exec(const osdfuncparm_t *parm) static int _internal_osdfunc_exec(const osdfuncparm_t *parm)
{ {
char fn[BMAX_PATH]; char fn[BMAX_PATH];
@ -445,30 +504,7 @@ static int _internal_osdfunc_vars(const osdfuncparm_t *parm)
if (showval) { OSD_Printf("osdtextmode is %d\n", osdtextmode); return OSDCMD_OK; } if (showval) { OSD_Printf("osdtextmode is %d\n", osdtextmode); return OSDCMD_OK; }
else else
{ {
osdtextmode = atoi(parm->parms[0]); OSD_SetTextMode(atoi(parm->parms[0]) != 0);
if (osdtextmode < 0) osdtextmode = 0;
else if (osdtextmode > 1) osdtextmode = 1;
if (osdtextmode == 1)
{
if (drawosdchar != _internal_drawosdchar)
{
swaplong(&_drawosdchar,&drawosdchar);
swaplong(&_drawosdstr,&drawosdstr);
swaplong(&_drawosdcursor,&drawosdcursor);
swaplong(&_getcolumnwidth,&getcolumnwidth);
swaplong(&_getrowheight,&getrowheight);
}
}
else if (drawosdchar == _internal_drawosdchar)
{
swaplong(&_drawosdchar,&drawosdchar);
swaplong(&_drawosdstr,&drawosdstr);
swaplong(&_drawosdcursor,&drawosdcursor);
swaplong(&_getcolumnwidth,&getcolumnwidth);
swaplong(&_getrowheight,&getrowheight);
}
OSD_ResizeDisplay(xdim, ydim);
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1683,7 +1719,7 @@ int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const o
// //
void OSD_SetVersionString(const char *version, int shade, int pal) void OSD_SetVersionString(const char *version, int shade, int pal)
{ {
if (!osdinited) OSD_Init(); // if (!osdinited) OSD_Init();
Bstrcpy(osdversionstring,version); Bstrcpy(osdversionstring,version);
osdversionstringlen = Bstrlen(osdversionstring); osdversionstringlen = Bstrlen(osdversionstring);
@ -1691,36 +1727,6 @@ void OSD_SetVersionString(const char *version, int shade, int pal)
osdversionstringpal = pal; osdversionstringpal = pal;
} }
int OSD_ParsingScript(void)
{
return osdexecscript;
}
int OSD_OSDKey(void)
{
return osdkey;
}
char *OSD_GetTextPtr(void)
{
return (&osdtext[0]);
}
char *OSD_GetFmtPtr(void)
{
return (&osdfmt[0]);
}
char *OSD_GetFmt(char *ptr)
{
return (ptr - &osdtext[0] + &osdfmt[0]);
}
int OSD_TextMode(void)
{
return osdtextmode;
}
// //
// addnewsymbol() -- Allocates space for a new symbol and attaches it // addnewsymbol() -- Allocates space for a new symbol and attaches it
// appropriately to the lists, sorted. // appropriately to the lists, sorted.

View file

@ -209,6 +209,7 @@ int main(int argc, char *argv[])
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
void setvsync(int sync) void setvsync(int sync)
{ {
if (vsync == sync) return;
vsync = sync; vsync = sync;
resetvideomode(); resetvideomode();
if (setgamemode(fullscreen,xdim,ydim,bpp)) if (setgamemode(fullscreen,xdim,ydim,bpp))
@ -988,7 +989,7 @@ int setvideomode(int x, int y, int c, int fs)
if (sdl_surface) if (sdl_surface)
{ {
SDL_FreeSurface(sdl_surface); SDL_FreeSurface(sdl_surface);
sdl_surface = SDL_SetVideoMode(x, y, 8, SURFACE_FLAGS | ((fs&1)?SDL_FULLSCREEN:0)); sdl_surface = SDL_SetVideoMode(1, 1, 8, SDL_NOFRAME | SURFACE_FLAGS | ((fs&1)?SDL_FULLSCREEN:0));
SDL_FreeSurface(sdl_surface); SDL_FreeSurface(sdl_surface);
} }
ovsync = vsync; ovsync = vsync;

View file

@ -706,6 +706,13 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy);
usehightile = dummy != 0; usehightile = dummy != 0;
#endif #endif
#ifdef _WIN32
dummy = 0;
#else
dummy = 1;
#endif
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",&dummy);
OSD_SetTextMode(dummy);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup); SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode);
@ -935,6 +942,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false);
#endif #endif
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",OSD_GetTextMode(),false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false);

View file

@ -10166,7 +10166,16 @@ void app_main(int argc,const char **argv)
OSD_SetLogFile("eduke32.log"); OSD_SetLogFile("eduke32.log");
OSD_SetParameters(6,0, 0,12, 2,12); OSD_SetParameters(6,0, 0,12, 2,12);
OSD_SetFunctions(
GAME_drawosdchar,
GAME_drawosdstr,
GAME_drawosdcursor,
GAME_getcolumnwidth,
GAME_getrowheight,
GAME_clearbackground,
(int(*)(void))GetTime,
GAME_onshowosd
);
wm_setapptitle(HEAD2); wm_setapptitle(HEAD2);
initprintf("%s (%s)\n",apptitle,datetimestring); initprintf("%s (%s)\n",apptitle,datetimestring);
@ -10519,25 +10528,6 @@ void app_main(int argc,const char **argv)
if (numlumps) initprintf("Using .RTS file '%s'\n",ud.rtsname); if (numlumps) initprintf("Using .RTS file '%s'\n",ud.rtsname);
initprintf("Initializing OSD...\n"); initprintf("Initializing OSD...\n");
OSD_SetFunctions(
#ifdef _WIN32
GAME_drawosdchar,
GAME_drawosdstr,
GAME_drawosdcursor,
GAME_getcolumnwidth,
GAME_getrowheight,
#else
NULL,
NULL,
NULL,
NULL,
NULL,
#endif
GAME_clearbackground,
(int(*)(void))GetTime,
GAME_onshowosd
);
OSD_SetVersionString(HEAD2, 10,0); OSD_SetVersionString(HEAD2, 10,0);
registerosdcommands(); registerosdcommands();

View file

@ -2831,6 +2831,8 @@ cheat_for_port_credits:
"Private messages in DM", "Private messages in DM",
"Show player names in DM", "Show player names in DM",
"-", "-",
"Console text style",
"-",
"Show startup window", "Show startup window",
#ifdef _WIN32 #ifdef _WIN32
"Auto-check for updates", "Auto-check for updates",
@ -2843,9 +2845,6 @@ cheat_for_port_credits:
"-", "-",
"-", "-",
"-", "-",
"-",
"-",
"-",
"Previous page", "Previous page",
NULL NULL
}; };
@ -2933,12 +2932,22 @@ cheat_for_port_credits:
mgametextpal(d,yy, ud.idplayers ? "Yes" : "No", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.idplayers ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break; break;
case 7: case 7:
{
int osdmode = OSD_GetTextMode();
if (x==io) osdmode = !osdmode;
modval(0,1,(int *)&osdmode,1,probey==io);
mgametextpal(d,yy, osdmode? "Fast" : "Nice", MENUHIGHLIGHT(io), 0);
if (OSD_GetTextMode() != osdmode)
OSD_SetTextMode(osdmode);
break;
}
case 8:
if (x==io) ud.config.ForceSetup = 1-ud.config.ForceSetup; if (x==io) ud.config.ForceSetup = 1-ud.config.ForceSetup;
modval(0,1,(int *)&ud.config.ForceSetup,1,probey==io); modval(0,1,(int *)&ud.config.ForceSetup,1,probey==io);
mgametextpal(d,yy, ud.config.ForceSetup ? "Yes" : "No", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.config.ForceSetup ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break; break;
#ifdef _WIN32 #ifdef _WIN32
case 8: case 9:
i = ud.config.CheckForUpdates; i = ud.config.CheckForUpdates;
if (x==io) ud.config.CheckForUpdates = 1-ud.config.CheckForUpdates; if (x==io) ud.config.CheckForUpdates = 1-ud.config.CheckForUpdates;
modval(0,1,(int *)&ud.config.CheckForUpdates,1,probey==io); modval(0,1,(int *)&ud.config.CheckForUpdates,1,probey==io);
@ -2946,9 +2955,9 @@ cheat_for_port_credits:
ud.config.LastUpdateCheck = 0; ud.config.LastUpdateCheck = 0;
mgametextpal(d,yy, ud.config.CheckForUpdates ? "Yes" : "No", MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, ud.config.CheckForUpdates ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break; break;
case 9: case 10:
#else #else
case 8: case 9:
#endif #endif
if (x==io) cmenu(200); if (x==io) cmenu(200);
break; break;