diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 47239783b94865e4625d9580479e87d3488c8f68..94b65318a091c51e78dfa8f2fcfc268c489a8aa3 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
LAST_ACTION = ACTION_WEAPPREV;
procedure g_Console_Init;
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);
procedure g_Console_Update;
procedure g_Console_Draw (MessagesOnly: Boolean = False);
procedure g_Console_Char (C: AnsiChar);
implementation
uses
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;
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;
type
PCommand = ^TCommand;
begin
if (Length(p) <> 2) then
begin
begin
if (Length(p) <> 2) then
begin
- conwritefln('%s %s', [me.cmd, PAnsiString(me.ptr)^]);
+ conwritefln('%s %s', [me.cmd, QuoteStr(PAnsiString(me.ptr)^)]);
end
else
begin
end
else
begin
begin
// exec <filename>
if Length(p) = 2 then
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;
else
g_Console_Add('exec <script file>');
end;
begin
// writeconfig <filename>
if Length(p) = 2 then
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
else
- g_Console_Add('writeconfig <file>');
+ begin
+ g_Console_Add('writeconfig <file>')
+ end
end;
if (cmd = 'ver') or (cmd = 'version') then
end;
if (cmd = 'ver') or (cmd = 'version') then
end
end;
end
end;
-procedure g_Console_Init();
- var
- a: Integer;
+procedure g_Console_SysInit;
+ var a: Integer;
begin
begin
- g_Texture_CreateWAD(ID, GameWAD+':TEXTURES\CONSOLE');
Cons_Y := -Floor(gScreenHeight * ConsoleHeight);
gConsoleShow := False;
gChatShow := False;
Cons_Y := -Floor(gScreenHeight * ConsoleHeight);
gConsoleShow := False;
gChatShow := False;
AddCommand('segfault', segfault, 'make segfault');
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);
AddCommand('bind', BindCommands);
AddCommand('bindlist', BindCommands);
AddCommand('unbind', BindCommands);
AddCommand('g_friendlyfire', GameCVars);
AddCommand('g_weaponstay', GameCVars);
AddCommand('g_allow_exit', GameCVars);
AddCommand('g_friendlyfire', GameCVars);
AddCommand('g_weaponstay', GameCVars);
AddCommand('g_allow_exit', GameCVars);
+ AddCommand('g_dm_keys', GameCVars);
AddCommand('g_allow_monsters', GameCVars);
AddCommand('g_bot_vsmonsters', GameCVars);
AddCommand('g_bot_vsplayers', GameCVars);
AddCommand('g_allow_monsters', GameCVars);
AddCommand('g_bot_vsmonsters', GameCVars);
AddCommand('g_bot_vsplayers', GameCVars);
AddCommand('g_timelimit', GameCVars);
AddCommand('g_maxlives', GameCVars);
AddCommand('g_warmuptime', GameCVars);
AddCommand('g_timelimit', GameCVars);
AddCommand('g_maxlives', GameCVars);
AddCommand('g_warmuptime', GameCVars);
+ AddCommand('g_spawn_invul', GameCVars);
AddCommand('net_interp', GameCVars);
AddCommand('net_forceplayerupdate', GameCVars);
AddCommand('net_predictself', GameCVars);
AddCommand('net_interp', GameCVars);
AddCommand('net_forceplayerupdate', GameCVars);
AddCommand('net_predictself', GameCVars);
AddCommand('reconnect', GameCommands);
AddCommand('say', GameCommands);
AddCommand('tell', GameCommands);
AddCommand('reconnect', GameCommands);
AddCommand('say', GameCommands);
AddCommand('tell', GameCommands);
+ AddCommand('centerprint', GameCommands);
AddCommand('overtime', GameCommands);
AddCommand('rcon_password', GameCommands);
AddCommand('rcon', GameCommands);
AddCommand('overtime', GameCommands);
AddCommand('rcon_password', GameCommands);
AddCommand('rcon', GameCommands);
WhitelistCommand('restart');
WhitelistCommand('kick');
WhitelistCommand('ban');
WhitelistCommand('restart');
WhitelistCommand('kick');
WhitelistCommand('ban');
+ WhitelistCommand('centerprint');
WhitelistCommand('addbot');
WhitelistCommand('bot_add');
WhitelistCommand('addbot');
WhitelistCommand('bot_add');
WhitelistCommand('g_allow_monsters');
WhitelistCommand('g_scorelimit');
WhitelistCommand('g_timelimit');
WhitelistCommand('g_allow_monsters');
WhitelistCommand('g_scorelimit');
WhitelistCommand('g_timelimit');
+ WhitelistCommand('g_dm_keys');
+ WhitelistCommand('g_spawn_invul');
+ WhitelistCommand('g_warmuptime');
g_Console_ResetBinds;
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;
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;
g_Console_Add(Format(_lc[I_CONSOLE_WELCOME], [GAME_VERSION]));
g_Console_Add('');
end;
IK_END, IK_KPEND:
CPos := Length(Line) + 1;
IK_A..IK_Z, IK_SPACE, IK_SHIFT, IK_RSHIFT, IK_CAPSLOCK, IK_LBRACKET, IK_RBRACKET,
IK_END, IK_KPEND:
CPos := Length(Line) + 1;
IK_A..IK_Z, IK_SPACE, IK_SHIFT, IK_RSHIFT, IK_CAPSLOCK, IK_LBRACKET, IK_RBRACKET,
- IK_SEMICOLON, IK_QUOTE, IK_BACKSLASH, IK_SLASH, IK_COMMA, IK_DOT, IK_EQUALS,
+ IK_SEMICOLON, IK_QUOTE, IK_BACKSLASH, IK_SLASH, IK_COMMA, IK_DOT, (*IK_EQUALS,*)
IK_0, IK_1, IK_2, IK_3, IK_4, IK_5, IK_6, IK_7, IK_8, IK_9, IK_MINUS, IK_EQUALS:
(* see TEXTINPUT event *)
end
IK_0, IK_1, IK_2, IK_3, IK_4, IK_5, IK_6, IK_7, IK_8, IK_9, IK_MINUS, IK_EQUALS:
(* see TEXTINPUT event *)
end
procedure g_Console_ReadConfig (filename: String);
var f: TextFile; s: AnsiString; i, len: Integer;
begin
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
begin
+ e_LogWritefln('g_Console_ReadConfig (2) "%s"', [filename]);
AssignFile(f, filename);
Reset(f);
while not EOF(f) do
AssignFile(f, filename);
Reset(f);
while not EOF(f) do
begin
AssignFile(f, filename);
Rewrite(f);
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
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;
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
for i := 0 to High(commands) do
begin
if not commands[i].cheat then
begin
WriteLn(f, commands[i].cmd, ' ', PVarSingle(commands[i].ptr).val^:0:6)
end
begin
WriteLn(f, commands[i].cmd, ' ', PVarSingle(commands[i].ptr).val^:0:6)
end
+ else if @commands[i].procEx = @strVarHandler then
+ begin
+ if Length(PAnsiString(commands[i].ptr)^) = 0 then
+ WriteLn(f, commands[i].cmd, ' ""')
+ else
+ WriteLn(f, commands[i].cmd, ' ', QuoteStr(PAnsiString(commands[i].ptr)^))
+ end
end
end;
end
end;
+ WriteLn(f, 'r_reset');
CloseFile(f)
end;
procedure g_Console_WriteGameConfig;
CloseFile(f)
end;
procedure g_Console_WriteGameConfig;
+ var s: AnsiString;
begin
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;
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');
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;
{$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.
end.