X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_options.pas;h=706ca33a1a357d740a82b0282c9557e590a8f929;hp=41f0e69ffa8633d35f53b3540e61bce94b167838;hb=676995a77ad243efc0abee75841f81e86a7262a0;hpb=9b4492224e2e59560931496e925333bdbe6f2b0e diff --git a/src/game/g_options.pas b/src/game/g_options.pas index 41f0e69..706ca33 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -35,14 +35,14 @@ procedure g_Options_Commands (p: SSArray); const DF_Default_Megawad_Start = 'megawads/DOOM2D.WAD:\MAP01'; var - gScreenWidth: Word; - gScreenHeight: Word; gBPP: Integer; gFreq: Byte; gFullscreen: Boolean; + gWinSizeX, gWinSizeY: Integer; gWinMaximized: Boolean; gVSync: Boolean; glLegacyNPOT: Boolean; + glRenderToFBO: Boolean = True; gTextureFilter: Boolean; gNoSound: Boolean; gSoundLevel: Integer; @@ -53,13 +53,15 @@ var gAdvBlood: Boolean; gAdvGibs: Boolean; gGibsCount: Integer; - gBloodCount: Byte; - gFlash: Byte; + gBloodCount: Integer; + gFlash: Integer; gDrawBackGround: Boolean; gShowMessages: Boolean; gRevertPlayers: Boolean; gLanguage: String; gAskLanguage: Boolean; + gSaveStats: Boolean = False; + gScreenshotStats: Boolean = False; gcMap: String; gcGameMode: String; gcTimeLimit: Word; @@ -71,6 +73,9 @@ var gcWeaponStay: Boolean; gcMonsters: Boolean; gcBotsVS: String; + gcDeathmatchKeys: Boolean = True; + gcRespawnItems: Boolean = True; + gcSpawnInvul: Integer = 0; gnMap: String; gnGameMode: String; gnTimeLimit: Word; @@ -82,10 +87,11 @@ var gnWeaponStay: Boolean; gnMonsters: Boolean; gnBotsVS: String; + gnDeathmatchKeys: Boolean = True; + gnRespawnItems: Boolean = True; + gnSpawnInvul: Integer = 0; gsSDLSampleRate: Integer; gsSDLBufferSize: Integer; - gSFSDebug: Boolean; - gSFSFastMode: Boolean; gDefaultMegawadStart: AnsiString; gBerserkAutoswitch: Boolean; glNPOTOverride: Boolean = false; @@ -126,6 +132,8 @@ begin (* Display 0 = Primary display *) gScreenWidth := 640; gScreenHeight := 480; + gWinSizeX := 640; + gWinSizeY := 480; //gBPP := SDL_BITSPERPIXEL(dispaly.format); gBPP := 32; {$IFDEF ANDROID} @@ -136,8 +144,8 @@ begin if SDL_GetDesktopDisplayMode(0, @display) = 0 then begin {$IFDEF ANDROID} - gScreenWidth := display.w; - gScreenHeight := display.h; + gWinSizeX := display.w; + gWinSizeY := display.h; {$ELSE} (* Window must be smaller than display *) closest.w := display.w; @@ -159,8 +167,8 @@ begin SDL_GetClosestDisplayMode(0, @target, @closest); Dec(percentage); end; - gScreenWidth := closest.w; - gScreenHeight := closest.h; + gWinSizeX := closest.w; + gWinSizeY := closest.h; //gBPP := SDL_BITSPERPIXEL(closest.format); (* Resolution list didn't work for some reason *) {$ENDIF} end @@ -173,21 +181,31 @@ begin gVSync := True; gTextureFilter := True; glLegacyNPOT := False; - e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight)); + gRC_Width := gWinSizeX; + gRC_Height := gWinSizeY; + gRC_FullScreen := gFullScreen; + gRC_Maximized := gWinMaximized; + e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gWinSizeX) + ' h = ' + IntToStr(gWinSizeY)); g_Console_ResetBinds; end; {$ELSE} procedure g_Options_SetDefaultVideo; begin - gScreenWidth := 640; - gScreenHeight := 480; + gWinSizeX := 640; + gWinSizeY := 480; gBPP := 32; gFullScreen := False; gWinMaximized := False; gVSync := True; gTextureFilter := True; glLegacyNPOT := False; - e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight)); + gScreenWidth := gWinSizeX; + gScreenHeight := gWinSizeY; + gRC_Width := gWinSizeX; + gRC_Height := gWinSizeY; + gRC_FullScreen := gFullScreen; + gRC_Maximized := gWinMaximized; + e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gWinSizeX) + ' h = ' + IntToStr(gWinSizeY)); g_Console_ResetBinds; end; {$ENDIF} @@ -252,12 +270,13 @@ begin gShowMessages := True; gRevertPlayers := False; gChatBubble := 4; - gSFSDebug := False; - gSFSFastMode := False; + wadoptDebug := False; + wadoptFast := False; e_FastScreenshots := True; gDefaultMegawadStart := DF_Default_Megawad_Start; gBerserkAutoswitch := True; g_dbg_scale := 1.0; + gSaveStats := False; gAskLanguage := True; gLanguage := LANGUAGE_ENGLISH; @@ -274,6 +293,9 @@ begin gcWeaponStay := False; gcMonsters := False; gcBotsVS := 'Everybody'; + gcDeathmatchKeys := True; + gcRespawnItems := True; + gcSpawnInvul := 0; (* section GameplayNetwork *) gnMap := ''; @@ -287,6 +309,9 @@ begin gnWeaponStay := False; gnMonsters := False; gnBotsVS := 'Everybody'; + gnDeathmatchKeys := True; + gnRespawnItems := True; + gnSpawnInvul := 0; (* section MasterServer *) NetSlistIP := 'mpms.doom2d.org'; @@ -316,7 +341,6 @@ end; procedure g_Options_Read(FileName: String); var - i: Integer; config: TConfig; section: String; @@ -390,36 +414,6 @@ begin Team := TEAM_RED; end; - section := 'Game'; - ReadInteger(i, 'MaxParticles', 0, 50000); g_GFX_SetMax(i); - ReadInteger(i, 'MaxShells', 0, 600); g_Shells_SetMax(i); - ReadInteger(i, 'MaxGibs', 0, 500); g_Gibs_SetMax(i); - ReadInteger(i, 'MaxCorpses', 0, 100); g_Corpses_SetMax(i); - ReadInteger(i, 'GibsCount'); - case i of - 0: gGibsCount := 0; - 1: gGibsCount := 8; - 2: gGibsCount := 16; - 3: gGibsCount := 32; - else gGibsCount := 48; - end; - i := ITEM_RESPAWNTIME div 36; ReadInteger(i, 'ItemRespawnTime', 0); ITEM_RESPAWNTIME := i * 36; - ReadInteger(gBloodCount, 'BloodCount', 0, 4); - ReadBoolean(gAdvBlood, 'AdvancesBlood'); - ReadBoolean(gAdvCorpses, 'AdvancesCorpses'); - ReadBoolean(gAdvGibs, 'AdvancesGibs'); - ReadInteger(gFlash, 'Flash', 0, 2); - ReadBoolean(gDrawBackGround, 'BackGround'); - ReadBoolean(gShowMessages, 'Messages'); - ReadBoolean(gRevertPlayers, 'RevertPlayers'); - ReadInteger(gChatBubble, 'ChatBubble', 0, 4); - ReadBoolean(gSFSDebug, 'SFSDebug'); wadoptDebug := gSFSDebug; - ReadBoolean(gSFSFastMode, 'SFSFastMode'); wadoptFast := gSFSFastMode; - ReadBoolean(e_FastScreenshots, 'FastScreenshots'); - ReadString(gDefaultMegawadStart, 'DefaultMegawadStart'); - ReadBoolean(gBerserkAutoswitch, 'BerserkAutoswitching'); - i := Trunc(g_dbg_scale * 100); ReadInteger(i, 'Scale', 100); g_dbg_scale := i / 100; - section := 'GameplayCustom'; ReadString(gcMap, 'Map'); ReadString(gcGameMode, 'GameMode'); @@ -432,6 +426,9 @@ begin ReadBoolean(gcWeaponStay, 'WeaponStay'); ReadBoolean(gcMonsters, 'Monsters'); ReadString(gcBotsVS, 'BotsVS'); + ReadBoolean(gcDeathmatchKeys, 'DeathmatchKeys'); + ReadBoolean(gcRespawnItems, 'RespawnItems'); + ReadInteger(gcSpawnInvul, 'SpawnInvul'); with gGameSettings do begin @@ -459,6 +456,10 @@ begin Options := Options or GAME_OPTION_BOTVSPLAYER; if gcBotsVS = 'Monsters' then Options := Options or GAME_OPTION_BOTVSMONSTER; + if gcDeathmatchKeys then + Options := Options or GAME_OPTION_DMKEYS; + if gcRespawnItems then + Options := Options or GAME_OPTION_RESPAWNITEMS; end; section := 'GameplayNetwork'; @@ -473,6 +474,9 @@ begin ReadBoolean(gnWeaponStay, 'WeaponStay'); ReadBoolean(gnMonsters, 'Monsters'); ReadString(gnBotsVS, 'BotsVS'); + ReadBoolean(gnDeathmatchKeys, 'DeathmatchKeys'); + ReadBoolean(gnRespawnItems, 'RespawnItems'); + ReadInteger(gnSpawnInvul, 'SpawnInvul'); section := 'MasterServer'; ReadString(NetSlistIP, 'IP'); @@ -532,36 +536,6 @@ begin WriteInt('Player2', 'team', Team); end; - with config do - case gGibsCount of - 0: config.WriteInt('Game', 'GibsCount', 0); - 8: config.WriteInt('Game', 'GibsCount', 1); - 16: config.WriteInt('Game', 'GibsCount', 2); - 32: config.WriteInt('Game', 'GibsCount', 3); - else config.WriteInt('Game', 'GibsCount', 4); - end; - - config.WriteInt('Game', 'ItemRespawnTime', ITEM_RESPAWNTIME div 36); - config.WriteInt('Game', 'MaxParticles', g_GFX_GetMax()); - config.WriteInt('Game', 'MaxShells', g_Shells_GetMax()); - config.WriteInt('Game', 'MaxGibs', g_Gibs_GetMax()); - config.WriteInt('Game', 'MaxCorpses', g_Corpses_GetMax()); - config.WriteInt('Game', 'BloodCount', gBloodCount); - config.WriteBool('Game', 'AdvancesBlood', gAdvBlood); - config.WriteBool('Game', 'AdvancesCorpses', gAdvCorpses); - config.WriteBool('Game', 'AdvancesGibs', gAdvGibs); - config.WriteInt('Game', 'Flash', gFlash); - config.WriteBool('Game', 'BackGround', gDrawBackGround); - config.WriteBool('Game', 'Messages', gShowMessages); - config.WriteBool('Game', 'RevertPlayers', gRevertPlayers); - config.WriteInt('Game', 'ChatBubble', gChatBubble); - config.WriteBool('Game', 'SFSDebug', gSFSDebug); - config.WriteBool('Game', 'SFSFastMode', gSFSFastMode); - config.WriteBool('Game', 'FastScreenshots', e_FastScreenshots); - config.WriteStr('Game', 'DefaultMegawadStart', gDefaultMegawadStart); - config.WriteBool('Game', 'BerserkAutoswitching', gBerserkAutoswitch); - config.WriteInt('Game', 'Scale', Round(g_dbg_scale * 100)); - config.WriteStr ('GameplayCustom', 'Map', gcMap); config.WriteStr ('GameplayCustom', 'GameMode', gcGameMode); config.WriteInt ('GameplayCustom', 'TimeLimit', gcTimeLimit); @@ -573,6 +547,9 @@ begin config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay); config.WriteBool('GameplayCustom', 'Monsters', gcMonsters); config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS); + config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys); + config.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems); + config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul); config.WriteStr ('GameplayNetwork', 'Map', gnMap); config.WriteStr ('GameplayNetwork', 'GameMode', gnGameMode); @@ -585,6 +562,9 @@ begin config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay); config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters); config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS); + config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys); + config.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems); + config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul); config.WriteStr('MasterServer', 'IP', NetSlistIP); config.WriteInt('MasterServer', 'Port', NetSlistPort); @@ -631,6 +611,9 @@ begin config.WriteBool('GameplayCustom', 'WeaponStay', gcWeaponStay); config.WriteBool('GameplayCustom', 'Monsters', gcMonsters); config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS); + config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys); + config.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems); + config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul); config.SaveFile(FileName); config.Free(); @@ -655,6 +638,9 @@ begin config.WriteBool('GameplayNetwork', 'WeaponStay', gnWeaponStay); config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters); config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS); + config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys); + config.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems); + config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul); config.SaveFile(FileName); config.Free(); @@ -695,7 +681,7 @@ begin end; procedure g_Options_Commands (p: SSArray); - var cmd: AnsiString; + var cmd: AnsiString; i: Integer; begin cmd := LowerCase(p[0]); case cmd of @@ -705,7 +691,7 @@ begin gRC_Width := Max(1, gRC_Width); gRC_Height := Max(1, gRC_Height); gBPP := Max(1, gBPP); - if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen) = True then + if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen, gRC_Maximized) = True then e_LogWriteln('resolution changed') else e_LogWriteln('resolution not changed') @@ -735,7 +721,84 @@ begin end; g_Language_Set(gLanguage) end - end + else + begin + e_LogWritefln('usage: %s ', [cmd]) + end + end; + 'g_max_particles': + begin + if Length(p) = 2 then + begin + i := Max(0, StrToInt(p[1])); + g_GFX_SetMax(i) + end + else if Length(p) = 1 then + begin + e_LogWritefln('%s', [g_GFX_GetMax()]) + end + else + begin + e_LogWritefln('usage: %s ', [cmd]) + end + end; + 'g_max_shells': + begin + if Length(p) = 2 then + begin + i := Max(0, StrToInt(p[1])); + g_Shells_SetMax(i) + end + else if Length(p) = 1 then + begin + e_LogWritefln('%s', [g_Shells_GetMax()]) + end + else + begin + e_LogWritefln('usage: %s ', [cmd]) + end + end; + 'g_max_gibs': + begin + if Length(p) = 2 then + begin + i := Max(0, StrToInt(p[1])); + g_Gibs_SetMax(i) + end + else if Length(p) = 1 then + begin + e_LogWritefln('%s', [g_Gibs_GetMax()]) + end + else + begin + e_LogWritefln('usage: %s ', [cmd]) + end + end; + 'g_max_corpses': + begin + if Length(p) = 2 then + begin + i := Max(0, StrToInt(p[1])); + g_Corpses_SetMax(i) + end + else if Length(p) = 1 then + begin + e_LogWritefln('%s', [g_Corpses_GetMax()]) + end + else + begin + e_LogWritefln('usage: %s ', [cmd]) + end + end; + 'g_item_respawn_time': + begin + if Length(p) = 2 then + ITEM_RESPAWNTIME := Max(0, StrToInt(p[1])) * 36 + else if Length(p) = 1 then + e_LogWritefln('%s', [ITEM_RESPAWNTIME div 36]) + else + e_LogWritefln('usage: %s ', [cmd]) + end; end; end; @@ -752,6 +815,7 @@ initialization conRegVar('r_vsync', @gVSync, '', ''); conRegVar('r_texfilter', @gTextureFilter, '', ''); conRegVar('r_npot', @glNPOTOverride, '', ''); + conRegVar('r_fbo', @glRenderToFBO, '', ''); (* Sound *) conRegVar('s_nosound', @gNoSound, '', ''); @@ -766,4 +830,22 @@ initialization conRegVar('sdl_mixer_samplerate', @gsSDLSampleRate, '', ''); conRegVar('sdl_mixer_buffersize', @gsSDLBufferSize, '', ''); {$ENDIF} + + (* Game *) + conRegVar('g_gibs_count', @gGibsCount, '', ''); + conRegVar('g_blood_count', @gBloodCount, '', ''); + conRegVar('g_adv_blood', @gAdvBlood, '', ''); + conRegVar('g_adv_corpses', @gAdvCorpses, '', ''); + conRegVar('g_adv_gibs', @gAdvGibs, '', ''); + conRegVar('r_flash', @gFlash, '', ''); + conRegVar('r_background', @gDrawBackGround, '', ''); + conRegVar('g_show_messages', @gShowMessages, '', ''); + conRegVar('r_revert_players', @gRevertPlayers, '', ''); + conRegVar('r_chat_bubble', @gChatBubble, '', ''); + conRegVar('sfs_debug', @wadoptDebug, '', ''); + conRegVar('sfs_fastmode', @wadoptFast, '', ''); + conRegVar('g_fast_screenshots', @e_FastScreenshots, '', ''); + conRegVar('g_default_megawad', @gDefaultMegawadStart, '', ''); + conRegVar('g_save_stats', @gSaveStats, '', ''); + conRegVar('g_screenshot_stats', @gScreenshotStats, '', ''); end.