Removed SDL Gammaramp code (obsolete); Improvements on Demo code

This commit is contained in:
zicodxx 2008-01-13 13:27:58 +00:00
parent 7719e5afe0
commit 7c38557284
9 changed files with 17 additions and 58 deletions

View file

@ -5,6 +5,7 @@ D1X-Rebirth Changelog
main/network.c: fix typo causing compiler error on bigendian computers
2d/font.c, 2d/pcx.c, 3d/interp.c, cfile/cfile.c, include/cfile.h, include/pstypes.h, main/bm.c, main/cntrlcen.c, main/cntrlcen.h, main/custom.c, main/custom.h, main/effects.c, main/effects.h, main/fuelcen.c, main/fuelcen.h, main/gamemine.c, main/gamesave.c, main/loadrl2.c, main/newdemo.c, main/piggy.c, main/piggy.h, main/playsave.c, main/polyobj.c, main/powerup.c, main/powerup.h, main/robot.c, main/robot.h, main/scores.c, main/switch.c, main/switch.h, main/vclip.c, main/vclip.h, main/wall.c, main/wall.h, main/weapon.c, main/weapon.h: complete bigendian support, without touching network code
2d/font.c: make special characters print for platforms where a char is signed by default
arch/ogl/gr.c, arch/ogl/include/ogl_init.h, arch/ogl/sdlgl.c, include/args.h, main/args.c, main/inferno.c, main/menu.c, main/newdemo.c: Removed SDL Gammaramp code (obsolete); Improvements on Demo code
20080110
--------

View file

@ -148,7 +148,7 @@ void ogl_get_verinfo(void){
#endif
#ifndef NDEBUG
printf("gl_intensity4:%i gl_luminance4_alpha4:%i gl_rgba2:%i gl_readpixels:%i gl_gettexlevelparam:%i gl_setgammaramp:%i\n",GameArg.DbgGlIntensity4Ok,GameArg.DbgGlLuminance4Alpha4Ok,GameArg.DbgGlRGBA2Ok,GameArg.DbgGlReadPixelsOk,GameArg.DbgGlGetTexLevelParamOk,GameArg.DbgGlSetGammaRampOk);
printf("gl_intensity4:%i gl_luminance4_alpha4:%i gl_rgba2:%i gl_readpixels:%i gl_gettexlevelparam:%i\n",GameArg.DbgGlIntensity4Ok,GameArg.DbgGlLuminance4Alpha4Ok,GameArg.DbgGlRGBA2Ok,GameArg.DbgGlReadPixelsOk,GameArg.DbgGlGetTexLevelParamOk);
#endif
}
@ -296,6 +296,8 @@ int gr_init(int mode)
void gr_close()
{
ogl_brightness_r = ogl_brightness_g = ogl_brightness_b = 0;
ogl_close();//platform specific code
if (grd_curscreen){
if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
@ -406,13 +408,7 @@ void gr_palette_step_up( int r, int g, int b )
ogl_brightness_g = max(g + gr_palette_gamma, 0);
ogl_brightness_b = max(b + gr_palette_gamma, 0);
if (GameArg.DbgGlSetGammaRampOk &&
(old_b_r != ogl_brightness_r ||
old_b_g != ogl_brightness_g ||
old_b_b != ogl_brightness_b))
ogl_brightness_ok = !ogl_setbrightness_internal();
if (!GameArg.DbgGlSetGammaRampOk || !ogl_brightness_ok)
if (!ogl_brightness_ok)
{
last_r = ogl_brightness_r / 63.0;
last_g = ogl_brightness_g / 63.0;

View file

@ -64,7 +64,6 @@ extern int ogl_fullscreen;
extern int ogl_brightness_ok;
extern int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
int ogl_setbrightness_internal(void);
void ogl_do_fullscreen_internal(void);

View file

@ -12,26 +12,6 @@ void ogl_do_fullscreen_internal(void){
ogl_init_window(curx,cury);
}
static Uint16 gammaramp[512];
static void init_gammaramp(void)
{
int i;
for (i = 0; i < 256; ++i)
gammaramp[i] = i * 256;
for (i = 256; i < 512; ++i)
gammaramp[i] = 0xffff;
}
int ogl_setbrightness_internal(void)
{
return SDL_SetGammaRamp(gammaramp + ogl_brightness_r * 4,
gammaramp + ogl_brightness_g * 4,
gammaramp + ogl_brightness_b * 4
);
}
void ogl_swap_buffers_internal(void){
SDL_GL_SwapBuffers();
}
@ -75,8 +55,6 @@ void ogl_init(void){
SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
init_gammaramp();
}
void ogl_close(void){
ogl_destroy_window();

View file

@ -97,7 +97,6 @@ typedef struct Arg
int DbgGlRGBA2Ok;
int DbgGlReadPixelsOk;
int DbgGlGetTexLevelParamOk;
int DbgGlSetGammaRampOk;
#else
int DbgSdlHWSurface;
#endif

View file

@ -246,7 +246,6 @@ void ReadCmdArgs(void)
GameArg.DbgGlRGBA2Ok = get_int_arg("-gl_rgba2_ok", 1);
GameArg.DbgGlReadPixelsOk = get_int_arg("-gl_readpixels_ok", 1);
GameArg.DbgGlGetTexLevelParamOk = get_int_arg("-gl_gettexlevelparam_ok", 1);
GameArg.DbgGlSetGammaRampOk = get_int_arg("-gl_setgammaramp_ok", 0);
#else
GameArg.DbgSdlHWSurface = FindArg("-hwsurface");
#endif

View file

@ -210,7 +210,6 @@ void show_commandline_help()
printf( " -gl_rgba2_ok <n> %s\n", "Override DbgGlRGBA2Ok - Default: 1");
printf( " -gl_readpixels_ok <n> %s\n", "Override DbgGlReadPixelsOk - Default: 1");
printf( " -gl_gettexlevelparam_ok <n> %s\n", "Override DbgGlGetTexLevelParamOk - Default: 1");
printf( " -gl_setgammaramp_ok <n> %s\n", "Override DbgGlSetGammaRampOk - Default: 0");
#else
printf( " -hwsurface %s\n", "Use HW Surface");
#endif // OGL

View file

@ -132,19 +132,10 @@ void do_ip_manual_join_menu();
#define ADD_ITEM(t,value,key) do { m[num_options].type=NM_TYPE_MENU; m[num_options].text=t; menu_choice[num_options]=value;num_options++; } while (0)
extern int last_joy_time; //last time the joystick was used
#ifndef NDEBUG
/* extern int speedtest_on; adb: not found...*/
#define speedtest_on 0
#else
#define speedtest_on 0
#endif
extern void newmenu_close();
ubyte do_auto_demo = 1; // Flag used to enable auto demo starting in main menu.
int Player_default_difficulty; // Last difficulty level chosen by the player
int Auto_leveling_on = 0;
int Menu_draw_copyright = 0;
void autodemo_menu_check(int nitems, newmenu_item * items, int *last_key, int citem )
{
@ -157,15 +148,16 @@ void autodemo_menu_check(int nitems, newmenu_item * items, int *last_key, int ci
// Don't allow them to hit ESC in the main menu.
if (*last_key==KEY_ESC) *last_key = 0;
if ( do_auto_demo ) {
curtime = timer_get_approx_seconds();
if ( (((keyd_time_when_last_pressed+i2f(45)) < curtime || curtime+i2f(25) < keyd_time_when_last_pressed) && (!speedtest_on)) || GameArg.SysAutoDemo ) {
keyd_time_when_last_pressed = curtime; // Reset timer so that disk won't thrash if no demos.
newdemo_start_playback(NULL); // Randomly pick a file
if (Newdemo_state == ND_STATE_PLAYBACK) {
Function_mode = FMODE_GAME;
*last_key = -2;
}
curtime = timer_get_approx_seconds();
if ( keyd_time_when_last_pressed+i2f(45) < curtime || GameArg.SysAutoDemo )
{
if (curtime < 0) curtime = 0;
keyd_time_when_last_pressed = curtime; // Reset timer so that disk won't thrash if no demos.
newdemo_start_playback(NULL); // Randomly pick a file
if (Newdemo_state == ND_STATE_PLAYBACK)
{
Function_mode = FMODE_GAME;
*last_key = -2;
}
}
}
@ -249,7 +241,6 @@ int DoMenu()
do {
keyd_time_when_last_pressed = timer_get_fixed_seconds(); // .. 20 seconds from now!
if (main_menu_choice < 0 ) main_menu_choice = 0;
Menu_draw_copyright = 1;
main_menu_choice = newmenu_do2(NULL, NULL, num_options, m, autodemo_menu_check, main_menu_choice, Menu_pcx_name);
if ( main_menu_choice > -1 ) do_option(menu_choice[main_menu_choice]);
create_main_menu(m, menu_choice, &num_options); // may have to change, eg, maybe selected pilot and no save games.

View file

@ -174,7 +174,6 @@ fix nd_playback_total;
fix nd_recorded_total;
fix nd_recorded_time;
sbyte playback_style;
sbyte First_time_playback=1;
fix JasonPlaybackTotal=0;
extern int digi_link_sound_to_object3( int org_soundnum, short objnum, int forever, fix max_volume, fix max_distance, int loop_start, int loop_end );
@ -2983,7 +2982,6 @@ void newdemo_start_playback(char * filename)
#ifdef NETWORK
change_playernum_to(0); // force playernum to 0
#endif
First_time_playback=1;
JasonPlaybackTotal=0;
strncpy(nd_save_callsign, Players[Player_num].callsign, CALLSIGN_LEN);
Viewer = ConsoleObject = &Objects[0]; // play properly as if console player
@ -3101,11 +3099,11 @@ void DoJasonInterpolate (fix recorded_time)
JasonPlaybackTotal+=FrameTime;
if (!First_time_playback)
if (recorded_time > 0)
{
// get the difference between the recorded time and the playback time
the_delay=(recorded_time - FrameTime);
if (!the_delay >= f0_0)
if (the_delay < f0_0)
{
while (JasonPlaybackTotal > nd_recorded_total)
if (newdemo_read_frame_information() == -1)
@ -3115,5 +3113,4 @@ void DoJasonInterpolate (fix recorded_time)
}
}
}
First_time_playback=0;
}