// //////////////////////////////////////////////////////////////////////////// // Video Options static bool startVideoOptionsMenu(void) { // Generate the resolution string snprintf(resolution, WIDG_MAXSTR, "%d x %d", war_GetWidth(), war_GetHeight()); // Generate texture size string snprintf(textureSize, WIDG_MAXSTR, "%d", getTextureSize()); addBackdrop(); addTopForm(); addBottomForm(); // Add a note about changes taking effect on restart for certain options addTextHint(FRONTEND_TAKESEFFECT, FRONTEND_POS1X + 48, FRONTEND_POS1Y + 24, _("* Takes effect on game restart")); // Fullscreen/windowed addTextButton(FRONTEND_WINDOWMODE, FRONTEND_POS2X-35, FRONTEND_POS2Y, _("Graphics Mode*"), 0); if (war_getFullscreen()) { addTextButton(FRONTEND_WINDOWMODE_R, FRONTEND_POS2M-55, FRONTEND_POS2Y, _("Fullscreen"), 0); } else { addTextButton(FRONTEND_WINDOWMODE_R, FRONTEND_POS2M-55, FRONTEND_POS2Y, _("Windowed"), 0); } // Resolution addTextButton(FRONTEND_RESOLUTION, FRONTEND_POS3X-35, FRONTEND_POS3Y, _("Resolution*"), WBUT_SECONDARY); addTextButton(FRONTEND_RESOLUTION_R, FRONTEND_POS3M-55, FRONTEND_POS3Y, resolution, WBUT_SECONDARY); widgSetString(psWScreen, FRONTEND_RESOLUTION_R, resolution); // Texture size addTextButton(FRONTEND_TEXTURESZ, FRONTEND_POS4X-35, FRONTEND_POS4Y, _("Texture size"), 0); addTextButton(FRONTEND_TEXTURESZ_R, FRONTEND_POS4M-55, FRONTEND_POS4Y, textureSize, 0); // Vsync addTextButton(FRONTEND_VSYNC, FRONTEND_POS5X-35, FRONTEND_POS5Y, _("Vertical sync*"), 0); if (war_GetVsync()) { addTextButton(FRONTEND_VSYNC_R, FRONTEND_POS5M-55, FRONTEND_POS5Y, _("On"), 0); } else { addTextButton(FRONTEND_VSYNC_R, FRONTEND_POS5M-55, FRONTEND_POS5Y, _("Off"), 0); } // Add some text down the side of the form addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("VIDEO OPTIONS")); // Quit/return addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_QUIT, 10, 10, 30, 29, P_("menu", "Return"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI); return true; }
// //////////////////////////////////////////////////////////////////////////// // process clicks made by user. void intProcessInGameOptions(UDWORD id) { switch(id) { // NORMAL KEYS case INTINGAMEOP_QUIT: //quit was pressed addQuitOptions(); break; case INTINGAMEOP_POPUP_QUIT: case INTINGAMEOP_QUIT_CONFIRM: //quit was confirmed. intCloseInGameOptions(false, false); break; case INTINGAMEOP_OPTIONS: //game options was pressed addSlideOptions(); break; case INTINGAMEOP_RESUME: //resume was pressed. intCloseInGameOptions(false, true); break; // case INTINGAMEOP_REPLAY: // intCloseInGameOptions(true, false); // if(0!=strcmp(getLevelName(),"CAM_1A")) // { // loopMissionState = LMS_LOADGAME; // strcpy(saveGameName, "replay/replay.gam"); // addConsoleMessage(_("GAME SAVED!"), LEFT_JUSTIFY, SYSTEM_MESSAGE); // } // break; case INTINGAMEOP_LOAD: intCloseInGameOptions(true, false); addLoadSave(LOAD_INGAME, _("Load Saved Game")); // change mode when loadsave returns break; case INTINGAMEOP_SAVE: intCloseInGameOptions(true, false); addLoadSave(SAVE_INGAME, _("Save Game")); break; // GAME OPTIONS KEYS case INTINGAMEOP_FXVOL: case INTINGAMEOP_3DFXVOL: case INTINGAMEOP_CDVOL: break; case INTINGAMEOP_FXVOL_S: sound_SetUIVolume((float)widgGetSliderPos(psWScreen, INTINGAMEOP_FXVOL_S) / 100.0); break; case INTINGAMEOP_3DFXVOL_S: sound_SetEffectsVolume((float)widgGetSliderPos(psWScreen, INTINGAMEOP_3DFXVOL_S) / 100.0); break; case INTINGAMEOP_CDVOL_S: sound_SetMusicVolume((float)widgGetSliderPos(psWScreen, INTINGAMEOP_CDVOL_S) / 100.0); break; case INTINGAMEOP_TUI_TARGET_ORIGIN_SW: tuiTargetOrigin = !tuiTargetOrigin; if(tuiTargetOrigin) { widgSetString(psWScreen, INTINGAMEOP_TUI_TARGET_ORIGIN_SW, _("Tactical UI (Target Origin Icon): Show")); } else { widgSetString(psWScreen, INTINGAMEOP_TUI_TARGET_ORIGIN_SW, _("Tactical UI (Target Origin Icon): Hide")); } break; default: break; } }
bool runVideoOptionsMenu(void) { //SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); HACK modes[] = {{1920, 1200}, {1920, 1080}, {1680, 1050}, {1600, 1200}, {1440, 900}, {1280, 1024}, {1280, 960}, {1280, 800}, {1280, 720}, {1024, 768}, {800, 600}, {720, 576}, {720, 480}, {640, 480}, {0, 0}}; UDWORD id = widgRunScreen(psWScreen); int level; switch (id) { case FRONTEND_WINDOWMODE: case FRONTEND_WINDOWMODE_R: if (war_getFullscreen()) { war_setFullscreen(false); widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Windowed")); } else { war_setFullscreen(true); widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Fullscreen")); } break; case FRONTEND_FSAA: case FRONTEND_FSAA_R: switch (level = war_getFSAA()) { case FSAA_OFF: war_setFSAA((FSAA_LEVEL)(level + 1)); widgSetString(psWScreen, FRONTEND_FSAA_R, "2X"); break; case FSAA_2X: war_setFSAA((FSAA_LEVEL)(level + 1)); widgSetString(psWScreen, FRONTEND_FSAA_R, "4X"); break; case FSAA_4X: war_setFSAA((FSAA_LEVEL)(level + 1)); widgSetString(psWScreen, FRONTEND_FSAA_R, "8X"); break; case FSAA_8X: war_setFSAA((FSAA_LEVEL)(level + 1)); widgSetString(psWScreen, FRONTEND_FSAA_R, _("Off")); break; default: // we can't check what the max level the card is capable of, without first creating that level, and testing. ASSERT(!"invalid FSAA level ?", "Invalid FSAA level: %u", (unsigned int)level); addTextButton(FRONTEND_FSAA_R, FRONTEND_POS5M-55, FRONTEND_POS6Y, _("Unsupported"), 0); break; } break; case FRONTEND_RESOLUTION: case FRONTEND_RESOLUTION_R: { int current, count, oldcurrent; // Get the current mode offset for (count = 0, current = 0; modes[count]; count++) { if (war_GetWidth() == modes[count]->w && war_GetHeight() == modes[count]->h) { current = count; } } // Increment and clip if required // Hide resolutions lower than Warzone can support oldcurrent = current; do { if (!mouseReleased(MOUSE_RMB)) { if (--current < 0) current = count - 1; } else { if (++current == count) current = 0; } } while ((modes[current]->w < 640 || modes[current]->h < 480) && current != oldcurrent); // Set the new width and height (takes effect on restart) war_SetWidth(modes[current]->w); war_SetHeight(modes[current]->h); // Generate the textual representation of the new width and height snprintf(resolution, WIDG_MAXSTR, "%d x %d", modes[current]->w, modes[current]->h); // Update the widget widgSetString(psWScreen, FRONTEND_RESOLUTION_R, resolution); break; } case FRONTEND_TRAP: case FRONTEND_TRAP_R: if (war_GetTrapCursor()) { war_SetTrapCursor(false); widgSetString(psWScreen, FRONTEND_TRAP_R, _("Off")); } else { war_SetTrapCursor(true); widgSetString(psWScreen, FRONTEND_TRAP_R, _("On")); } break; case FRONTEND_TEXTURESZ: case FRONTEND_TEXTURESZ_R: { int newTexSize = getTextureSize() * 2; // Clip such that 128 <= size <= 2048 if (newTexSize > 2048) { newTexSize = 128; } // Set the new size setTextureSize(newTexSize); // Generate the string representation of the new size snprintf(textureSize, WIDG_MAXSTR, "%d", newTexSize); // Update the widget widgSetString(psWScreen, FRONTEND_TEXTURESZ_R, textureSize); break; } case FRONTEND_VSYNC: case FRONTEND_VSYNC_R: { if (war_GetVsync()) { war_SetVsync(false); widgSetString(psWScreen, FRONTEND_VSYNC_R, _("Off")); } else { war_SetVsync(true); widgSetString(psWScreen, FRONTEND_VSYNC_R, _("On")); } break; } case FRONTEND_QUIT: changeTitleMode(OPTIONS); break; default: break; } if (CancelPressed()) { changeTitleMode(OPTIONS); } widgDisplayScreen(psWScreen); return true; }
bool runGraphicsOptionsMenu(void) { UDWORD id; int mode = 0; id = widgRunScreen(psWScreen); // Run the current set of widgets switch(id) { case FRONTEND_SSHAKE: case FRONTEND_SSHAKE_R: if( getShakeStatus() ) { setShakeStatus(false); widgSetString(psWScreen,FRONTEND_SSHAKE_R, _("Off")); } else { setShakeStatus(true); widgSetString(psWScreen,FRONTEND_SSHAKE_R, _("On")); } break; case FRONTEND_FOGTYPE: case FRONTEND_FOGTYPE_R: if (war_GetFog()) { // turn off crap fog, turn on vis fog. debug(LOG_FOG, "runGameOptions2Menu: Fog of war ON, visual fog OFF"); war_SetFog(false); widgSetString(psWScreen,FRONTEND_FOGTYPE_R, _("Fog Of War")); } else { // turn off vis fog, turn on normal crap fog. debug(LOG_FOG, "runGameOptions2Menu: Fog of war OFF, visual fog ON"); war_SetFog(true); widgSetString(psWScreen,FRONTEND_FOGTYPE_R, _("Mist")); } break; case FRONTEND_QUIT: changeTitleMode(OPTIONS); break; case FRONTEND_SUBTITLES: case FRONTEND_SUBTITLES_R: if( seq_GetSubtitles()) {// turn off seq_SetSubtitles(false); widgSetString(psWScreen,FRONTEND_SUBTITLES_R,_("Off")); } else {// turn on seq_SetSubtitles(true); widgSetString(psWScreen,FRONTEND_SUBTITLES_R,_("On")); } break; case FRONTEND_SHADOWS: case FRONTEND_SHADOWS_R: setDrawShadows(!getDrawShadows()); if (getDrawShadows()) { widgSetString(psWScreen, FRONTEND_SHADOWS_R, _("On")); } else { widgSetString(psWScreen, FRONTEND_SHADOWS_R, _("Off")); } break; case FRONTEND_FMVMODE: case FRONTEND_FMVMODE_R: switch (mode = war_GetFMVmode()) { case FMV_1X: war_SetFMVmode((FMV_MODE)(mode + 1)); widgSetString(psWScreen, FRONTEND_FMVMODE_R, _("2X")); break; case FMV_2X: war_SetFMVmode((FMV_MODE)(mode + 1)); widgSetString(psWScreen, FRONTEND_FMVMODE_R, _("Fullscreen")); break; case FMV_FULLSCREEN: war_SetFMVmode((FMV_MODE)(mode + 1)); widgSetString(psWScreen, FRONTEND_FMVMODE_R, _("1X")); break; default: ASSERT(!"invalid FMV mode", "Invalid FMV mode: %u", (unsigned int)mode); break; } break; case FRONTEND_SCANLINES: case FRONTEND_SCANLINES_R: switch (mode = war_getScanlineMode()) { case SCANLINES_OFF: war_setScanlineMode(SCANLINES_50); widgSetString(psWScreen, FRONTEND_SCANLINES_R, _("50%")); break; case SCANLINES_50: war_setScanlineMode(SCANLINES_BLACK); widgSetString(psWScreen, FRONTEND_SCANLINES_R, _("Black")); break; case SCANLINES_BLACK: war_setScanlineMode(SCANLINES_OFF); widgSetString(psWScreen, FRONTEND_SCANLINES_R, _("Off")); break; } default: break; } // If close button pressed then return from this menu. if(CancelPressed()) { changeTitleMode(OPTIONS); } widgDisplayScreen(psWScreen); // show the widgets currently running return true; }
bool runGameOptionsMenu(void) { UDWORD id; id = widgRunScreen(psWScreen); // Run the current set of widgets switch(id) { case FRONTEND_LANGUAGE_R: setNextLanguage(); widgSetString(psWScreen, FRONTEND_LANGUAGE_R, getLanguageName()); /* Hack to reset current menu text, which looks fancy. */ widgSetString(psWScreen, FRONTEND_LANGUAGE, _("Language")); widgSetString(psWScreen, FRONTEND_COLOUR, _("Unit Colour")); widgSetString(psWScreen, FRONTEND_DIFFICULTY, _("Difficulty")); widgSetString(psWScreen, FRONTEND_SCROLLSPEED,_("Scroll Speed")); widgSetString(psWScreen, FRONTEND_SIDETEXT, _("GAME OPTIONS")); // FIXME: Changing the below return button tooltip does not work. //widgSetString(psWScreen, FRONTEND_BOTFORM, P_("menu", "Return")); switch( getDifficultyLevel() ) { case DL_EASY: widgSetString(psWScreen,FRONTEND_DIFFICULTY_R, _("Easy")); break; case DL_NORMAL: widgSetString(psWScreen,FRONTEND_DIFFICULTY_R, _("Normal")); break; case DL_HARD: widgSetString(psWScreen,FRONTEND_DIFFICULTY_R, _("Hard") ); break; case DL_TOUGH: case DL_KILLER: debug(LOG_ERROR, "runGameOptionsMenu: Unused difficulty level selected!"); break; } break; case FRONTEND_RADAR_R: rotateRadar = !rotateRadar; widgSetString(psWScreen, FRONTEND_RADAR_R, rotateRadar ? _("Rotating") : _("Fixed")); break; case FRONTEND_SCROLLSPEED: break; case FRONTEND_DIFFICULTY: case FRONTEND_DIFFICULTY_R: switch( getDifficultyLevel() ) { case DL_EASY: setDifficultyLevel(DL_NORMAL); widgSetString(psWScreen,FRONTEND_DIFFICULTY_R, _("Normal")); break; case DL_NORMAL: setDifficultyLevel(DL_HARD); widgSetString(psWScreen,FRONTEND_DIFFICULTY_R, _("Hard") ); break; case DL_HARD: setDifficultyLevel(DL_EASY); widgSetString(psWScreen,FRONTEND_DIFFICULTY_R, _("Easy")); break; default: // DL_TOUGH and DL_KILLER break; } break; case FRONTEND_SCROLLSPEED_SL: scroll_speed_accel = widgGetSliderPos(psWScreen,FRONTEND_SCROLLSPEED_SL) * 100; //0-1600 if(scroll_speed_accel ==0) // make sure you CAN scroll. { scroll_speed_accel = 100; } break; case FRONTEND_QUIT: changeTitleMode(OPTIONS); break; case FE_P0: widgSetButtonState(psWScreen, FE_P0, WBUT_LOCK); widgSetButtonState(psWScreen, FE_P4, 0); widgSetButtonState(psWScreen, FE_P5, 0); widgSetButtonState(psWScreen, FE_P6, 0); widgSetButtonState(psWScreen, FE_P7, 0); war_SetSPcolor(0); break; case FE_P4: widgSetButtonState(psWScreen, FE_P0, 0); widgSetButtonState(psWScreen, FE_P4, WBUT_LOCK); widgSetButtonState(psWScreen, FE_P5, 0); widgSetButtonState(psWScreen, FE_P6, 0); widgSetButtonState(psWScreen, FE_P7, 0); war_SetSPcolor(4); break; case FE_P5: widgSetButtonState(psWScreen, FE_P0, 0); widgSetButtonState(psWScreen, FE_P4, 0); widgSetButtonState(psWScreen, FE_P5, WBUT_LOCK); widgSetButtonState(psWScreen, FE_P6, 0); widgSetButtonState(psWScreen, FE_P7, 0); war_SetSPcolor(5); break; case FE_P6: widgSetButtonState(psWScreen, FE_P0, 0); widgSetButtonState(psWScreen, FE_P4, 0); widgSetButtonState(psWScreen, FE_P5, 0); widgSetButtonState(psWScreen, FE_P6, WBUT_LOCK); widgSetButtonState(psWScreen, FE_P7, 0); war_SetSPcolor(6); break; case FE_P7: widgSetButtonState(psWScreen, FE_P0, 0); widgSetButtonState(psWScreen, FE_P4, 0); widgSetButtonState(psWScreen, FE_P5, 0); widgSetButtonState(psWScreen, FE_P6, 0); widgSetButtonState(psWScreen, FE_P7, WBUT_LOCK); war_SetSPcolor(7); break; default: break; } // If close button pressed then return from this menu. if(CancelPressed()) { changeTitleMode(OPTIONS); } widgDisplayScreen(psWScreen); // show the widgets currently running return true; }
bool runMouseOptionsMenu(void) { UDWORD id = widgRunScreen(psWScreen); switch (id) { case FRONTEND_MFLIP: case FRONTEND_MFLIP_R: if( getInvertMouseStatus() ) {// flipped setInvertMouseStatus(false); widgSetString(psWScreen,FRONTEND_MFLIP_R, _("Off")); } else { // not flipped setInvertMouseStatus(true); widgSetString(psWScreen,FRONTEND_MFLIP_R, _("On")); } break; case FRONTEND_TRAP: case FRONTEND_TRAP_R: if (war_GetTrapCursor()) { war_SetTrapCursor(false); widgSetString(psWScreen, FRONTEND_TRAP_R, _("Off")); } else { war_SetTrapCursor(true); widgSetString(psWScreen, FRONTEND_TRAP_R, _("On")); } break; case FRONTEND_MBUTTONS: case FRONTEND_MBUTTONS_R: if( getRightClickOrders() ) { setRightClickOrders(false); widgSetString(psWScreen,FRONTEND_MBUTTONS_R, _("Off")); } else { setRightClickOrders(true); widgSetString(psWScreen,FRONTEND_MBUTTONS_R, _("On")); } break; case FRONTEND_MMROTATE: case FRONTEND_MMROTATE_R: if( getMiddleClickRotate() ) { setMiddleClickRotate(false); widgSetString(psWScreen,FRONTEND_MMROTATE_R, _("Right Mouse")); } else { setMiddleClickRotate(true); widgSetString(psWScreen,FRONTEND_MMROTATE_R, _("Middle Mouse")); } break; case FRONTEND_QUIT: changeTitleMode(OPTIONS); break; default: break; } if (CancelPressed()) { changeTitleMode(OPTIONS); } widgDisplayScreen(psWScreen); return true; }
bool runVideoOptionsMenu(void) { SDL_Rect **modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE); UDWORD id = widgRunScreen(psWScreen); switch (id) { case FRONTEND_WINDOWMODE: case FRONTEND_WINDOWMODE_R: if (war_getFullscreen()) { war_setFullscreen(false); widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Windowed")); } else { war_setFullscreen(true); widgSetString(psWScreen, FRONTEND_WINDOWMODE_R, _("Fullscreen")); } break; case FRONTEND_RESOLUTION: case FRONTEND_RESOLUTION_R: { int current, count, oldcurrent; // Get the current mode offset for (count = 0, current = 0; modes[count]; count++) { if (war_GetWidth() == modes[count]->w && war_GetHeight() == modes[count]->h) { current = count; } } // Increment and clip if required // Hide resolutions lower than Warzone can support oldcurrent = current; do { if (!mouseReleased(MOUSE_RMB)) { if (--current < 0) current = count - 1; } else { if (++current == count) current = 0; } } while ((modes[current]->w < 640 || modes[current]->h < 480) && current != oldcurrent); // Set the new width and height (takes effect on restart) war_SetWidth(modes[current]->w); war_SetHeight(modes[current]->h); // Generate the textual representation of the new width and height snprintf(resolution, WIDG_MAXSTR, "%d x %d", modes[current]->w, modes[current]->h); // Update the widget widgSetString(psWScreen, FRONTEND_RESOLUTION_R, resolution); break; } case FRONTEND_TRAP: case FRONTEND_TRAP_R: if (war_GetTrapCursor()) { war_SetTrapCursor(false); widgSetString(psWScreen, FRONTEND_TRAP_R, _("Off")); } else { war_SetTrapCursor(true); widgSetString(psWScreen, FRONTEND_TRAP_R, _("On")); } break; case FRONTEND_TEXTURESZ: case FRONTEND_TEXTURESZ_R: { int newTexSize = getTextureSize() * 2; // Clip such that 128 <= size <= 2048 if (newTexSize > 2048) { newTexSize = 128; } // Set the new size setTextureSize(newTexSize); // Generate the string representation of the new size snprintf(textureSize, WIDG_MAXSTR, "%d", newTexSize); // Update the widget widgSetString(psWScreen, FRONTEND_TEXTURESZ_R, textureSize); break; } case FRONTEND_VSYNC: case FRONTEND_VSYNC_R: { if (war_GetVsync()) { war_SetVsync(false); widgSetString(psWScreen, FRONTEND_VSYNC_R, _("Off")); } else { war_SetVsync(true); widgSetString(psWScreen, FRONTEND_VSYNC_R, _("On")); } break; } case FRONTEND_QUIT: changeTitleMode(OPTIONS); break; default: break; } if (CancelPressed()) { changeTitleMode(OPTIONS); } widgDisplayScreen(psWScreen); return true; }