diff --git a/polymer/build/include/baselayer.h b/polymer/build/include/baselayer.h index 6d1b9ad3c..eb1ab7d0b 100644 --- a/polymer/build/include/baselayer.h +++ b/polymer/build/include/baselayer.h @@ -80,7 +80,7 @@ extern int *joyaxis, *joyhat, joyb; extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats; extern int joyaxespresent; - +extern int qsetmode; int initsystem(void); void uninitsystem(void); diff --git a/polymer/build/include/osd.h b/polymer/build/include/osd.h index 9132d8d6b..4ee35ba3b 100644 --- a/polymer/build/include/osd.h +++ b/polymer/build/include/osd.h @@ -34,7 +34,8 @@ const char *stripcolorcodes(const char *t); int OSD_ParsingScript(void); int OSD_OSDKey(void); -int OSD_TextMode(void); +int OSD_GetTextMode(void); +void OSD_SetTextMode(int mode); int OSD_Exec(const char *szScript); diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 9a552751f..a56ab6852 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -85,8 +85,11 @@ static int osdexeccount=0; // number of lines from the head of the history buf static int logcutoff=120000; static int linecnt; static int osdexecscript=0; +#ifdef _WIN32 static int osdtextmode=0; - +#else +static int osdtextmode=1; +#endif // presentation parameters static int osdpromptshade=0; static int osdpromptpal=0; @@ -163,6 +166,62 @@ int OSD_Exec(const char *szScript) 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) { 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; } else { - osdtextmode = atoi(parm->parms[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_SetTextMode(atoi(parm->parms[0]) != 0); OSD_Printf("%s\n",parm->raw); 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) { - if (!osdinited) OSD_Init(); +// if (!osdinited) OSD_Init(); Bstrcpy(osdversionstring,version); osdversionstringlen = Bstrlen(osdversionstring); @@ -1691,36 +1727,6 @@ void OSD_SetVersionString(const char *version, int shade, int 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 // appropriately to the lists, sorted. diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 9f7105773..986c27c98 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -209,6 +209,7 @@ int main(int argc, char *argv[]) #if defined(USE_OPENGL) && defined(POLYMOST) void setvsync(int sync) { + if (vsync == sync) return; vsync = sync; resetvideomode(); if (setgamemode(fullscreen,xdim,ydim,bpp)) @@ -988,7 +989,7 @@ int setvideomode(int x, int y, int c, int fs) if (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); } ovsync = vsync; diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index d05346916..e1f4515d8 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -706,6 +706,13 @@ int32 CONFIG_ReadSetup(void) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy); usehightile = dummy != 0; #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, "Setup", "ForceSetup",&ud.config.ForceSetup); 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", "UseModels",usemodels,false,false); #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", "FXVolume",ud.config.FXVolume,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 654d727b8..7b355cf02 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10166,7 +10166,16 @@ void app_main(int argc,const char **argv) OSD_SetLogFile("eduke32.log"); 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); 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); 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); registerosdcommands(); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 582574f4a..ccaff3f5a 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2831,6 +2831,8 @@ cheat_for_port_credits: "Private messages in DM", "Show player names in DM", "-", + "Console text style", + "-", "Show startup window", #ifdef _WIN32 "Auto-check for updates", @@ -2843,9 +2845,6 @@ cheat_for_port_credits: "-", "-", "-", - "-", - "-", - "-", "Previous page", NULL }; @@ -2933,12 +2932,22 @@ cheat_for_port_credits: mgametextpal(d,yy, ud.idplayers ? "Yes" : "No", MENUHIGHLIGHT(io), 0); break; 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; modval(0,1,(int *)&ud.config.ForceSetup,1,probey==io); mgametextpal(d,yy, ud.config.ForceSetup ? "Yes" : "No", MENUHIGHLIGHT(io), 0); break; #ifdef _WIN32 - case 8: + case 9: i = ud.config.CheckForUpdates; if (x==io) ud.config.CheckForUpdates = 1-ud.config.CheckForUpdates; modval(0,1,(int *)&ud.config.CheckForUpdates,1,probey==io); @@ -2946,9 +2955,9 @@ cheat_for_port_credits: ud.config.LastUpdateCheck = 0; mgametextpal(d,yy, ud.config.CheckForUpdates ? "Yes" : "No", MENUHIGHLIGHT(io), 0); break; - case 9: + case 10: #else - case 8: + case 9: #endif if (x==io) cmenu(200); break;