// //////////////////////////////////////////////////////////////////////////// bool saveConfig() { QSettings ini(PHYSFS_getWriteDir() + QString("/") + fileName, QSettings::IniFormat); if (ini.status() != QSettings::NoError) { debug(LOG_ERROR, "Could not open configuration file \"%s\"", fileName); return false; } debug(LOG_WZ, "Writing prefs to registry \"%s\"", ini.fileName().toUtf8().constData()); // ////////////////////////// // voicevol, fxvol and cdvol ini.setValue("voicevol", (int)(sound_GetUIVolume() * 100.0)); ini.setValue("fxvol", (int)(sound_GetEffectsVolume() * 100.0)); ini.setValue("cdvol", (int)(sound_GetMusicVolume() * 100.0)); ini.setValue("music_enabled", war_GetMusicEnabled()); ini.setValue("width", war_GetWidth()); ini.setValue("height", war_GetHeight()); ini.setValue("bpp", pie_GetVideoBufferDepth()); ini.setValue("fullscreen", war_getFullscreen()); ini.setValue("language", getLanguage()); // dont save out the cheat mode. if (getDifficultyLevel() != DL_KILLER && getDifficultyLevel() != DL_TOUGH) { ini.setValue("difficulty", getDifficultyLevel()); // level } ini.setValue("showFPS", (SDWORD)showFPS); ini.setValue("scroll",(SDWORD)scroll_speed_accel); // scroll ini.setValue("shake",(SDWORD)(getShakeStatus())); // screenshake ini.setValue("mouseflip",(SDWORD)(getInvertMouseStatus())); // flipmouse ini.setValue("nomousewarp", (SDWORD)getMouseWarp()); // mouse warp ini.setValue("RightClickOrders",(SDWORD)(getRightClickOrders())); ini.setValue("MiddleClickRotate",(SDWORD)(getMiddleClickRotate())); ini.setValue("showFPS", (SDWORD)showFPS); ini.setValue("shadows",(SDWORD)(getDrawShadows())); // shadows ini.setValue("sound", (SDWORD)war_getSoundEnabled()); ini.setValue("FMVmode",(SDWORD)(war_GetFMVmode())); // sequences ini.setValue("scanlines", (SDWORD)war_getScanlineMode()); ini.setValue("subtitles",(SDWORD)(seq_GetSubtitles())); // subtitles ini.setValue("radarObjectMode",(SDWORD)bEnemyAllyRadarColor); // enemy/allies radar view ini.setValue("radarTerrainMode",(SDWORD)radarDrawMode); ini.setValue("trapCursor", war_GetTrapCursor()); ini.setValue("vsync", war_GetVsync()); ini.setValue("textureSize", getTextureSize()); ini.setValue("FSAA", war_getFSAA()); ini.setValue("UPnP", (SDWORD)NetPlay.isUPNP); ini.setValue("rotateRadar", rotateRadar); ini.setValue("PauseOnFocusLoss", war_GetPauseOnFocusLoss()); ini.setValue("masterserver_name", NETgetMasterserverName()); ini.setValue("masterserver_port", NETgetMasterserverPort()); ini.setValue("gameserver_port", NETgetGameserverPort()); if (!bMultiPlayer) { ini.setValue("colour", getPlayerColour(0)); // favourite colour. } else { if (NetPlay.isHost && ingame.localJoiningInProgress) { if (bMultiPlayer && NetPlay.bComms) { ini.setValue("gameName", game.name); // last hosted game } ini.setValue("mapName", game.map); // map name ini.setValue("mapHash", game.hash.toString().c_str()); // map hash ini.setValue("maxPlayers", game.maxPlayers); // maxPlayers ini.setValue("power", game.power); // power ini.setValue("base", game.base); // size of base ini.setValue("alliance", game.alliance); // allow alliances ini.setValue("scavengers", game.scavengers); } ini.setValue("playerName", (char*)sPlayer); // player name } ini.setValue("colourMP", war_getMPcolour()); ini.sync(); return true; }
// //////////////////////////////////////////////////////////////////////////// // Graphics Options static bool startGraphicsOptionsMenu(void) { addBackdrop(); addTopForm(); addBottomForm(); //////////// //FMV mode. addTextButton(FRONTEND_FMVMODE, FRONTEND_POS2X - 35, FRONTEND_POS2Y, _("Video Playback"), 0); switch (war_GetFMVmode()) { case FMV_1X: addTextButton(FRONTEND_FMVMODE_R, FRONTEND_POS2M - 55,FRONTEND_POS2Y, _("1X"), 0); break; case FMV_2X: addTextButton(FRONTEND_FMVMODE_R, FRONTEND_POS2M - 55,FRONTEND_POS2Y, _("2X"), 0); break; case FMV_FULLSCREEN: addTextButton(FRONTEND_FMVMODE_R, FRONTEND_POS2M - 55,FRONTEND_POS2Y, _("Fullscreen"), 0); break; default: ASSERT(!"invalid FMV mode", "Invalid FMV mode: %u", (unsigned int)war_GetFMVmode()); break; } // Scanlines addTextButton(FRONTEND_SCANLINES, FRONTEND_POS3X - 35, FRONTEND_POS3Y, _("Scanlines"), 0); switch (war_getScanlineMode()) { case SCANLINES_OFF: addTextButton(FRONTEND_SCANLINES_R, FRONTEND_POS3M - 55, FRONTEND_POS3Y, _("Off"), 0); break; case SCANLINES_50: addTextButton(FRONTEND_SCANLINES_R, FRONTEND_POS3M - 55, FRONTEND_POS3Y, _("50%"), 0); break; case SCANLINES_BLACK: addTextButton(FRONTEND_SCANLINES_R, FRONTEND_POS3M - 55, FRONTEND_POS3Y, _("Black"), 0); break; } //////////// // screenshake addTextButton(FRONTEND_SSHAKE, FRONTEND_POS4X-35, FRONTEND_POS4Y, _("Screen Shake"), 0); if(getShakeStatus()) {// shaking on addTextButton(FRONTEND_SSHAKE_R, FRONTEND_POS4M-55, FRONTEND_POS4Y, _("On"), 0); } else {//shaking off. addTextButton(FRONTEND_SSHAKE_R, FRONTEND_POS4M-55, FRONTEND_POS4Y, _("Off"), 0); } //////////// // fog addTextButton(FRONTEND_FOGTYPE, FRONTEND_POS5X-35, FRONTEND_POS5Y, _("Fog"), 0); if(war_GetFog()) { addTextButton(FRONTEND_FOGTYPE_R,FRONTEND_POS5M-55,FRONTEND_POS5Y, _("Mist"), 0); } else { addTextButton(FRONTEND_FOGTYPE_R,FRONTEND_POS5M-55,FRONTEND_POS5Y, _("Fog Of War"), 0); } //////////// //subtitle mode. addTextButton(FRONTEND_SUBTITLES, FRONTEND_POS6X - 35, FRONTEND_POS6Y, _("Subtitles"), 0); if (!seq_GetSubtitles()) { addTextButton(FRONTEND_SUBTITLES_R, FRONTEND_POS6M - 55, FRONTEND_POS6Y, _("Off"), 0); } else { addTextButton(FRONTEND_SUBTITLES_R, FRONTEND_POS6M - 55, FRONTEND_POS6Y, _("On"), 0); } //////////// //shadows addTextButton(FRONTEND_SHADOWS, FRONTEND_POS7X - 35, FRONTEND_POS7Y, _("Shadows"), 0); if (getDrawShadows()) { addTextButton(FRONTEND_SHADOWS_R, FRONTEND_POS7M - 55, FRONTEND_POS7Y, _("On"), 0); } else { // not flipped addTextButton(FRONTEND_SHADOWS_R, FRONTEND_POS7M - 55, FRONTEND_POS7Y, _("Off"), 0); } // Add some text down the side of the form addSideText(FRONTEND_SIDETEXT, FRONTEND_SIDEX, FRONTEND_SIDEY, _("GRAPHICS OPTIONS")); //////////// // quit. addMultiBut(psWScreen, FRONTEND_BOTFORM, FRONTEND_QUIT, 10, 10, 30, 29, P_("menu", "Return"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI); 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 saveConfig(void) { debug( LOG_WZ, "Writing prefs to registry\n" ); if(!openWarzoneKey()) { return false; } // ////////////////////////// // voicevol, fxvol and cdvol setWarzoneKeyNumeric("voicevol", (int)(sound_GetUIVolume() * 100.0)); setWarzoneKeyNumeric("fxvol", (int)(sound_GetEffectsVolume() * 100.0)); setWarzoneKeyNumeric("cdvol", (int)(sound_GetMusicVolume() * 100.0)); setWarzoneKeyNumeric("music_enabled", war_GetMusicEnabled()); setWarzoneKeyNumeric("width", war_GetWidth()); setWarzoneKeyNumeric("height", war_GetHeight()); setWarzoneKeyNumeric("bpp", pie_GetVideoBufferDepth()); setWarzoneKeyNumeric("fullscreen", war_getFullscreen()); setWarzoneKeyString("language", getLanguage()); // dont save out the cheat mode. if(getDifficultyLevel()==DL_KILLER || getDifficultyLevel()== DL_TOUGH) { setDifficultyLevel(DL_NORMAL); } setWarzoneKeyNumeric("debugmode", bAllowDebugMode); setWarzoneKeyNumeric("framerate", (SDWORD)getFramerateLimit()); setWarzoneKeyNumeric("showFPS", (SDWORD)showFPS); setWarzoneKeyNumeric("scroll",(SDWORD)scroll_speed_accel); // scroll setWarzoneKeyNumeric("difficulty", getDifficultyLevel()); // level setWarzoneKeyNumeric("visfog",(SDWORD)(!war_GetFog())); // fogtype setWarzoneKeyNumeric("shake",(SDWORD)(getShakeStatus())); // screenshake setWarzoneKeyNumeric("mouseflip",(SDWORD)(getInvertMouseStatus())); // flipmouse setWarzoneKeyNumeric("RightClickOrders",(SDWORD)(getRightClickOrders())); setWarzoneKeyNumeric("MiddleClickRotate",(SDWORD)(getMiddleClickRotate())); setWarzoneKeyNumeric("shadows",(SDWORD)(getDrawShadows())); // shadows setWarzoneKeyNumeric("sound", (SDWORD)war_getSoundEnabled()); setWarzoneKeyNumeric("FMVmode",(SDWORD)(war_GetFMVmode())); // sequences setWarzoneKeyNumeric("subtitles",(SDWORD)(seq_GetSubtitles())); // subtitles setWarzoneKeyNumeric("radarObjectMode",(SDWORD)bEnemyAllyRadarColor); // enemy/allies radar view setWarzoneKeyNumeric("radarTerrainMode",(SDWORD)radarDrawMode); setWarzoneKeyNumeric("trapCursor", war_GetTrapCursor()); setWarzoneKeyNumeric("vsync", war_GetVsync()); setWarzoneKeyNumeric("textureSize", getTextureSize()); setWarzoneKeyNumeric("rotateRadar", rotateRadar); setWarzoneKeyNumeric("PauseOnFocusLoss", war_GetPauseOnFocusLoss()); setWarzoneKeyNumeric("ColouredCursor", war_GetColouredCursor()); setWarzoneKeyString("masterserver_name", NETgetMasterserverName()); setWarzoneKeyNumeric("masterserver_port", NETgetMasterserverPort()); setWarzoneKeyNumeric("gameserver_port", NETgetGameserverPort()); if(!bMultiPlayer) { setWarzoneKeyNumeric("colour",(SDWORD)getPlayerColour(0)); // favourite colour. } else { debug( LOG_NEVER, "Writing multiplay prefs to registry\n" ); if (NetPlay.isHost && ingame.localJoiningInProgress) { if (bMultiPlayer && NetPlay.bComms) { setWarzoneKeyString("gameName", game.name); // last hosted game } setWarzoneKeyString("mapName", game.map); // map name setWarzoneKeyNumeric("maxPlayers",game.maxPlayers); // maxPlayers setWarzoneKeyNumeric("power", game.power); // power setWarzoneKeyNumeric("base", game.base); // size of base setWarzoneKeyNumeric("fog", game.fog); // fog 'o war setWarzoneKeyNumeric("alliance", game.alliance); // allow alliances } setWarzoneKeyString("playerName",(char*)sPlayer); // player name setWarzoneKeyString("phrase0", ingame.phrases[0]); // phrases setWarzoneKeyString("phrase1", ingame.phrases[1]); setWarzoneKeyString("phrase2", ingame.phrases[2]); setWarzoneKeyString("phrase3", ingame.phrases[3]); setWarzoneKeyString("phrase4", ingame.phrases[4]); } return closeWarzoneKey(); }