Setting Fullscreen toggle setting the GameCfg value at each change, not only in change_res(); Do not allow the toggle while playing since ALT-GR+ENTER could be used as game-keys; Reorganized Resolutions menu to automatically calculate aspect ratio for preset resolutions and making custom fields exclusive
This commit is contained in:
parent
6dc900f51d
commit
490726b4ac
|
@ -1,5 +1,9 @@
|
|||
D2X-Rebirth Changelog
|
||||
|
||||
20081019
|
||||
--------
|
||||
arch/sdl/gr.c, arch/ogl/gr.c, main/gamecntl.c, main/menu.c, main/movie.c, main/titles.c: Setting Fullscreen toggle setting the GameCfg value at each change, not only in change_res(); Do not allow the toggle while playing since ALT-GR+ENTER could be used as game-keys; Reorganized Resolutions menu to automatically calculate aspect ratio for preset resolutions and making custom fields exclusive
|
||||
|
||||
20081016
|
||||
--------
|
||||
main/credits.h, main/collide.c, main/newmenu.c, main/menu.c, main/playsave.c, main/playsave.h, main/titles.c, main/wall.c, main/render.c, main/newdemo.c, main/newdemo.h, main/config.c, main/gameseq.c, main/gamerend.c, main/endlevel.c, main/scores.c, main/game.c, main/kconfig.c, main/gamecntl.c, main/credits.c, 2d/ibitblt.c, arch/sdl/mouse.c, arch/win32/hmpfile.c, arch/include/joy.h: Giving credits function ability to use custom creditfile (again); Made laser-offset for laser exclusive so Prox mines won't go tru doors; Preventing cycling tru cockpit modes while dead, but allowing to load a state; Implemented D2X' lighting code to D1X (faster, better, sexier - weeee); Try to hop over some errors regarding walls/doors in levels instead of using -1 indexes for arrays; Made the briefing text ptr a bit more failsafe in case the file is corrupt/non-standard; Made scores use the menu screen even in GAME OVER; Fixed bug in neighbour fields of Weapon Keys table; Added the Weapon Keys stuff to TABLE_CREATION; Fixed bug where D2X did not recall applied resolution in the resolutions menu; Simpler check to create DEMO_DIR; Seperated X/Y sensitivity for mouse and joystick; Flush controls when Automap toggles so keypress won't deactivate it again; Made FrameCount in Demos aligned to the Dropframe condition; Added KEy to ttoggle playback text off; Gracefully exit demo code if demo is corrupt; Removed that new percent counter because many old demos seem to have corrupted last frames; Closing endlevel data file if IFF error so the mission still can be freed; Fixed Cruising for keyboard which was not aligned to FPS correctly; Used mouse delta scaling in kconfig.c instead of mouse.c to not screw up when delta is requested in non-ingame situations - it actually belongs to the controls IMHO; Now support up to 8 joysticks; Changed some leftover malloc's to d_malloc and free to d_free
|
||||
|
|
|
@ -130,7 +130,7 @@ int gr_toggle_fullscreen(void)
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
GameCfg.WindowMode = !ogl_fullscreen;
|
||||
return ogl_fullscreen;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ int gr_toggle_fullscreen(void)
|
|||
gr_remap_mono_fonts();
|
||||
sdl_video_flags^=SDL_FULLSCREEN;
|
||||
SDL_WM_ToggleFullScreen(screen);
|
||||
GameCfg.WindowMode = (sdl_video_flags & SDL_FULLSCREEN)?0:1;
|
||||
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1160,12 +1160,6 @@ int HandleSystemKey(int key)
|
|||
macintosh_quit();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case KEY_ALTED+KEY_ENTER:
|
||||
case KEY_ALTED+KEY_PADENTER:
|
||||
gr_toggle_fullscreen();
|
||||
game_flush_inputs();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
|
114
main/menu.c
114
main/menu.c
|
@ -451,8 +451,6 @@ try_again:
|
|||
|
||||
}
|
||||
|
||||
extern void GameLoop(int, int );
|
||||
|
||||
void options_menuset(int nitems, newmenu_item * items, int *last_key, int citem )
|
||||
{
|
||||
if ( citem==4)
|
||||
|
@ -465,100 +463,106 @@ void options_menuset(int nitems, newmenu_item * items, int *last_key, int citem
|
|||
}
|
||||
|
||||
|
||||
// added on 9/20/98 by Victor Rachels to attempt to add screen res change ingame
|
||||
// Changed on 3/24/99 by Owen Evans to make it work =)
|
||||
void change_res_poll()
|
||||
int gcd(int a, int b)
|
||||
{
|
||||
if (!b)
|
||||
return a;
|
||||
|
||||
return gcd(b, a%b);
|
||||
}
|
||||
|
||||
void change_res_poll() {}
|
||||
|
||||
void change_res()
|
||||
{
|
||||
newmenu_item m[14];
|
||||
u_int32_t modes[14];
|
||||
newmenu_item m[15];
|
||||
u_int32_t modes[15];
|
||||
int i = 0, mc = 0, num_presets = 0;
|
||||
char customres[16], aspect[16];
|
||||
int fullscreenc;
|
||||
u_int32_t screen_mode = 0, aspect_mode = 0;
|
||||
int screen_width = 0;
|
||||
int screen_height = 0;
|
||||
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x200"; m[mc].value = (Game_screen_mode == SM(320,200)); m[mc].group = 0; modes[mc] = SM(320,200); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "640x480"; m[mc].value = (Game_screen_mode == SM(640,480)); m[mc].group = 0; modes[mc] = SM(640,480); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "800x600"; m[mc].value = (Game_screen_mode == SM(800,600)); m[mc].group = 0; modes[mc] = SM(800,600); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1024x768"; m[mc].value = (Game_screen_mode == SM(1024,768)); m[mc].group = 0; modes[mc] = SM(1024,768); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1280x800"; m[mc].value = (Game_screen_mode == SM(1280,800)); m[mc].group = 0; modes[mc] = SM(1280,800); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1280x1024"; m[mc].value = (Game_screen_mode == SM(1280,1024)); m[mc].group = 0; modes[mc] = SM(1280,1024); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1440x990"; m[mc].value = (Game_screen_mode == SM(1440,990)); m[mc].group = 0; modes[mc] = SM(1440,990); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1600x1200"; m[mc].value = (Game_screen_mode == SM(1600,1200)); m[mc].group = 0; modes[mc] = SM(1600,1200); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1920x1200"; m[mc].value = (Game_screen_mode == SM(1920,1200)); m[mc].group = 0; modes[mc] = SM(1920,1200); mc++;
|
||||
|
||||
// the list of pre-defined resolutions
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x200 (16x10)"; m[mc].value = (Game_screen_mode == SM(320,200)); m[mc].group = 0; modes[mc] = SM(320,200); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "640x480 (4x3)"; m[mc].value = (Game_screen_mode == SM(640,480)); m[mc].group = 0; modes[mc] = SM(640,480); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "800x600 (4x3)"; m[mc].value = (Game_screen_mode == SM(800,600)); m[mc].group = 0; modes[mc] = SM(800,600); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1024x768 (4x3)"; m[mc].value = (Game_screen_mode == SM(1024,768)); m[mc].group = 0; modes[mc] = SM(1024,768); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1280x800 (16x10)"; m[mc].value = (Game_screen_mode == SM(1280,800)); m[mc].group = 0; modes[mc] = SM(1280,800); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1280x1024 (5x4)"; m[mc].value = (Game_screen_mode == SM(1280,1024)); m[mc].group = 0; modes[mc] = SM(1280,1024); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1440x960 (3x2)"; m[mc].value = (Game_screen_mode == SM(1440,960)); m[mc].group = 0; modes[mc] = SM(1440,960); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1600x1200 (4x3)"; m[mc].value = (Game_screen_mode == SM(1600,1200)); m[mc].group = 0; modes[mc] = SM(1600,1200); mc++;
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "1920x1200 (16x10)"; m[mc].value = (Game_screen_mode == SM(1920,1200)); m[mc].group = 0; modes[mc] = SM(1920,1200); mc++;
|
||||
num_presets = mc;
|
||||
m[mc].value=0; // make sure we count and reach the right selection
|
||||
|
||||
// now see which field is true and break there
|
||||
m[mc].value=0;
|
||||
for (i = 0; i < mc; i++)
|
||||
if (m[mc].value)
|
||||
break;
|
||||
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "custom:"; m[mc].value = (i == mc); m[mc].group = 0; modes[mc] = 0; mc++;
|
||||
// the field for custom resolution and aspect
|
||||
m[mc].type = NM_TYPE_RADIO; m[mc].text = "use custom values"; m[mc].value = (i == mc); m[mc].group = 0; modes[mc] = 0; mc++;
|
||||
m[mc].type = NM_TYPE_TEXT; m[mc].text = "resolution:"; mc++;
|
||||
sprintf(customres, "%ix%i", SM_W(Game_screen_mode), SM_H(Game_screen_mode));
|
||||
m[mc].type = NM_TYPE_INPUT; m[mc].text = customres; m[mc].text_len = 11; modes[mc] = 0; mc++;
|
||||
|
||||
m[mc].type = NM_TYPE_TEXT; m[mc].text = "aspect:"; mc++;
|
||||
sprintf(aspect, "%ix%i", GameCfg.AspectY, GameCfg.AspectX);
|
||||
m[mc].type = NM_TYPE_INPUT; m[mc].text = aspect; m[mc].text_len = 11; modes[mc] = 0; mc++;
|
||||
|
||||
// fullscreen toggle
|
||||
fullscreenc = mc; m[mc].type = NM_TYPE_CHECK; m[mc].text = "Fullscreen"; m[mc].value = gr_check_fullscreen(); mc++;
|
||||
|
||||
// create the menu
|
||||
i = newmenu_do1(NULL, "Screen Resolution", mc, m, &change_res_poll, 0);
|
||||
|
||||
// menu is done, now do what we need to do
|
||||
|
||||
// now check for fullscreen toggle and apply if necessary
|
||||
if (m[fullscreenc].value != gr_check_fullscreen())
|
||||
{
|
||||
gr_toggle_fullscreen();
|
||||
Game_screen_mode = -1;
|
||||
GameCfg.WindowMode = !m[fullscreenc].value;
|
||||
}
|
||||
|
||||
// check which preset field was selected
|
||||
for (i = 0; (m[i].value == 0) && (i < num_presets); i++);
|
||||
|
||||
if (modes[i]==0)
|
||||
if (modes[i]==0) // no preset selected, use custom values and set screen_mode and aspect
|
||||
{
|
||||
if (!strchr(customres, 'x'))
|
||||
return;
|
||||
screen_mode = SM(atoi(customres), atoi(strchr(customres, 'x')+1));
|
||||
}
|
||||
else
|
||||
|
||||
if (SM_W(screen_mode) < 320 || SM_H(screen_mode) < 200) // oh oh - the resolution is too small. Revert!
|
||||
{
|
||||
screen_mode = modes[i];
|
||||
}
|
||||
|
||||
if (strchr(aspect, 'x'))
|
||||
{
|
||||
aspect_mode = SM(atoi(aspect), atoi(strchr(aspect, 'x')+1));
|
||||
if (GameCfg.AspectY != SM_W(aspect_mode) || GameCfg.AspectX != SM_H(aspect_mode))
|
||||
{
|
||||
GameCfg.AspectY = SM_W(aspect_mode);
|
||||
GameCfg.AspectX = SM_H(aspect_mode);
|
||||
gr_set_mode(Game_screen_mode);
|
||||
}
|
||||
}
|
||||
|
||||
screen_width = SM_W(screen_mode);
|
||||
screen_height = SM_H(screen_mode);
|
||||
|
||||
if (Game_screen_mode == screen_mode)
|
||||
return;
|
||||
|
||||
if (screen_width < 320 || screen_height < 200) {
|
||||
nm_messagebox( TXT_WARNING, 1, "OK", "Entered resolution is too small.\nReverting ..." );
|
||||
return;
|
||||
}
|
||||
|
||||
newmenu_close();
|
||||
|
||||
Game_screen_mode = screen_mode;
|
||||
set_screen_mode(SCREEN_MENU);
|
||||
game_init_render_buffers(screen_width, screen_height, VR_NONE, 0);
|
||||
screen_mode = SM(atoi(customres), atoi(strchr(customres, 'x')+1));
|
||||
if (strchr(aspect, 'x')) // we even have a custom aspect set up
|
||||
{
|
||||
aspect_mode = SM(atoi(aspect), atoi(strchr(aspect, 'x')+1));
|
||||
GameCfg.AspectY = SM_W(aspect_mode)/gcd(SM_W(aspect_mode),SM_H(aspect_mode));
|
||||
GameCfg.AspectX = SM_H(aspect_mode)/gcd(SM_W(aspect_mode),SM_H(aspect_mode));
|
||||
}
|
||||
}
|
||||
else // a preset field is selected - set screen_mode and aspect
|
||||
{
|
||||
screen_mode = modes[i];
|
||||
GameCfg.AspectY = SM_W(screen_mode)/gcd(SM_W(screen_mode),SM_H(screen_mode));
|
||||
GameCfg.AspectX = SM_H(screen_mode)/gcd(SM_W(screen_mode),SM_H(screen_mode));
|
||||
}
|
||||
|
||||
|
||||
// clean up and apply everything
|
||||
newmenu_close();
|
||||
set_screen_mode(SCREEN_MENU);
|
||||
gr_set_mode(Game_screen_mode);
|
||||
if (Game_screen_mode != screen_mode)
|
||||
{
|
||||
Game_screen_mode = screen_mode;
|
||||
game_init_render_buffers(SM_W(screen_mode), SM_H(screen_mode), VR_NONE, 0);
|
||||
}
|
||||
}
|
||||
//End changed section (OE)
|
||||
|
||||
void input_menuset(int nitems, newmenu_item * items, int *last_key, int citem )
|
||||
{
|
||||
|
|
|
@ -323,10 +323,6 @@ int RunMovie(char *filename, int hires_flag, int must_have,int dx,int dy)
|
|||
clear_pause_message();
|
||||
}
|
||||
|
||||
if ((key == KEY_ALTED+KEY_ENTER) ||
|
||||
(key == KEY_ALTED+KEY_PADENTER))
|
||||
gr_toggle_fullscreen();
|
||||
|
||||
frame_num++;
|
||||
}
|
||||
|
||||
|
|
|
@ -1033,10 +1033,6 @@ int show_briefing(int screen_num, char *message)
|
|||
if ((key_check == KEY_SPACEBAR) || (key_check == KEY_ENTER))
|
||||
delay_count = 0;
|
||||
|
||||
if ((key_check == KEY_ALTED+KEY_ENTER) ||
|
||||
(key_check == KEY_ALTED+KEY_PADENTER))
|
||||
gr_toggle_fullscreen();
|
||||
|
||||
if (Briefing_text_x > bsp->text_ulx + bsp->text_width) {
|
||||
Briefing_text_x = bsp->text_ulx;
|
||||
Briefing_text_y += bsp->text_uly;
|
||||
|
|
Loading…
Reference in a new issue