示例#1
0
static void HandleDebugJoystickPress(fakeAscii_t button)
{
	// Super hackalicious crap used below. Please remove this at some point.
	static int curSaberSet = 0;
	static int curPlayerSet = 0;
	static short dpadmode = 0;
	static short buttonmode = 0;
	static short thumbmode = 0;

	switch(button) {
	case A_JOY13: // Right pad up
		Cbuf_ExecuteText(EXEC_APPEND, "give all\n");
		break;
	case A_JOY16: // Right pad left
		Cbuf_ExecuteText(EXEC_APPEND, "viewpos\n");
		break;
	case A_JOY14: // Right pad right
		Cbuf_ExecuteText(EXEC_APPEND, "noclip\n");
		break;
	case A_JOY15: // Right pad down
		Cbuf_ExecuteText(EXEC_APPEND, "god\n");
		break;
	case A_JOY4: // Start
		Cvar_SetValue("m_pitch", -Cvar_VariableValue("m_pitch"));
		break;
	case A_JOY1: // back
		Cvar_SetValue("cl_autolevel", !Cvar_VariableIntegerValue("cl_autolevel"));
		break;
	case A_JOY2: // Left thumbstick
		extern void Z_CompactStats(void);
		Z_CompactStats();
		break;
	case A_JOY12: // Upper right trigger
		Cbuf_ExecuteText(EXEC_APPEND, "load dbg-game\n");
		break;
	case A_JOY8: // Left pad left
		thumbmode++;
		if(thumbmode == 4)
		{
			thumbmode = 0;
		}
		IN_SetThumbStickConfig(thumbmode);
		break;
	case A_JOY6: // Left pad right
		dpadmode++;
		if(dpadmode == 4)
		{
			dpadmode = 0;
		}
		IN_SetDpadConfig(0);
		break;
	case A_JOY5: // Left pad up
		buttonmode++;
		if(buttonmode == 4)
		{
			buttonmode = 0;
		}
		IN_SetButtonConfig(buttonmode);
		break;
	case A_JOY7: // Left pad down
//		Cbuf_ExecuteText(EXEC_APPEND, "vid_restart\n");
		extern void Sys_Reboot(const char *reason);
		Sys_Reboot("multiplayer");
		break;
	case A_JOY11: // Upper left trigger
		Cbuf_ExecuteText(EXEC_APPEND, "save dbg-game\n");
		break; 
	case A_JOY9: // White button
		// Hacky. Really hacky. No, hackier than that.
		curSaberSet = (curSaberSet + 1) % 3;	// Number of xsaber strings in config file
		Cbuf_ExecuteText(EXEC_APPEND, va("vstr xsaber%d\n", curSaberSet));
		break;
	case A_JOY10: // Black button
		curPlayerSet = (curPlayerSet + 1) % 6;	// Number of xplayer strings in config file
		Cbuf_ExecuteText(EXEC_APPEND, va("vstr xplayer%d\n", curPlayerSet));
		break;
	}
}
static void HandleDebugJoystickPress(fakeAscii_t button)
{
	// Super hackalicious crap used below. Please remove this at some point.
	static int curSaberSet = 0;
	static int curPlayerSet = 0;
	static short dpadmode = 0;
	static short buttonmode = 0;
	static short thumbmode = 0;

	switch(button) {
	case A_JOY13: // Right pad up
		Cbuf_ExecuteText(EXEC_APPEND, "give all\n");
		break;
	case A_JOY16: // Right pad left
		Cbuf_ExecuteText(EXEC_APPEND, "viewpos\n");
		break;
	case A_JOY14: // Right pad right
		Cbuf_ExecuteText(EXEC_APPEND, "noclip\n");
		break;
	case A_JOY15: // Right pad down
		Cbuf_ExecuteText(EXEC_APPEND, "god\n");
		break;
	case A_JOY4: // Start
		Cvar_SetValue("m_pitch", -Cvar_VariableValue("m_pitch"));
		break;
	case A_JOY1: // back
		Cvar_SetValue("cl_autolevel", !Cvar_VariableIntegerValue("cl_autolevel"));
		break;
	case A_JOY2: // Left thumbstick
		extern void Z_CompactStats(void);
		Z_CompactStats();
		break;
	case A_JOY12: // Upper right trigger
		Cbuf_ExecuteText(EXEC_APPEND, "load current\n");
		break;
	case A_JOY8: // Left pad left
		thumbmode++;
		if(thumbmode == 4)
		{
			thumbmode = 0;
		}
		IN_SetThumbStickConfig(thumbmode);
		break;
	case A_JOY6: // Left pad right
		dpadmode++;
		if(dpadmode == 4)
		{
			dpadmode = 0;
		}
		IN_SetDpadConfig(0);
		break;
	case A_JOY5: // Left pad up
		buttonmode++;
		if(buttonmode == 4)
		{
			buttonmode = 0;
		}
		IN_SetButtonConfig(buttonmode);
		break;
	case A_JOY7: // Left pad down
		Cbuf_ExecuteText(EXEC_APPEND, "vid_restart\n");
		break;
	case A_JOY11: // Upper left trigger
		// VVFIXME : This is totally bootleg. The above loads current, because the
		// current SG system writes out to "current" and then uses FS to move the file
		// to the name that we specify. Which we don't support. But we can't write to
		// "current" as the SG system doesn't allow it. So we write to some arbitary
		// name, and our game ends up in current.
		Cbuf_ExecuteText(EXEC_APPEND, "save foo\n");
#if 0	// VVFIXME
		extern cvar_t *cl_safezonemask;
		if(cl_safezonemask) {
			if(cl_safezonemask->integer) {
				Cbuf_ExecuteText(EXEC_APPEND, "safezonemask 0\n");
			} else {
				Cbuf_ExecuteText(EXEC_APPEND, "safezonemask 1\n");
			}
		}
#endif
		break;
	case A_JOY9: // White button
		// Hacky. Really hacky. No, hackier than that.
		curSaberSet = (curSaberSet + 1) % 3;	// Number of xsaber strings in config file
		Cbuf_ExecuteText(EXEC_APPEND, va("vstr xsaber%d\n", curSaberSet));
		break;
	case A_JOY10: // Black button
		curPlayerSet = (curPlayerSet + 1) % 6;	// Number of xplayer strings in config file
		Cbuf_ExecuteText(EXEC_APPEND, va("vstr xplayer%d\n", curPlayerSet));
		break;
	}
}