diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 7caa3ba142386b5eac3b72d0a977f6d529218cc3..92e86c69bf220c9b4821515841f758d1e4023ab5 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
LAST_ACTION = ACTION_WEAPPREV;
procedure g_Console_Init;
+procedure g_Console_SysInit;
procedure g_Console_Update;
procedure g_Console_Draw (MessagesOnly: Boolean = False);
procedure g_Console_Char (C: AnsiChar);
implementation
uses
- g_textures, g_main, e_graphics, e_input, g_game,
- SysUtils, g_basic, g_options, Math, g_touch,
+ g_textures, g_main, e_graphics, e_input, g_game, g_gfx, g_player, g_items,
+ SysUtils, g_basic, g_options, Math, g_touch, e_res,
g_menu, g_gui, g_language, g_net, g_netmsg, e_log, conbuf;
+const
+ configScript = 'dfconfig.cfg';
+ autoexecScript = 'autoexec.cfg';
+ configComment = 'generated by doom2d, do not modify';
type
PCommand = ^TCommand;
begin
// exec <filename>
if Length(p) = 2 then
- g_Console_ReadConfig(GameDir + '/' + p[1])
+ g_Console_ReadConfig(p[1])
else
g_Console_Add('exec <script file>');
end;
begin
// writeconfig <filename>
if Length(p) = 2 then
- g_Console_WriteConfig(GameDir + '/' + p[1])
+ begin
+ s := e_GetWriteableDir(ConfigDirs);
+ g_Console_WriteConfig(e_CatPath(s, p[1]))
+ end
else
- g_Console_Add('writeconfig <file>');
+ begin
+ g_Console_Add('writeconfig <file>')
+ end
end;
if (cmd = 'ver') or (cmd = 'version') then
end
end;
-procedure g_Console_Init();
- var
- a: Integer;
+procedure g_Console_SysInit;
+ var a: Integer;
begin
- g_Texture_CreateWAD(ID, GameWAD+':TEXTURES\CONSOLE');
Cons_Y := -Floor(gScreenHeight * ConsoleHeight);
gConsoleShow := False;
gChatShow := False;
AddCommand('segfault', segfault, 'make segfault');
+ AddCommand('r_reset', g_Options_Commands);
+ AddCommand('g_language', g_Options_Commands);
+ AddCommand('g_max_particles', g_Options_Commands);
+ AddCommand('g_max_shells', g_Options_Commands);
+ AddCommand('g_max_gibs', g_Options_Commands);
+ AddCommand('g_max_corpses', g_Options_Commands);
+ AddCommand('g_item_respawn_time', g_Options_Commands);
+
AddCommand('bind', BindCommands);
AddCommand('bindlist', BindCommands);
AddCommand('unbind', BindCommands);
WhitelistCommand('g_timelimit');
g_Console_ResetBinds;
- g_Console_ReadConfig(GameDir + '/dfconfig.cfg');
- g_Console_ReadConfig(GameDir + '/autoexec.cfg');
+ g_Console_ReadConfig(configScript);
+ g_Console_ReadConfig(autoexecScript);
gParsingBinds := False;
+end;
+procedure g_Console_Init;
+begin
+ g_Texture_CreateWAD(ID, GameWAD+':TEXTURES\CONSOLE');
g_Console_Add(Format(_lc[I_CONSOLE_WELCOME], [GAME_VERSION]));
g_Console_Add('');
end;
procedure g_Console_ReadConfig (filename: String);
var f: TextFile; s: AnsiString; i, len: Integer;
begin
- if FileExists(filename) then
+ e_LogWritefln('g_Console_ReadConfig (1) "%s"', [filename]);
+ if e_FindResource(ConfigDirs, filename, false) = true then
begin
+ e_LogWritefln('g_Console_ReadConfig (2) "%s"', [filename]);
AssignFile(f, filename);
Reset(f);
while not EOF(f) do
begin
AssignFile(f, filename);
Rewrite(f);
- WriteLn(f, '// generated by doom2d, do not modify');
+ WriteLn(f, '// ' + configComment);
WriteLn(f, 'unbindall');
for i := 0 to e_MaxInputKeys - 1 do
if (Length(gInputBinds[i].down) > 0) or (Length(gInputBinds[i].up) > 0) then
Write(f, ' ', QuoteStr(GetCommandString(gInputBinds[i].up)));
WriteLn(f, '');
end;
+ if gAskLanguage then
+ WriteLn(f, 'g_language ask')
+ else
+ WriteLn(f, 'g_language ', gLanguage);
+ WriteLn(f, 'g_max_particles ', g_GFX_GetMax());
+ WriteLn(f, 'g_max_shells ', g_Shells_GetMax());
+ WriteLn(f, 'g_max_gibs ', g_Gibs_GetMax());
+ WriteLn(f, 'g_max_corpses ', g_Corpses_GetMax());
+ WriteLn(f, 'g_item_respawn_time ', ITEM_RESPAWNTIME div 36);
+ with gPlayer1Settings do
+ begin
+ WriteLn(f, 'p1_name ', QuoteStr(Name));
+ WriteLn(f, 'p1_color ', Color.R, ' ', Color.G, ' ', Color.B);
+ end;
+ with gPlayer2Settings do
+ begin
+ WriteLn(f, 'p2_name ', QuoteStr(Name));
+ WriteLn(f, 'p2_color ', Color.R, ' ', Color.G, ' ', Color.B);
+ end;
for i := 0 to High(commands) do
begin
if not commands[i].cheat then
end
end
end;
+ WriteLn(f, 'r_reset');
CloseFile(f)
end;
procedure g_Console_WriteGameConfig;
+ var s: AnsiString;
begin
- if gParsingBinds then
- Exit;
- g_Console_WriteConfig(GameDir + '/dfconfig.cfg');
+ if gParsingBinds = false then
+ begin
+ s := e_GetWriteableDir(ConfigDirs);
+ g_Console_WriteConfig(e_CatPath(s, configScript))
+ end
end;
-initialization
+procedure Init;
+ var i: Integer;
+begin
conRegVar('chat_at_top', @ChatTop, 'draw chat at top border', 'draw chat at top border');
conRegVar('console_height', @ConsoleHeight, 0.0, 1.0, 'set console size', 'set console size');
conRegVar('console_trans', @ConsoleTrans, 0.0, 1.0, 'set console transparency', 'set console transparency');
{$ENDIF}
ConsoleTrans := 0.1;
ConsoleStep := 0.07;
+ conRegVar('d_eres', @debug_e_res, '', '');
+ for i := 1 to e_MaxJoys do
+ conRegVar('joy' + IntToStr(i) + '_deadzone', @e_JoystickDeadzones[i - 1], '', '')
+end;
+
+initialization
+ Init
end.