From 6d9579ed07896efd2f53526617e9d8719f11ed21 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 20 Jul 2008 00:39:06 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@872 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/osd.c | 12 ++++----- polymer/build/src/sdlayer.c | 42 +++++++++++++++---------------- polymer/build/src/winlayer.c | 36 +++++++++++++------------- polymer/eduke32/source/config.c | 23 ++++++++++++++--- polymer/eduke32/source/osdfuncs.c | 4 +-- polymer/eduke32/source/premap.c | 10 ++++---- 6 files changed, 72 insertions(+), 55 deletions(-) diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 3cd79f82b..ebbb7aba7 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -680,11 +680,11 @@ static void OSD_HistoryPrev(void) if (osdeditwinstart<0) osdeditwinend-=osdeditwinstart, - osdeditwinstart=0; + osdeditwinstart=0; } else if (osdeditcursor>=osdeditwinend) osdeditwinstart+=(osdeditcursor-osdeditwinend), - osdeditwinend+=(osdeditcursor-osdeditwinend); + osdeditwinend+=(osdeditcursor-osdeditwinend); } static void OSD_HistoryNext(void) @@ -712,11 +712,11 @@ static void OSD_HistoryNext(void) if (osdeditwinstart<0) osdeditwinend-=osdeditwinstart, - osdeditwinstart=0; + osdeditwinstart=0; } else if (osdeditcursor>=osdeditwinend) osdeditwinstart+=(osdeditcursor-osdeditwinend), - osdeditwinend+=(osdeditcursor-osdeditwinend); + osdeditwinend+=(osdeditcursor-osdeditwinend); } int OSD_HandleChar(char ch) @@ -885,7 +885,7 @@ int OSD_HandleChar(char ch) osdhistorytotal++; if (osdexeccount == HISTORYDEPTH) OSD_Printf("Command Buffer Warning: Failed queueing command " - "for execution. Buffer full.\n"); + "for execution. Buffer full.\n"); else osdexeccount++; } @@ -893,7 +893,7 @@ int OSD_HandleChar(char ch) { if (osdexeccount == HISTORYDEPTH) OSD_Printf("Command Buffer Warning: Failed queueing command " - "for execution. Buffer full.\n"); + "for execution. Buffer full.\n"); else osdexeccount++; } diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index b7facd1d0..0eb8db680 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -213,9 +213,9 @@ int main(int argc, char *argv[]) int initsystem(void) { /* -#ifdef DEBUGGINGAIDS + #ifdef DEBUGGINGAIDS const SDL_VideoInfo *vid; -#endif + #endif */ const SDL_version *linked = SDL_Linked_Version(); SDL_version compiled; @@ -276,7 +276,7 @@ int initsystem(void) /* // dump a quick summary of the graphics hardware -#ifdef DEBUGGINGAIDS + #ifdef DEBUGGINGAIDS vid = SDL_GetVideoInfo(); initprintf("Video device information:\n"); initprintf(" Can create hardware surfaces? %s\n", (vid->hw_available)?"Yes":"No"); @@ -289,8 +289,8 @@ int initsystem(void) initprintf(" Accelerated software alpha blits? %s\n", (vid->blit_sw_A)?"Yes":"No"); initprintf(" Accelerated colour fills? %s\n", (vid->blit_fill)?"Yes":"No"); initprintf(" Total video memory: %dKB\n", vid->video_mem); -#endif -*/ + #endif + */ return 0; } @@ -1367,23 +1367,23 @@ int setgamma(void) { int i; unsigned short gammaTable[768]; - float gamma = max(0.1f,min(4.f,vid_gamma)); - float contrast = max(0.1f,min(3.f,vid_contrast)); - float bright = max(-0.8f,min(0.8f,vid_brightness)); - - double invgamma = 1 / gamma; - double norm = pow(255., invgamma - 1); + float gamma = max(0.1f,min(4.f,vid_gamma)); + float contrast = max(0.1f,min(3.f,vid_contrast)); + float bright = max(-0.8f,min(0.8f,vid_brightness)); - // This formula is taken from Doomsday - - for (i = 0; i < 256; i++) - { - double val = i * contrast - (contrast - 1) * 127; - if (gamma != 1) val = pow(val, invgamma) / norm; - val += bright * 128; - - gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (unsigned short)max(0.f,(double)min(0xffff,val*256)); - } + double invgamma = 1 / gamma; + double norm = pow(255., invgamma - 1); + + // This formula is taken from Doomsday + + for (i = 0; i < 256; i++) + { + double val = i * contrast - (contrast - 1) * 127; + if (gamma != 1) val = pow(val, invgamma) / norm; + val += bright * 128; + + gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (unsigned short)max(0.f,(double)min(0xffff,val*256)); + } return SDL_SetGammaRamp(&gammaTable[0],&gammaTable[256],&gammaTable[512]); } diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index ada966e18..3251ce991 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -514,7 +514,7 @@ static void print_os_version(void) initprintf("OS: Windows %s (%lu.%lu.%lu) %s\n", ver, osv.dwMajorVersion, osv.dwMinorVersion, awful_windows_9x?osv.dwBuildNumber&0xffff:osv.dwBuildNumber,osv.szCSDVersion); // if (osv.szCSDVersion[0]) - // initprintf(" - %s\n", osv.szCSDVersion); + // initprintf(" - %s\n", osv.szCSDVersion); } } @@ -2662,26 +2662,26 @@ int setgamma(void) { int i; WORD gammaTable[768]; - float gamma = max(0.1f,min(4.f,vid_gamma)); - float contrast = max(0.1f,min(3.f,vid_contrast)); - float bright = max(-0.8f,min(0.8f,vid_brightness)); - - double invgamma = 1 / gamma; - double norm = pow(255., invgamma - 1); + float gamma = max(0.1f,min(4.f,vid_gamma)); + float contrast = max(0.1f,min(3.f,vid_contrast)); + float bright = max(-0.8f,min(0.8f,vid_brightness)); + + double invgamma = 1 / gamma; + double norm = pow(255., invgamma - 1); if (!hWindow) return -1; - // This formula is taken from Doomsday - - for (i = 0; i < 256; i++) - { - double val = i * contrast - (contrast - 1) * 127; - if (gamma != 1) val = pow(val, invgamma) / norm; - val += bright * 128; - - gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)max(0.f,(double)min(0xffff,val*256)); - } - return setgammaramp(gammaTable); + // This formula is taken from Doomsday + + for (i = 0; i < 256; i++) + { + double val = i * contrast - (contrast - 1) * 127; + if (gamma != 1) val = pow(val, invgamma) / norm; + val += bright * 128; + + gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)max(0.f,(double)min(0xffff,val*256)); + } + return setgammaramp(gammaTable); } static int getgammaramp(WORD gt[3][256]) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 4763eb4e9..5955af8de 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -653,6 +653,16 @@ int32 CONFIG_ReadSetup(void) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size); + tempbuf[0] = 0; + SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidGamma",&tempbuf[0]); + if (tempbuf[0]) vid_gamma = atof(tempbuf); + tempbuf[0] = 0; + SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidBrightness",&tempbuf[0]); + if (tempbuf[0]) vid_brightness = atof(tempbuf); + tempbuf[0] = 0; + SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidContrast",&tempbuf[0]); + if (tempbuf[0]) vid_contrast = atof(tempbuf); + #if defined(POLYMOST) && defined(USE_OPENGL) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; @@ -801,15 +811,15 @@ void CONFIG_WriteBinds(void) // save binds and aliases to disk fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n"); for (i=0;inext) if (symb->func == (void *)OSD_ALIAS) - fprintf(fp,"alias %s \"%s\"\n", symb->name, symb->help); + fprintf(fp,"alias \"%s\" \"%s\"\n", symb->name, symb->help); /* for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++) if (!(cvar[i].type&CVAR_NOSAVE)) @@ -926,6 +936,13 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",ud.config.SoundToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,false,false); + Bsprintf(tempbuf,"%.2f",vid_gamma); + SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidGamma",tempbuf); + Bsprintf(tempbuf,"%.2f",vid_brightness); + SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidBrightness",tempbuf); + Bsprintf(tempbuf,"%.2f",vid_contrast); + SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf); + #ifdef _WIN32 SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false); diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index 89efa7a0b..3f9cf2062 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -32,10 +32,10 @@ void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal) // use the format byte if the text falls within the bounds of the console buffer if (ch > ptr && ch < (ptr + TEXTSIZE)) rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, (*(OSD_GetFmt(ch))&~0x1F)>>4, - *(OSD_GetFmt(ch))&~0xE0, 8|16, 0, 0, xdim-1, ydim-1); + *(OSD_GetFmt(ch))&~0xE0, 8|16, 0, 0, xdim-1, ydim-1); else rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, - pal, 8|16, 0, 0, xdim-1, ydim-1); + pal, 8|16, 0, 0, xdim-1, ydim-1); x += OSDCHAR_WIDTH; } } diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index a1fbba9d6..a0ab45c2e 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1379,11 +1379,11 @@ static void resetpspritevars(char g) if (numplayersprites == MAXPLAYERS) gameexit("\nToo many player sprites (max 16.)"); -/* if (numplayersprites == 0) - { - firstx = g_player[0].ps->posx; - firsty = g_player[0].ps->posy; - }*/ + /* if (numplayersprites == 0) + { + firstx = g_player[0].ps->posx; + firsty = g_player[0].ps->posy; + }*/ g_PlayerSpawnPoints[(unsigned char)numplayersprites].ox = s->x; g_PlayerSpawnPoints[(unsigned char)numplayersprites].oy = s->y;