#!/usr/bin/env bash
#Author: Ridbowt (Nikola P.)
#Sources: www.gog.com/forum/medal_of_honor_series/moh_dont_start_on_linux/post2 + lutris.net/games/medal-of-honor-allied-assault-war-chest/ + www.playground.ru/medal_of_honor_allied_assault/cheat/medal_of_honor_allied_assault_sovet_lyuboe_razreshenie_dalnost_prorisovki_pole_obzora_fov_pravilnoe_otkrytie_vseh_medalej-816472
#Comment: Резервные копии кофиг-файлов находятся в корне игры, в каталогах "/Medal of Honor/main/" + "/Medal of Honor/main/configs/", "/Medal of Honor/mainta/" + "/Medal of Honor/mainta/configs/", "/Medal of Honor/maintt/" + "/Medal of Honor/maintt/configs/". Чтобы восстановить исходные конфигурации - просто удалите в этих каталогах файлы newconfig.cfg и unnamedsoldier.cfg; после этого удалите расширение .bak у файлов newconfig.cfg.bak и unnamedsoldier.cfg.bak.
#MOHAA.exe
#moh_spearhead.exe
#moh_breakthrough.exe
#Rating=5
################################################
export PW_VULKAN_USE=0
export MESA_EXTENSION_MAX_YEAR=2002
export __GL_ExtensionStringVersion=17700
add_in_start_portwine ()
{
if [[ ! -e "$PATH_TO_GAME/0_Proton_PW_MoHAA" ]] ; then
    touch "$PATH_TO_GAME/0_Proton_PW_MoHAA" && mv "$PATH_TO_GAME/main/newconfig.cfg" "$PATH_TO_GAME/main/newconfig.cfg.bak" && mv "$PATH_TO_GAME/main/configs/unnamedsoldier.cfg" "$PATH_TO_GAME/main/configs/unnamedsoldier.cfg.bak" && mv "$PATH_TO_GAME/mainta/newconfig.cfg" "$PATH_TO_GAME/mainta/newconfig.cfg.bak" && mv "$PATH_TO_GAME/mainta/configs/unnamedsoldier.cfg" "$PATH_TO_GAME/mainta/configs/unnamedsoldier.cfg.bak" && mv "$PATH_TO_GAME/maintt/newconfig.cfg" "$PATH_TO_GAME/maintt/newconfig.cfg.bak" && mv "$PATH_TO_GAME/maintt/configs/unnamedsoldier.cfg" "$PATH_TO_GAME/maintt/configs/unnamedsoldier.cfg.bak" &&
    echo '//
// Video Card Family: NVidia GeForce
// Video Card Driver: NVIDIA GeForce GTX 760
//
// Mhz 1100
// Vidmem 64
// Sysmem 256
//

seta com_maxfps "144"
seta cg_drawviewmodel "2"
seta cg_effectdetail "1.0"
seta cg_marks_add "1"
seta cg_max_tempmodels "1200"
seta cg_rain "1"
seta cg_reserve_tempmodels "240"
seta cg_shadows "2"
seta g_ddayfodderguys "2"
seta g_ddayfog "0"
seta g_ddayshingleguys "2"
seta r_colorbits "32"
seta r_drawstaticdecals "1"
seta r_ext_compressed_textures "1"
seta r_fastdlights "0"
seta r_fastentlight "0"
seta r_forceClampToEdge "1"
seta r_lodcap "1.0"
seta r_lodscale "1.1"
seta r_lodviewmodelcap "1.0"
seta r_maxmode "9"
seta r_picmip "0"
seta r_picmip_models "0"
seta r_picmip_sky "0"
seta r_subdivisions "1"
seta r_texturebits "32"
seta r_texturemode "GL_LINEAR_MIPMAP_LINEAR"
seta r_vidmode1024 "0"
seta r_vidmodemax "1"
seta s_khz "44"
seta ter_error "4"
seta ter_maxlod "6"
seta ter_maxtris "24576"
seta vss_draw "1"
seta vss_maxcount "15"
' | tee "$PATH_TO_GAME/main/newconfig.cfg" | tee "$PATH_TO_GAME/mainta/newconfig.cfg" | tee "$PATH_TO_GAME/maintt/newconfig.cfg" >/dev/null &&
    echo '// generated by moh:aa do not modify
//
// Key Bindings
//
unbindall
bind TAB "+scores"
bind ESCAPE "togglemenu"
bind SPACE "+moveup"
bind 1 "useweaponclass pistol"
bind 2 "useweaponclass rifle"
bind 3 "useweaponclass smg"
bind 4 "useweaponclass mg"
bind 5 "useweaponclass grenade"
bind 6 "useweaponclass heavy"
bind 7 "toggleitem"
bind ` "toggleconsole"
bind a "+moveleft"
bind c "+leanright"
bind d "+moveright"
bind e "+use"
bind h "weapdrop"
bind p "pushmenu_weaponselect"
bind q "holster"
bind r "reload"
bind s "+back"
bind t "sayteam"
bind u "pushmenu_teamselect"
bind v "instamsg_main"
bind w "+forward"
bind y "say"
bind z "+leanleft"
bind PAUSE "pause"
bind LCTRL "+movedown"
bind LSHIFT "+speed"
bind F2 "ui_getplayermodel;pushmenu_dm mpoptions"
bind F3 "pushmenu Controls"
bind F4 "pushmenu_sp LoadSave"
bind F5 "savegame quick"
bind F6 "messagemode"
bind F9 "loadgame quick"
bind F12 "screenshot"
bind MOUSE1 "+attackprimary"
bind MOUSE2 "+attacksecondary"
bind MWHEELDOWN "weapprev"
bind MWHEELUP "weapnext"
//
// Cvars
//
seta ui_console "1"
seta r_mode "-1"
seta r_customWidth "1920"
seta r_customHeight "1080"
seta s_milesdriver "Miles Fast 2D Positional Audio"
seta r_gamma "1.000000"
seta r_lastValidRenderer "GeForce GTX 760/PCIe/SSE2"
seta sensitivity "10.750000"
seta s_volume "0.900000"
seta s_musicvolume "0.900000"
seta vss_maxcount "10"
seta r_texturemode "gl_linear_mipmap_linear"
seta developer "1"
//
// Aliases
//
' | tee "$PATH_TO_GAME/main/configs/unnamedsoldier.cfg" | tee "$PATH_TO_GAME/mainta/configs/unnamedsoldier.cfg" | tee "$PATH_TO_GAME/maintt/configs/unnamedsoldier.cfg" >/dev/null
else
    true
fi
}
