| 47 | */ |
| 48 | // TODO move to client |
| 49 | public final class Console extends Globals { |
| 50 | |
| 51 | static Command ToggleConsole_f = (List<String> args) -> { |
| 52 | SCR.EndLoadingPlaque(); // get rid of loading plaque |
| 53 | |
| 54 | if (ClientGlobals.cl.attractloop) { |
| 55 | Cbuf.AddText("killserver\n"); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | if (ClientGlobals.cls.state == Defines.ca_disconnected) { |
| 60 | // start the demo loop again |
| 61 | // todo: intro |
| 62 | //Cbuf.AddText("d1\n"); |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | Key.ClearTyping(); |
| 67 | Console.ClearNotify(); |
| 68 | |
| 69 | if (ClientGlobals.cls.key_dest == Defines.key_console) { |
| 70 | Menu.ForceMenuOff(); |
| 71 | Cvar.getInstance().Set("paused", "0"); |
| 72 | } else { |
| 73 | Menu.ForceMenuOff(); |
| 74 | ClientGlobals.cls.key_dest = Defines.key_console; |
| 75 | |
| 76 | if (Cvar.getInstance().VariableValue("maxclients") == 1 |
| 77 | && Globals.server_state != ServerStates.SS_DEAD) |
| 78 | Cvar.getInstance().Set("paused", "1"); |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | private static Command Clear_f = (List<String> args) -> Arrays.fill(ClientGlobals.con.text, (byte) ' '); |
| 83 | |
| 84 | /** |
| 85 | * Dump console contents to file (file name as a 1st argument) |
| 86 | */ |
| 87 | private static Command Dump_f = (List<String> args) -> { |
| 88 | |
| 89 | int l, x; |
| 90 | int line; |
| 91 | RandomAccessFile f; |
| 92 | byte[] buffer = new byte[1024]; |
| 93 | String name; |
| 94 | |
| 95 | if (args.size() != 2) { |
| 96 | Com.Printf("usage: condump <filename>\n"); |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | // Com_sprintf (name, sizeof(name), "%s/%s.txt", FS_Gamedir(), |
| 101 | // Cmd_Argv(1)); |
| 102 | name = FS.getWriteDir() + "/" + args.get(1) + ".txt"; |
| 103 | |
| 104 | Com.Printf("Dumped console text to " + name + ".\n"); |
| 105 | FS.CreatePath(name); |
| 106 | f = Lib.fopen(name, "rw"); |
nothing calls this directly
no test coverage detected