First post, by emendelson
It occurred to me that it might be useful to be able to capture the mouse from the command-line, so that a batch or conf file could capture the mouse, start a game, and release the mouse afterward. I couldn't find any way to do this in the existing code, so I somehow managed to throw together a MOUSECAP command. I don't know anything about programming, so this is probably incompetent, and a real programmer could do it better, but it seems to work. Here's how to do it:
1. In shell.h, add to the list of commands:
void CMD_MOUSECAP(char * args);
2. In shell_cmds.cpp, add below the list of includes:
extern void GFX_CaptureMouse(void);
extern bool mouselocked;
3. Also in shell.cmds.cpp, in the cmd_list near the top, add:
{ "MOUSECAP", 0, &DOS_Shell::CMD_MOUSECAP, "SHELL_CMD_MOUSECAP_HELP"},
4. Also in shell.cmds.cpp, among the code for the actual commands, add:
void DOS_Shell::CMD_MOUSECAP(char * args) {
HELP("MOUSECAP");
GFX_CaptureMouse();
if (mouselocked)
WriteOut("Mouse captured.\n");
else
WriteOut("Mouse released.\n");
}
5. Finally, in shell.cpp, add among the help texts:
MSG_Add("SHELL_CMD_MOUSECAP_HELP","Toggle mouse capture.\n");
I hope someone else finds this useful.