From: DeaDDooMER Date: Tue, 27 Feb 2018 17:25:02 +0000 (+0300) Subject: Disable accelerometer and add g_dbg_scale as option X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=3424d00c1df01d4ccef05c7436345e61c16c22ff;p=d2df-sdl.git Disable accelerometer and add g_dbg_scale as option --- diff --git a/src/game/g_language.pas b/src/game/g_language.pas index 72508cf..f325846 100644 --- a/src/game/g_language.pas +++ b/src/game/g_language.pas @@ -253,6 +253,7 @@ type I_MENU_GAME_CHAT_TYPE_ADV, I_MENU_GAME_CHAT_TYPE_COLOR, I_MENU_GAME_CHAT_TYPE_TEXTURE, + I_MENU_GAME_SCALE_FACTOR, I_MENU_VIDEO_RESOLUTION, I_MENU_VIDEO_BPP, @@ -1072,6 +1073,8 @@ const 'Öâåòíàÿ'), ('MENU GAME CHAT TYPE TEXTURE', 'Textured', 'Òåêñòóðà'), + ('MENU GAME SCALE FACTOR', 'Scale:', + 'Ìàñøòàá:'), ('MENU VIDEO RESOLUTION', 'Set video mode', 'Óñòàíîâêà âèäåîðåæèìà'), diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 07d2f48..960eb9e 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -112,6 +112,9 @@ begin sdlflags := SDL_INIT_JOYSTICK or SDL_INIT_TIMER or SDL_INIT_VIDEO; {$ENDIF} {$ENDIF} + + SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0'); + if SDL_Init(sdlflags) < 0 then raise Exception.Create('SDL: Init failed: ' + SDL_GetError()); diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index fca66be..3056950 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -164,6 +164,7 @@ begin gShowMessages := TGUISwitch(menu.GetControl('swMessages')).ItemIndex = 0; gRevertPlayers := TGUISwitch(menu.GetControl('swRevertPlayers')).ItemIndex = 0; gChatBubble := TGUISwitch(menu.GetControl('swChatBubble')).ItemIndex; + g_dbg_scale := TGUIScroll(menu.GetControl('swScaleFactor')).Value + 1; menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu')); @@ -495,6 +496,8 @@ begin with TGUISwitch(menu.GetControl('swChatBubble')) do ItemIndex := gChatBubble; + TGUIScroll(menu.GetControl('swScaleFactor')).Value := Round(g_dbg_scale - 1); + menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu')); TGUIListBox(menu.GetControl('lsP1Model')).SelectItem(gPlayer1Settings.Model); @@ -1259,6 +1262,14 @@ begin ); end; +procedure ProcChangeGameSettings(Sender: TGUIControl); +var + menu: TGUIMenu; +begin + menu := TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu')); + g_dbg_scale := TGUIScroll(menu.GetControl('swScaleFactor')).Value + 1; +end; + procedure ProcOptionsPlayersMIMenu(); var s, a: string; @@ -2673,6 +2684,12 @@ begin AddItem(_lc[I_MENU_GAME_CHAT_TYPE_COLOR]); AddItem(_lc[I_MENU_GAME_CHAT_TYPE_TEXTURE]); end; + with AddScroll(_lc[I_MENU_GAME_SCALE_FACTOR]) do + begin + Name := 'swScaleFactor'; + Max := 10; + OnChange := ProcChangeGameSettings; + end; ReAlign(); end; Menu.DefControl := 'mOptionsGameMenu'; diff --git a/src/game/g_options.pas b/src/game/g_options.pas index b3b2f5a..a1397a8 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -166,6 +166,7 @@ begin gDrawBackGround := True; gShowMessages := True; gRevertPlayers := False; + g_dbg_scale := 1.0; for i := 0 to e_MaxJoys-1 do e_JoystickDeadzones[i] := 8192; @@ -449,6 +450,7 @@ begin e_FastScreenshots := config.ReadBool('Game', 'FastScreenshots', True); gDefaultMegawadStart := config.ReadStr('Game', 'DefaultMegawadStart', DF_Default_Megawad_Start); gBerserkAutoswitch := config.ReadBool('Game', 'BerserkAutoswitching', True); + g_dbg_scale := Max(config.ReadInt('Game', 'Scale', 1), 1); // Ãåéìïëåé â ñâîåé èãðå gcMap := config.ReadStr('GameplayCustom', 'Map', ''); @@ -686,6 +688,7 @@ begin config.WriteBool('Game', 'FastScreenshots', e_FastScreenshots); config.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart); config.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch); + config.WriteInt('Game', 'Scale', Round(g_dbg_scale)); config.WriteStr ('GameplayCustom', 'Map', gcMap); config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode);