diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 5b9e95199bea42ab4f9f31c769c17cd885b66a33..c9cc11e9859756a3b28e3f2788ffce0aaa5c5d0a 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
end;
procedure g_Console_Init;
end;
procedure g_Console_Init;
-procedure g_Console_SysInit;
+procedure g_Console_Initialize;
+procedure g_Console_Finalize;
procedure g_Console_Update;
procedure g_Console_Char (C: AnsiChar);
procedure g_Console_Control (K: Word);
procedure g_Console_Update;
procedure g_Console_Char (C: AnsiChar);
procedure g_Console_Control (K: Word);
implementation
uses
implementation
uses
- g_textures, 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_weapons,
+ {$IFDEF ENABLE_MENU}
+ g_gui, g_menu,
+ {$ENDIF}
+ {$IFDEF ENABLE_TOUCH}
+ g_system,
+ {$ENDIF}
+ {$IFDEF ENABLE_GFX}
+ g_gfx,
+ {$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
+ {$IFDEF ENABLE_SHELLS}
+ g_shells,
+ {$ENDIF}
+ {$IFDEF ENABLE_CORPSES}
+ g_corpses,
+ {$ENDIF}
+ g_textures, e_input, g_game, g_player, g_items,
+ SysUtils, g_basic, g_options, Math, e_res,
+ g_language, g_net, g_netmsg, e_log, conbuf, g_weapons,
Keyboard;
const
Keyboard;
const
- autoexecScript = 'autoexec.cfg';
configComment = 'generated by doom2d, do not modify';
type
configComment = 'generated by doom2d, do not modify';
type
rep: Boolean;
down, up: SSArray;
end;
rep: Boolean;
down, up: SSArray;
end;
+
menu_toggled: BOOLEAN; (* hack for menu controls *)
ConsoleStdIn: Boolean;
menu_toggled: BOOLEAN; (* hack for menu controls *)
ConsoleStdIn: Boolean;
gChatShow := False;
gConsoleShow := not gConsoleShow;
InputReady := False;
gChatShow := False;
gConsoleShow := not gConsoleShow;
InputReady := False;
- g_Touch_ShowKeyboard(gConsoleShow or gChatShow);
+ {$IFDEF ENABLE_TOUCH}
+ sys_ShowKeyboard(gConsoleShow or gChatShow);
+ {$ENDIF}
end;
procedure g_Console_Chat_Switch (Team: Boolean = False);
end;
procedure g_Console_Chat_Switch (Team: Boolean = False);
InputReady := False;
Line := '';
CPos := 1;
InputReady := False;
Line := '';
CPos := 1;
- g_Touch_ShowKeyboard(gConsoleShow or gChatShow);
+ {$IFDEF ENABLE_TOUCH}
+ sys_ShowKeyboard(gConsoleShow or gChatShow);
+ {$ENDIF}
end;
// poor man's floating literal parser; i'm sorry, but `StrToFloat()` sux cocks
end;
// poor man's floating literal parser; i'm sorry, but `StrToFloat()` sux cocks
'unbindall':
for i := 0 to e_MaxInputKeys - 1 do
g_Console_BindKey(i, '');
'unbindall':
for i := 0 to e_MaxInputKeys - 1 do
g_Console_BindKey(i, '');
+{$IFDEF ENABLE_TOUCH}
'showkeyboard':
'showkeyboard':
- g_Touch_ShowKeyboard(True);
+ sys_ShowKeyboard(True);
'hidekeyboard':
'hidekeyboard':
- g_Touch_ShowKeyboard(False);
+ sys_ShowKeyboard(False);
+{$ENDIF}
'togglemenu':
begin
if gConsoleShow then
'togglemenu':
begin
if gConsoleShow then
else if gChatShow then
g_Console_Chat_Switch
else
else if gChatShow then
g_Console_Chat_Switch
else
+ begin
KeyPress(VK_ESCAPE);
KeyPress(VK_ESCAPE);
+ end;
menu_toggled := True
end;
'toggleconsole':
menu_toggled := True
end;
'toggleconsole':
end;
end;
end;
end;
-procedure g_Console_SysInit;
+procedure g_Console_Initialize;
var a: Integer;
begin
gConsoleShow := False;
var a: Integer;
begin
gConsoleShow := False;
g_Console_ResetBinds;
g_Console_ReadConfig(gConfigScript);
g_Console_ResetBinds;
g_Console_ReadConfig(gConfigScript);
- g_Console_ReadConfig(autoexecScript);
+// g_Console_ReadConfig(autoexecScript);
+ g_Console_ReadConfig('autoexec.cfg');
+
gParsingBinds := False;
end;
gParsingBinds := False;
end;
+procedure g_Console_Finalize;
+begin
+
+end;
+
procedure g_Console_Init;
begin
g_Console_Add(Format(_lc[I_CONSOLE_WELCOME], [GAME_VERSION]));
procedure g_Console_Init;
begin
g_Console_Add(Format(_lc[I_CONSOLE_WELCOME], [GAME_VERSION]));
//SetLength(ConsoleHistory, Length(ConsoleHistory)+1);
//ConsoleHistory[High(ConsoleHistory)] := L;
//SetLength(ConsoleHistory, Length(ConsoleHistory)+1);
//ConsoleHistory[High(ConsoleHistory)] := L;
-
- (*
-{$IFDEF HEADLESS}
- e_WriteLog('CON: ' + L, MSG_NOTIFY);
-{$ENDIF}
- *)
end;
end;
procedure g_Console_BindKey (key: Integer; down: AnsiString; up: AnsiString = ''; rep: Boolean = False);
begin
procedure g_Console_BindKey (key: Integer; down: AnsiString; up: AnsiString = ''; rep: Boolean = False);
begin
- //e_LogWritefln('bind "%s" "%s" <%s>', [LowerCase(e_KeyNames[key]), cmd, key]);
+ // e_LogWritefln('bind "%s" "%s" "%s" <%s>', [LowerCase(e_KeyNames[key]), down, up, key]);
ASSERT(key >= 0);
ASSERT(key < e_MaxInputKeys);
if key > 0 then
ASSERT(key >= 0);
ASSERT(key < e_MaxInputKeys);
if key > 0 then
end;
function BindsAllowed (key: Integer): Boolean;
end;
function BindsAllowed (key: Integer): Boolean;
+ var grab, active: Boolean;
begin
Result := False;
begin
Result := False;
- if (not g_GUIGrabInput) and (key >= 0) and (key < e_MaxInputKeys) and ((gInputBinds[key].down <> nil) or (gInputBinds[key].up <> nil)) then
+ {$IFDEF DISABLE_MENU}
+ grab := False;
+ active := False;
+ {$ELSE}
+ grab := g_GUIGrabInput;
+ active := g_ActiveWindow <> nil;
+ {$ENDIF}
+ if (not grab) and (key >= 0) and (key < e_MaxInputKeys) and ((gInputBinds[key].down <> nil) or (gInputBinds[key].up <> nil)) then
begin
if gChatShow then
Result := g_Console_MatchBind(key, 'togglemenu') or
g_Console_MatchBind(key, 'showkeyboard') or
g_Console_MatchBind(key, 'hidekeyboard')
begin
if gChatShow then
Result := g_Console_MatchBind(key, 'togglemenu') or
g_Console_MatchBind(key, 'showkeyboard') or
g_Console_MatchBind(key, 'hidekeyboard')
- else if gConsoleShow or (g_ActiveWindow <> nil) or (gGameSettings.GameType = GT_NONE) then
+ else if gConsoleShow or active or (gGameSettings.GameType = GT_NONE) then
Result := g_Console_MatchBind(key, 'togglemenu') or
g_Console_MatchBind(key, 'toggleconsole') or
g_Console_MatchBind(key, 'showkeyboard') or
Result := g_Console_MatchBind(key, 'togglemenu') or
g_Console_MatchBind(key, 'toggleconsole') or
g_Console_MatchBind(key, 'showkeyboard') or
end;
procedure g_Console_ProcessBindRepeat (key: Integer);
end;
procedure g_Console_ProcessBindRepeat (key: Integer);
- var i: Integer;
+ var i: Integer; active: Boolean;
begin
begin
- if gConsoleShow or gChatShow or (g_ActiveWindow <> nil) then
+ {$IFDEF DISABLE_MENU}
+ active := False;
+ {$ELSE}
+ active := g_ActiveWindow <> nil;
+ {$ENDIF}
+ if gConsoleShow or gChatShow or active then
begin
KeyPress(key); // key repeat in menus and shit
Exit;
begin
KeyPress(key); // key repeat in menus and shit
Exit;
end;
begin
end;
begin
+ // e_LogWritefln('g_Console_WriteConfig: %s', [filename]);
AssignFile(f, filename);
Rewrite(f);
WriteLn(f, '// ' + configComment);
AssignFile(f, filename);
Rewrite(f);
WriteLn(f, '// ' + configComment);
WriteLn(f, 'sv_public ', IfThen(NetUseMaster, 1, 0));
// game settings
WriteLn(f, 'sv_public ', IfThen(NetUseMaster, 1, 0));
// game settings
- 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());
+ {$IFDEF ENABLE_GFX}
+ WriteLn(f, 'g_max_particles ', g_GFX_GetMax());
+ {$ENDIF}
+ {$IFDEF ENABLE_SHELLS}
+ WriteLn(f, 'g_max_shells ', g_Shells_GetMax());
+ {$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ WriteLn(f, 'g_max_gibs ', g_Gibs_GetMax());
+ {$ENDIF}
+ {$IFDEF ENABLE_CORPSES}
+ WriteLn(f, 'g_max_corpses ', g_Corpses_GetMax());
+ {$ENDIF}
WriteLn(f, 'g_force_model ', g_Force_Model_Get());
WriteLn(f, 'g_force_model_name ', g_Forced_Model_GetName());
WriteLn(f, 'sv_intertime ', gDefInterTime);
WriteLn(f, 'g_force_model ', g_Force_Model_Get());
WriteLn(f, 'g_force_model_name ', g_Forced_Model_GetName());
WriteLn(f, 'sv_intertime ', gDefInterTime);