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

This commit is contained in:
terminx 2008-07-20 00:39:06 +00:00
parent e8c0abf7da
commit 6d9579ed07
6 changed files with 72 additions and 55 deletions

View file

@ -680,11 +680,11 @@ static void OSD_HistoryPrev(void)
if (osdeditwinstart<0) if (osdeditwinstart<0)
osdeditwinend-=osdeditwinstart, osdeditwinend-=osdeditwinstart,
osdeditwinstart=0; osdeditwinstart=0;
} }
else if (osdeditcursor>=osdeditwinend) else if (osdeditcursor>=osdeditwinend)
osdeditwinstart+=(osdeditcursor-osdeditwinend), osdeditwinstart+=(osdeditcursor-osdeditwinend),
osdeditwinend+=(osdeditcursor-osdeditwinend); osdeditwinend+=(osdeditcursor-osdeditwinend);
} }
static void OSD_HistoryNext(void) static void OSD_HistoryNext(void)
@ -712,11 +712,11 @@ static void OSD_HistoryNext(void)
if (osdeditwinstart<0) if (osdeditwinstart<0)
osdeditwinend-=osdeditwinstart, osdeditwinend-=osdeditwinstart,
osdeditwinstart=0; osdeditwinstart=0;
} }
else if (osdeditcursor>=osdeditwinend) else if (osdeditcursor>=osdeditwinend)
osdeditwinstart+=(osdeditcursor-osdeditwinend), osdeditwinstart+=(osdeditcursor-osdeditwinend),
osdeditwinend+=(osdeditcursor-osdeditwinend); osdeditwinend+=(osdeditcursor-osdeditwinend);
} }
int OSD_HandleChar(char ch) int OSD_HandleChar(char ch)
@ -885,7 +885,7 @@ int OSD_HandleChar(char ch)
osdhistorytotal++; osdhistorytotal++;
if (osdexeccount == HISTORYDEPTH) if (osdexeccount == HISTORYDEPTH)
OSD_Printf("Command Buffer Warning: Failed queueing command " OSD_Printf("Command Buffer Warning: Failed queueing command "
"for execution. Buffer full.\n"); "for execution. Buffer full.\n");
else else
osdexeccount++; osdexeccount++;
} }
@ -893,7 +893,7 @@ int OSD_HandleChar(char ch)
{ {
if (osdexeccount == HISTORYDEPTH) if (osdexeccount == HISTORYDEPTH)
OSD_Printf("Command Buffer Warning: Failed queueing command " OSD_Printf("Command Buffer Warning: Failed queueing command "
"for execution. Buffer full.\n"); "for execution. Buffer full.\n");
else else
osdexeccount++; osdexeccount++;
} }

View file

@ -213,9 +213,9 @@ int main(int argc, char *argv[])
int initsystem(void) int initsystem(void)
{ {
/* /*
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
const SDL_VideoInfo *vid; const SDL_VideoInfo *vid;
#endif #endif
*/ */
const SDL_version *linked = SDL_Linked_Version(); const SDL_version *linked = SDL_Linked_Version();
SDL_version compiled; SDL_version compiled;
@ -276,7 +276,7 @@ int initsystem(void)
/* /*
// dump a quick summary of the graphics hardware // dump a quick summary of the graphics hardware
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
vid = SDL_GetVideoInfo(); vid = SDL_GetVideoInfo();
initprintf("Video device information:\n"); initprintf("Video device information:\n");
initprintf(" Can create hardware surfaces? %s\n", (vid->hw_available)?"Yes":"No"); 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 software alpha blits? %s\n", (vid->blit_sw_A)?"Yes":"No");
initprintf(" Accelerated colour fills? %s\n", (vid->blit_fill)?"Yes":"No"); initprintf(" Accelerated colour fills? %s\n", (vid->blit_fill)?"Yes":"No");
initprintf(" Total video memory: %dKB\n", vid->video_mem); initprintf(" Total video memory: %dKB\n", vid->video_mem);
#endif #endif
*/ */
return 0; return 0;
} }
@ -1367,23 +1367,23 @@ int setgamma(void)
{ {
int i; int i;
unsigned short gammaTable[768]; unsigned short gammaTable[768];
float gamma = max(0.1f,min(4.f,vid_gamma)); float gamma = max(0.1f,min(4.f,vid_gamma));
float contrast = max(0.1f,min(3.f,vid_contrast)); float contrast = max(0.1f,min(3.f,vid_contrast));
float bright = max(-0.8f,min(0.8f,vid_brightness)); float bright = max(-0.8f,min(0.8f,vid_brightness));
double invgamma = 1 / gamma;
double norm = pow(255., invgamma - 1);
// This formula is taken from Doomsday double invgamma = 1 / gamma;
double norm = pow(255., invgamma - 1);
for (i = 0; i < 256; i++)
{ // This formula is taken from Doomsday
double val = i * contrast - (contrast - 1) * 127;
if (gamma != 1) val = pow(val, invgamma) / norm; for (i = 0; i < 256; i++)
val += bright * 128; {
double val = i * contrast - (contrast - 1) * 127;
gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (unsigned short)max(0.f,(double)min(0xffff,val*256)); 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]); return SDL_SetGammaRamp(&gammaTable[0],&gammaTable[256],&gammaTable[512]);
} }

View file

@ -514,7 +514,7 @@ static void print_os_version(void)
initprintf("OS: Windows %s (%lu.%lu.%lu) %s\n", ver, osv.dwMajorVersion, osv.dwMinorVersion, initprintf("OS: Windows %s (%lu.%lu.%lu) %s\n", ver, osv.dwMajorVersion, osv.dwMinorVersion,
awful_windows_9x?osv.dwBuildNumber&0xffff:osv.dwBuildNumber,osv.szCSDVersion); awful_windows_9x?osv.dwBuildNumber&0xffff:osv.dwBuildNumber,osv.szCSDVersion);
// if (osv.szCSDVersion[0]) // if (osv.szCSDVersion[0])
// initprintf(" - %s\n", osv.szCSDVersion); // initprintf(" - %s\n", osv.szCSDVersion);
} }
} }
@ -2662,26 +2662,26 @@ int setgamma(void)
{ {
int i; int i;
WORD gammaTable[768]; WORD gammaTable[768];
float gamma = max(0.1f,min(4.f,vid_gamma)); float gamma = max(0.1f,min(4.f,vid_gamma));
float contrast = max(0.1f,min(3.f,vid_contrast)); float contrast = max(0.1f,min(3.f,vid_contrast));
float bright = max(-0.8f,min(0.8f,vid_brightness)); float bright = max(-0.8f,min(0.8f,vid_brightness));
double invgamma = 1 / gamma; double invgamma = 1 / gamma;
double norm = pow(255., invgamma - 1); double norm = pow(255., invgamma - 1);
if (!hWindow) return -1; if (!hWindow) return -1;
// This formula is taken from Doomsday // This formula is taken from Doomsday
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
double val = i * contrast - (contrast - 1) * 127; double val = i * contrast - (contrast - 1) * 127;
if (gamma != 1) val = pow(val, invgamma) / norm; if (gamma != 1) val = pow(val, invgamma) / norm;
val += bright * 128; val += bright * 128;
gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)max(0.f,(double)min(0xffff,val*256)); gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)max(0.f,(double)min(0xffff,val*256));
} }
return setgammaramp(gammaTable); return setgammaramp(gammaTable);
} }
static int getgammaramp(WORD gt[3][256]) static int getgammaramp(WORD gt[3][256])

View file

@ -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", "ScreenGamma",&ud.brightness);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size); 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) #if defined(POLYMOST) && defined(USE_OPENGL)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; 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"); fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n");
for (i=0;i<MAXBOUNDKEYS;i++) for (i=0;i<MAXBOUNDKEYS;i++)
if (boundkeys[i].cmd[0] && boundkeys[i].key) if (boundkeys[i].cmd[0] && boundkeys[i].key)
fprintf(fp,"bind %s%s \"%s\"\n",boundkeys[i].key,boundkeys[i].repeat?"":" norepeat",boundkeys[i].cmd); fprintf(fp,"bind \"%s\"%s \"%s\"\n",boundkeys[i].key,boundkeys[i].repeat?"":" norepeat",boundkeys[i].cmd);
for (i=0;i<MAXMOUSEBUTTONS;i++) for (i=0;i<MAXMOUSEBUTTONS;i++)
if (mousebind[i].cmd[0]) if (mousebind[i].cmd[0])
fprintf(fp,"bind %s%s \"%s\"\n",mousebind[i].key,mousebind[i].repeat?"":" norepeat",mousebind[i].cmd); fprintf(fp,"bind \"%s\"%s \"%s\"\n",mousebind[i].key,mousebind[i].repeat?"":" norepeat",mousebind[i].cmd);
for (symb=symbols; symb!=NULL; symb=symb->next) for (symb=symbols; symb!=NULL; symb=symb->next)
if (symb->func == (void *)OSD_ALIAS) 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++) /* for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++)
if (!(cvar[i].type&CVAR_NOSAVE)) 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", "SoundToggle",ud.config.SoundToggle,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,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 #ifdef _WIN32
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false);
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false); SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false);

View file

@ -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 // use the format byte if the text falls within the bounds of the console buffer
if (ch > ptr && ch < (ptr + TEXTSIZE)) if (ch > ptr && ch < (ptr + TEXTSIZE))
rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, (*(OSD_GetFmt(ch))&~0x1F)>>4, 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 else
rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, 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; x += OSDCHAR_WIDTH;
} }
} }

View file

@ -1379,11 +1379,11 @@ static void resetpspritevars(char g)
if (numplayersprites == MAXPLAYERS) if (numplayersprites == MAXPLAYERS)
gameexit("\nToo many player sprites (max 16.)"); gameexit("\nToo many player sprites (max 16.)");
/* if (numplayersprites == 0) /* if (numplayersprites == 0)
{ {
firstx = g_player[0].ps->posx; firstx = g_player[0].ps->posx;
firsty = g_player[0].ps->posy; firsty = g_player[0].ps->posy;
}*/ }*/
g_PlayerSpawnPoints[(unsigned char)numplayersprites].ox = s->x; g_PlayerSpawnPoints[(unsigned char)numplayersprites].ox = s->x;
g_PlayerSpawnPoints[(unsigned char)numplayersprites].oy = s->y; g_PlayerSpawnPoints[(unsigned char)numplayersprites].oy = s->y;