attempt at cleaning up gamecontrol splitscreen shit
This commit is contained in:
1 parent
11f7ecba5f
commit
9bc010f670
9 files changed
+155
-194
No files matched your search
+3
-3
@@ -827,7 +827,7 @@ boolean CON_Responder(event_t *ev)
|
||||
// let go keyup events, don't eat them
|
||||
if (ev->type != ev_keydown && ev->type != ev_console)
|
||||
{
|
||||
if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1])
|
||||
if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1])
|
||||
consdown = false;
|
||||
return false;
|
||||
}
|
||||
@@ -845,7 +845,7 @@ boolean CON_Responder(event_t *ev)
|
||||
INT32 i;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1)
|
||||
if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -853,7 +853,7 @@ boolean CON_Responder(event_t *ev)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
||||
if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1])
|
||||
{
|
||||
if (consdown) // ignore repeat
|
||||
return true;
|
||||
|
||||
+2
-2
@@ -2281,13 +2281,13 @@ static void M_ConfirmConnect(event_t *ev)
|
||||
#ifndef NONET
|
||||
if (ev->type == ev_keydown)
|
||||
{
|
||||
if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[gc_accelerate][0] || ev->data1 == gamecontrol[gc_accelerate][1])
|
||||
if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[0][gc_accelerate][0] || ev->data1 == gamecontrol[0][gc_accelerate][1])
|
||||
{
|
||||
CL_ConfirmConnect();
|
||||
|
||||
M_ClearMenus(true);
|
||||
}
|
||||
else if (ev->data1 == 'n' || ev->data1 == KEY_ESCAPE|| ev->data1 == gamecontrol[gc_brake][0] || ev->data1 == gamecontrol[gc_brake][1])
|
||||
else if (ev->data1 == 'n' || ev->data1 == KEY_ESCAPE|| ev->data1 == gamecontrol[0][gc_brake][0] || ev->data1 == gamecontrol[0][gc_brake][1])
|
||||
{
|
||||
cl_mode = CL_ABORTED;
|
||||
M_ClearMenus(true);
|
||||
|
||||
+17
-15
@@ -1302,7 +1302,9 @@ static boolean G_LevelResponder(event_t *ev)
|
||||
{
|
||||
// allow spy mode changes even during the demo
|
||||
if (ev->type == ev_keydown
|
||||
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
|
||||
&& (ev->data1 == KEY_F12
|
||||
|| ev->data1 == gamecontrol[0][gc_viewpoint][0]
|
||||
|| ev->data1 == gamecontrol[0][gc_viewpoint][1]))
|
||||
{
|
||||
if (!demo.playback && (splitscreen || !netgame))
|
||||
displayplayers[0] = consoleplayer;
|
||||
@@ -1322,8 +1324,8 @@ static boolean G_LevelResponder(event_t *ev)
|
||||
{
|
||||
for (INT32 i = 1; i <= splitscreen; i++)
|
||||
{
|
||||
if (ev->data1 == gamecontrols[i][gc_viewpoint][0]
|
||||
|| ev->data1 == gamecontrols[i][gc_viewpoint][1])
|
||||
if (ev->data1 == gamecontrol[i][gc_viewpoint][0]
|
||||
|| ev->data1 == gamecontrol[i][gc_viewpoint][1])
|
||||
{
|
||||
G_AdjustView(i+1, 1, true);
|
||||
return true;
|
||||
@@ -1331,8 +1333,8 @@ static boolean G_LevelResponder(event_t *ev)
|
||||
}
|
||||
|
||||
// Allow pausing
|
||||
if (ev->data1 == gamecontrol[gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[gc_pause][1]
|
||||
if (ev->data1 == gamecontrol[0][gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[0][gc_pause][1]
|
||||
|| ev->data1 == KEY_PAUSE
|
||||
)
|
||||
{
|
||||
@@ -1454,8 +1456,8 @@ boolean G_Responder(event_t *ev)
|
||||
switch (ev->type)
|
||||
{
|
||||
case ev_keydown:
|
||||
if (ev->data1 == gamecontrol[gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[gc_pause][1]
|
||||
if (ev->data1 == gamecontrol[0][gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[0][gc_pause][1]
|
||||
|| ev->data1 == KEY_PAUSE)
|
||||
{
|
||||
if (!pausedelay)
|
||||
@@ -1472,8 +1474,8 @@ boolean G_Responder(event_t *ev)
|
||||
}
|
||||
|
||||
// no splitscreen support for director here
|
||||
if (ev->data1 == gamecontrol[gc_director][0]
|
||||
|| ev->data1 == gamecontrol[gc_director][1])
|
||||
if (ev->data1 == gamecontrol[0][gc_director][0]
|
||||
|| ev->data1 == gamecontrol[0][gc_director][1])
|
||||
{
|
||||
K_ToggleDirector();
|
||||
}
|
||||
@@ -1481,8 +1483,8 @@ boolean G_Responder(event_t *ev)
|
||||
// absolutely horrid
|
||||
for (INT32 i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (ev->data1 == gamecontrols[i][gc_camtoggle][0]
|
||||
|| ev->data1 == gamecontrols[i][gc_camtoggle][1])
|
||||
if (ev->data1 == gamecontrol[i][gc_camtoggle][0]
|
||||
|| ev->data1 == gamecontrol[i][gc_camtoggle][1])
|
||||
{
|
||||
if (!camtoggledelay[i])
|
||||
{
|
||||
@@ -1491,8 +1493,8 @@ boolean G_Responder(event_t *ev)
|
||||
}
|
||||
}
|
||||
|
||||
if (ev->data1 == gamecontrols[i][gc_spectate][0]
|
||||
|| ev->data1 == gamecontrols[i][gc_spectate][1])
|
||||
if (ev->data1 == gamecontrol[i][gc_spectate][0]
|
||||
|| ev->data1 == gamecontrol[i][gc_spectate][1])
|
||||
{
|
||||
if (!spectatedelay[i])
|
||||
{
|
||||
@@ -1501,8 +1503,8 @@ boolean G_Responder(event_t *ev)
|
||||
}
|
||||
}
|
||||
|
||||
if (ev->data1 == gamecontrols[i][gc_freecam][0]
|
||||
|| ev->data1 == gamecontrols[i][gc_freecam][1])
|
||||
if (ev->data1 == gamecontrol[i][gc_freecam][0]
|
||||
|| ev->data1 == gamecontrol[i][gc_freecam][1])
|
||||
{
|
||||
P_ToggleDemoCamera(i);
|
||||
}
|
||||
|
||||
+98
-135
@@ -131,18 +131,7 @@ joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[J
|
||||
UINT8 gamekeydown[NUMINPUTS];
|
||||
|
||||
// two key codes (or virtual key) per game control
|
||||
INT32 gamecontrol[num_gamecontrols][2];
|
||||
INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
|
||||
INT32 gamecontrol3[num_gamecontrols][2]; // tertiary splitscreen player
|
||||
INT32 gamecontrol4[num_gamecontrols][2]; // quarternary splitscreen player
|
||||
|
||||
// TODO: this is dumb as hell
|
||||
INT32 (*gamecontrols[MAXSPLITSCREENPLAYERS])[2] = {
|
||||
gamecontrol,
|
||||
gamecontrolbis,
|
||||
gamecontrol3,
|
||||
gamecontrol4
|
||||
};
|
||||
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -985,13 +974,14 @@ void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control)
|
||||
|
||||
void G_ClearAllControlKeys(void)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
INT32 i, k;
|
||||
|
||||
for (k = 0; k < MAXSPLITSCREENPLAYERS; k++)
|
||||
{
|
||||
G_ClearControlKeys(gamecontrol, i);
|
||||
G_ClearControlKeys(gamecontrolbis, i);
|
||||
G_ClearControlKeys(gamecontrol3, i);
|
||||
G_ClearControlKeys(gamecontrol4, i);
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
G_ClearControlKeys(gamecontrol[k], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1049,158 +1039,131 @@ void G_Controldefault(UINT8 player)
|
||||
if (player == 0 || player == 1)
|
||||
{
|
||||
// Main controls
|
||||
gamecontrol[gc_aimforward ][0] = KEY_UPARROW;
|
||||
gamecontrol[gc_aimbackward][0] = KEY_DOWNARROW;
|
||||
gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
|
||||
gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
|
||||
gamecontrol[gc_accelerate ][0] = 'a';
|
||||
gamecontrol[gc_drift ][0] = 's';
|
||||
gamecontrol[gc_brake ][0] = 'd';
|
||||
gamecontrol[gc_fire ][0] = KEY_SPACE;
|
||||
gamecontrol[gc_lookback ][0] = KEY_LSHIFT;
|
||||
gamecontrol[0][gc_aimforward ][0] = KEY_UPARROW;
|
||||
gamecontrol[0][gc_aimbackward][0] = KEY_DOWNARROW;
|
||||
gamecontrol[0][gc_turnleft ][0] = KEY_LEFTARROW;
|
||||
gamecontrol[0][gc_turnright ][0] = KEY_RIGHTARROW;
|
||||
gamecontrol[0][gc_accelerate ][0] = 'a';
|
||||
gamecontrol[0][gc_drift ][0] = 's';
|
||||
gamecontrol[0][gc_brake ][0] = 'd';
|
||||
gamecontrol[0][gc_fire ][0] = KEY_SPACE;
|
||||
gamecontrol[0][gc_lookback ][0] = KEY_LSHIFT;
|
||||
|
||||
gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A
|
||||
gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X
|
||||
gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B
|
||||
gamecontrol[gc_fire ][1] = KEY_JOY1+9; // LB
|
||||
gamecontrol[gc_drift ][1] = KEY_JOY1+10; // RB
|
||||
gamecontrol[0][gc_accelerate ][1] = KEY_JOY1+0; // A
|
||||
gamecontrol[0][gc_lookback ][1] = KEY_JOY1+2; // X
|
||||
gamecontrol[0][gc_brake ][1] = KEY_JOY1+1; // B
|
||||
gamecontrol[0][gc_fire ][1] = KEY_JOY1+9; // LB
|
||||
gamecontrol[0][gc_drift ][1] = KEY_JOY1+10; // RB
|
||||
|
||||
// Extra controls
|
||||
gamecontrol[gc_pause ][0] = KEY_PAUSE;
|
||||
gamecontrol[gc_console ][0] = KEY_CONSOLE;
|
||||
gamecontrol[gc_screenshot ][0] = KEY_F8;
|
||||
gamecontrol[gc_recordgif ][0] = KEY_F9;
|
||||
gamecontrol[gc_viewpoint ][0] = KEY_F12;
|
||||
gamecontrol[gc_talkkey ][0] = 't';
|
||||
gamecontrol[0][gc_pause ][0] = KEY_PAUSE;
|
||||
gamecontrol[0][gc_console ][0] = KEY_CONSOLE;
|
||||
gamecontrol[0][gc_screenshot ][0] = KEY_F8;
|
||||
gamecontrol[0][gc_recordgif ][0] = KEY_F9;
|
||||
gamecontrol[0][gc_viewpoint ][0] = KEY_F12;
|
||||
gamecontrol[0][gc_talkkey ][0] = 't';
|
||||
//gamecontrol[gc_teamkey ][0] = 'y';
|
||||
gamecontrol[gc_scores ][0] = KEY_TAB;
|
||||
gamecontrol[gc_spectate ][0] = '\'';
|
||||
gamecontrol[gc_lookup ][0] = KEY_PGUP;
|
||||
gamecontrol[gc_lookdown ][0] = KEY_PGDN;
|
||||
gamecontrol[gc_centerview ][0] = KEY_END;
|
||||
gamecontrol[gc_camreset ][0] = KEY_HOME;
|
||||
gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE;
|
||||
gamecontrol[0][gc_scores ][0] = KEY_TAB;
|
||||
gamecontrol[0][gc_spectate ][0] = '\'';
|
||||
gamecontrol[0][gc_lookup ][0] = KEY_PGUP;
|
||||
gamecontrol[0][gc_lookdown ][0] = KEY_PGDN;
|
||||
gamecontrol[0][gc_centerview ][0] = KEY_END;
|
||||
gamecontrol[0][gc_camreset ][0] = KEY_HOME;
|
||||
gamecontrol[0][gc_camtoggle ][0] = KEY_BACKSPACE;
|
||||
|
||||
gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y
|
||||
gamecontrol[gc_pause ][1] = KEY_JOY1+4; // Back
|
||||
gamecontrol[gc_systemmenu ][0] = KEY_JOY1+6; // Start
|
||||
//gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
//gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
|
||||
gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
gamecontrol[0][gc_viewpoint ][1] = KEY_JOY1+3; // Y
|
||||
gamecontrol[0][gc_pause ][1] = KEY_JOY1+4; // Back
|
||||
gamecontrol[0][gc_systemmenu ][0] = KEY_JOY1+6; // Start
|
||||
//gamecontrol[0][gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
//gamecontrol[0][gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
|
||||
gamecontrol[0][gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
gamecontrol[0][gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
}
|
||||
|
||||
if (player == 0 || player == 2)
|
||||
{
|
||||
// Player 2 controls
|
||||
gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A
|
||||
gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X
|
||||
gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B
|
||||
gamecontrolbis[gc_fire ][0] = KEY_2JOY1+9; // LB
|
||||
gamecontrolbis[gc_drift ][0] = KEY_2JOY1+10; // RB
|
||||
gamecontrol[1][gc_accelerate ][0] = KEY_2JOY1+0; // A
|
||||
gamecontrol[1][gc_lookback ][0] = KEY_2JOY1+2; // X
|
||||
gamecontrol[1][gc_brake ][0] = KEY_2JOY1+1; // B
|
||||
gamecontrol[1][gc_fire ][0] = KEY_2JOY1+9; // LB
|
||||
gamecontrol[1][gc_drift ][0] = KEY_2JOY1+10; // RB
|
||||
}
|
||||
|
||||
if (player == 0 || player == 3)
|
||||
{
|
||||
// Player 3 controls
|
||||
gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A
|
||||
gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X
|
||||
gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B
|
||||
gamecontrol3[gc_fire ][0] = KEY_3JOY1+9; // LB
|
||||
gamecontrol3[gc_drift ][0] = KEY_3JOY1+10; // RB
|
||||
gamecontrol[2][gc_accelerate ][0] = KEY_3JOY1+0; // A
|
||||
gamecontrol[2][gc_lookback ][0] = KEY_3JOY1+2; // X
|
||||
gamecontrol[2][gc_brake ][0] = KEY_3JOY1+1; // B
|
||||
gamecontrol[2][gc_fire ][0] = KEY_3JOY1+9; // LB
|
||||
gamecontrol[2][gc_drift ][0] = KEY_3JOY1+10; // RB
|
||||
}
|
||||
|
||||
if (player == 0 || player == 4)
|
||||
{
|
||||
// Player 4 controls
|
||||
gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A
|
||||
gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X
|
||||
gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B
|
||||
gamecontrol4[gc_fire ][0] = KEY_4JOY1+9; // LB
|
||||
gamecontrol4[gc_drift ][0] = KEY_4JOY1+10; // RB
|
||||
gamecontrol[3][gc_accelerate ][0] = KEY_4JOY1+0; // A
|
||||
gamecontrol[3][gc_lookback ][0] = KEY_4JOY1+2; // X
|
||||
gamecontrol[3][gc_brake ][0] = KEY_4JOY1+1; // B
|
||||
gamecontrol[3][gc_fire ][0] = KEY_4JOY1+9; // LB
|
||||
gamecontrol[3][gc_drift ][0] = KEY_4JOY1+10; // RB
|
||||
}
|
||||
}
|
||||
|
||||
void G_SaveKeySetting(FILE *f)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 i, k;
|
||||
|
||||
for (i = 1; i < num_gamecontrols; i++)
|
||||
static const char *controltext[MAXSPLITSCREENPLAYERS] = {
|
||||
"setcontrol",
|
||||
"setcontrol2",
|
||||
"setcontrol3",
|
||||
"setcontrol4"
|
||||
};
|
||||
|
||||
for (k = 0; k < MAXSPLITSCREENPLAYERS; k++)
|
||||
{
|
||||
fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i],
|
||||
G_KeynumToString(gamecontrol[i][0]));
|
||||
for (i = 1; i < num_gamecontrols; i++)
|
||||
{
|
||||
fprintf(f, "%s \"%s\" \"%s\"", controltext[k], gamecontrolname[i],
|
||||
G_KeynumToString(gamecontrol[k][i][0]));
|
||||
|
||||
if (gamecontrol[i][1])
|
||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[i][1]));
|
||||
else
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
for (i = 1; i < num_gamecontrols; i++)
|
||||
{
|
||||
fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i],
|
||||
G_KeynumToString(gamecontrolbis[i][0]));
|
||||
|
||||
if (gamecontrolbis[i][1])
|
||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrolbis[i][1]));
|
||||
else
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
for (i = 1; i < num_gamecontrols; i++)
|
||||
{
|
||||
fprintf(f, "setcontrol3 \"%s\" \"%s\"", gamecontrolname[i],
|
||||
G_KeynumToString(gamecontrol3[i][0]));
|
||||
|
||||
if (gamecontrol3[i][1])
|
||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol3[i][1]));
|
||||
else
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
for (i = 1; i < num_gamecontrols; i++)
|
||||
{
|
||||
fprintf(f, "setcontrol4 \"%s\" \"%s\"", gamecontrolname[i],
|
||||
G_KeynumToString(gamecontrol4[i][0]));
|
||||
|
||||
if (gamecontrol4[i][1])
|
||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol4[i][1]));
|
||||
else
|
||||
fprintf(f, "\n");
|
||||
if (gamecontrol[k][i][1])
|
||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[k][i][1]));
|
||||
else
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify)
|
||||
{
|
||||
INT32 result = gc_null;
|
||||
|
||||
if (cv_controlperkey.value == 1)
|
||||
{
|
||||
INT32 i, j;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
INT32 i, j, k;
|
||||
|
||||
for (k = 0; k < MAXSPLITSCREENPLAYERS; k++)
|
||||
{
|
||||
for (j = 0; j < 2; j++)
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
if (gamecontrol[i][j] == keynum) {
|
||||
result = i;
|
||||
if (modify) gamecontrol[i][j] = KEY_NULL;
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
if (gamecontrol[k][i][j] == keynum)
|
||||
{
|
||||
result = i;
|
||||
if (modify) gamecontrol[k][i][j] = KEY_NULL;
|
||||
}
|
||||
|
||||
if (result && !modify)
|
||||
return result;
|
||||
}
|
||||
if (gamecontrolbis[i][j] == keynum) {
|
||||
result = i;
|
||||
if (modify) gamecontrolbis[i][j] = KEY_NULL;
|
||||
}
|
||||
if (gamecontrol3[i][j] == keynum) {
|
||||
result = i;
|
||||
if (modify) gamecontrol3[i][j] = KEY_NULL;
|
||||
}
|
||||
if (gamecontrol4[i][j] == keynum) {
|
||||
result = i;
|
||||
if (modify) gamecontrol4[i][j] = KEY_NULL;
|
||||
}
|
||||
if (result && !modify)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1354,11 +1317,11 @@ static void setcontrol(INT32 (*gc)[2])
|
||||
INT32 player;
|
||||
boolean nestedoverride = false;
|
||||
|
||||
if ((void*)gc == (void*)&gamecontrol4)
|
||||
if ((void*)gc == (void*)&gamecontrol[3])
|
||||
player = 3;
|
||||
else if ((void*)gc == (void*)&gamecontrol3)
|
||||
else if ((void*)gc == (void*)&gamecontrol[2])
|
||||
player = 2;
|
||||
else if ((void*)gc == (void*)&gamecontrolbis)
|
||||
else if ((void*)gc == (void*)&gamecontrol[1])
|
||||
player = 1;
|
||||
else
|
||||
player = 0;
|
||||
@@ -1421,7 +1384,7 @@ void Command_Setcontrol_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
setcontrol(gamecontrol);
|
||||
setcontrol(gamecontrol[0]);
|
||||
}
|
||||
|
||||
void Command_Setcontrol2_f(void)
|
||||
@@ -1436,7 +1399,7 @@ void Command_Setcontrol2_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
setcontrol(gamecontrolbis);
|
||||
setcontrol(gamecontrol[1]);
|
||||
}
|
||||
|
||||
void Command_Setcontrol3_f(void)
|
||||
@@ -1451,7 +1414,7 @@ void Command_Setcontrol3_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
setcontrol(gamecontrol3);
|
||||
setcontrol(gamecontrol[2]);
|
||||
}
|
||||
|
||||
void Command_Setcontrol4_f(void)
|
||||
@@ -1466,5 +1429,5 @@ void Command_Setcontrol4_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
setcontrol(gamecontrol4);
|
||||
setcontrol(gamecontrol[3]);
|
||||
}
|
||||
+5
-9
@@ -121,16 +121,12 @@ extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET],
|
||||
extern UINT8 gamekeydown[NUMINPUTS];
|
||||
|
||||
// two key codes (or virtual key) per game control
|
||||
extern INT32 gamecontrol[num_gamecontrols][2];
|
||||
extern INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
|
||||
extern INT32 gamecontrol3[num_gamecontrols][2];
|
||||
extern INT32 gamecontrol4[num_gamecontrols][2];
|
||||
extern INT32 (*gamecontrols[MAXSPLITSCREENPLAYERS])[2];
|
||||
extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
|
||||
|
||||
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]])
|
||||
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]])
|
||||
#define PLAYER3INPUTDOWN(gc) (gamekeydown[gamecontrol3[gc][0]] || gamekeydown[gamecontrol3[gc][1]])
|
||||
#define PLAYER4INPUTDOWN(gc) (gamekeydown[gamecontrol4[gc][0]] || gamekeydown[gamecontrol4[gc][1]])
|
||||
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[0][gc][0]] || gamekeydown[gamecontrol[0][gc][1]])
|
||||
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrol[1][gc][0]] || gamekeydown[gamecontrol[1][gc][1]])
|
||||
#define PLAYER3INPUTDOWN(gc) (gamekeydown[gamecontrol[2][gc][0]] || gamekeydown[gamecontrol[2][gc][1]])
|
||||
#define PLAYER4INPUTDOWN(gc) (gamekeydown[gamecontrol[3][gc][0]] || gamekeydown[gamecontrol[3][gc][1]])
|
||||
|
||||
// peace to my little coder fingers!
|
||||
// check a gamecontrol being active or not
|
||||
|
||||
+7
-7
@@ -1315,7 +1315,7 @@ boolean HU_Responder(event_t *ev)
|
||||
INT32 i;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1)
|
||||
if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1327,7 +1327,7 @@ boolean HU_Responder(event_t *ev)
|
||||
if (!chat_on)
|
||||
{
|
||||
// enter chat mode
|
||||
if ((ev->data1 == gamecontrol[gc_talkkey][0] || ev->data1 == gamecontrol[gc_talkkey][1])
|
||||
if ((ev->data1 == gamecontrol[0][gc_talkkey][0] || ev->data1 == gamecontrol[0][gc_talkkey][1])
|
||||
&& netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
|
||||
{
|
||||
chat_on = true;
|
||||
@@ -1338,7 +1338,7 @@ boolean HU_Responder(event_t *ev)
|
||||
typelines = 1;
|
||||
return true;
|
||||
}
|
||||
if ((ev->data1 == gamecontrol[gc_teamkey][0] || ev->data1 == gamecontrol[gc_teamkey][1])
|
||||
if ((ev->data1 == gamecontrol[0][gc_teamkey][0] || ev->data1 == gamecontrol[0][gc_teamkey][1])
|
||||
&& netgame && !OLD_MUTE)
|
||||
{
|
||||
chat_on = true;
|
||||
@@ -1364,8 +1364,8 @@ boolean HU_Responder(event_t *ev)
|
||||
|
||||
// Ignore non-keyboard keys, except when the talk key is bound
|
||||
if (ev->data1 >= KEY_MOUSE1
|
||||
&& (ev->data1 != gamecontrol[gc_talkkey][0]
|
||||
&& ev->data1 != gamecontrol[gc_talkkey][1]))
|
||||
&& (ev->data1 != gamecontrol[0][gc_talkkey][0]
|
||||
&& ev->data1 != gamecontrol[0][gc_talkkey][1]))
|
||||
return false;
|
||||
|
||||
M_TextInputHandle(&w_chat, c);
|
||||
@@ -1377,8 +1377,8 @@ boolean HU_Responder(event_t *ev)
|
||||
HU_SendChatMessage();
|
||||
}
|
||||
else if (c == KEY_ESCAPE
|
||||
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
|
||||
|| c == gamecontrol[gc_teamkey][0] || c == gamecontrol[gc_teamkey][1])
|
||||
|| ((c == gamecontrol[0][gc_talkkey][0] || c == gamecontrol[0][gc_talkkey][1]
|
||||
|| c == gamecontrol[0][gc_teamkey][0] || c == gamecontrol[0][gc_teamkey][1])
|
||||
&& c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle.
|
||||
{
|
||||
chat_on = false;
|
||||
|
||||
+19
-19
@@ -3887,8 +3887,8 @@ boolean M_Responder(event_t *ev)
|
||||
{
|
||||
if (currentMenu == &MISC_ChangeLevelDef || currentMenu == &MP_OfflineServerDef || currentMenu == &MP_ServerDef)
|
||||
{
|
||||
if (ch == gamecontrol[gc_fire][0]
|
||||
|| ch == gamecontrol[gc_fire][1])
|
||||
if (ch == gamecontrol[0][gc_fire][0]
|
||||
|| ch == gamecontrol[0][gc_fire][1])
|
||||
{
|
||||
COM_ImmedExecute("add kartencore 1");
|
||||
}
|
||||
@@ -4021,9 +4021,9 @@ boolean M_Responder(event_t *ev)
|
||||
|
||||
if (ch == -1)
|
||||
return false;
|
||||
else if (ch == gamecontrol[gc_systemmenu][0] || ch == gamecontrol[gc_systemmenu][1]) // allow remappable ESC key
|
||||
else if (ch == gamecontrol[0][gc_systemmenu][0] || ch == gamecontrol[0][gc_systemmenu][1]) // allow remappable ESC key
|
||||
ch = KEY_ESCAPE;
|
||||
else if ((ch == gamecontrol[gc_accelerate][0] || ch == gamecontrol[gc_accelerate][1]) && ch >= KEY_MOUSE1)
|
||||
else if ((ch == gamecontrol[0][gc_accelerate][0] || ch == gamecontrol[0][gc_accelerate][1]) && ch >= KEY_MOUSE1)
|
||||
ch = KEY_ENTER;
|
||||
|
||||
// F-Keys
|
||||
@@ -4099,7 +4099,7 @@ boolean M_Responder(event_t *ev)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((ch == gamecontrol[gc_brake][0] || ch == gamecontrol[gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game
|
||||
if ((ch == gamecontrol[0][gc_brake][0] || ch == gamecontrol[0][gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game
|
||||
ch = KEY_ESCAPE;
|
||||
|
||||
routine = currentMenu->menuitems[itemOn].itemaction;
|
||||
@@ -10097,7 +10097,7 @@ static void M_HandleMasterServerResetChoice(event_t *ev)
|
||||
|
||||
if (ev->type == ev_keydown)
|
||||
{
|
||||
if (choice == ' ' || choice == 'y' || choice == KEY_ENTER || choice == gamecontrol[gc_accelerate][0] || choice == gamecontrol[gc_accelerate][1])
|
||||
if (choice == ' ' || choice == 'y' || choice == KEY_ENTER || choice == gamecontrol[0][gc_accelerate][0] || choice == gamecontrol[0][gc_accelerate][1])
|
||||
{
|
||||
CV_Set(&cv_masterserver, cv_masterserver.defaultvalue);
|
||||
CV_Set(&cv_masterserver_nagattempts, cv_masterserver_nagattempts.defaultvalue);
|
||||
@@ -10251,8 +10251,8 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
||||
if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu
|
||||
{
|
||||
char encoretoggle[32] = {0};
|
||||
const char *item1 = gamecontrol[gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[gc_fire][0]) : NULL;
|
||||
const char *item2 = gamecontrol[gc_fire][1] != 0 ? G_KeynumToString(gamecontrol[gc_fire][1]) : NULL;
|
||||
const char *item1 = gamecontrol[0][gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][0]) : NULL;
|
||||
const char *item2 = gamecontrol[0][gc_fire][1] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][1]) : NULL;
|
||||
|
||||
if (item1 != NULL && item2 != NULL)
|
||||
snprintf(encoretoggle, 32, "%s/%s - Toggle Encore", item1, item2);
|
||||
@@ -11445,7 +11445,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
boolean exitmenu = false; // exit to previous menu and send name change
|
||||
const boolean gridselect = (cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED); // menus with "grids"
|
||||
|
||||
if ((choice == gamecontrol[gc_fire][0] || choice == gamecontrol[gc_fire][1]) && (itemOn == 2 || (gridselect && itemOn == 1)))
|
||||
if ((choice == gamecontrol[0][gc_fire][0] || choice == gamecontrol[0][gc_fire][1]) && (itemOn == 2 || (gridselect && itemOn == 1)))
|
||||
choice = KEY_BACKSPACE; // Hack to allow resetting prefcolor on controllers
|
||||
|
||||
#define BREAKWHENLOCKED {\
|
||||
@@ -11741,8 +11741,8 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
break;
|
||||
|
||||
//c why?????
|
||||
//case gamecontrol[gc_accelerate][0]:
|
||||
//case gamecontrol[gc_accelerate][1]:
|
||||
//case gamecontrol[0][gc_accelerate][0]:
|
||||
//case gamecontrol[0][gc_accelerate][1]:
|
||||
case KEY_ENTER:
|
||||
if (cv_skinselectmenu.value == SKINMENUTYPE_2D)
|
||||
{
|
||||
@@ -12356,7 +12356,7 @@ static void M_Setup1PControlsMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
setupcontrolplayer = 1;
|
||||
setupcontrols = gamecontrol; // was called from main Options (for console player, then)
|
||||
setupcontrols = gamecontrol[0]; // was called from main Options (for console player, then)
|
||||
currentMenu->lastOn = itemOn;
|
||||
|
||||
// Set proper gamepad options
|
||||
@@ -12379,7 +12379,7 @@ static void M_Setup2PControlsMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
setupcontrolplayer = 2;
|
||||
setupcontrols = gamecontrolbis;
|
||||
setupcontrols = gamecontrol[1];
|
||||
currentMenu->lastOn = itemOn;
|
||||
|
||||
// Set proper gamepad options
|
||||
@@ -12402,7 +12402,7 @@ static void M_Setup3PControlsMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
setupcontrolplayer = 3;
|
||||
setupcontrols = gamecontrol3;
|
||||
setupcontrols = gamecontrol[2];
|
||||
currentMenu->lastOn = itemOn;
|
||||
|
||||
// Set proper gamepad options
|
||||
@@ -12425,7 +12425,7 @@ static void M_Setup4PControlsMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
setupcontrolplayer = 4;
|
||||
setupcontrols = gamecontrol4;
|
||||
setupcontrols = gamecontrol[3];
|
||||
currentMenu->lastOn = itemOn;
|
||||
|
||||
// Set proper gamepad options
|
||||
@@ -12673,17 +12673,17 @@ static void M_ResetControlsResponse(INT32 ch)
|
||||
switch (setupcontrolplayer)
|
||||
{
|
||||
case 4:
|
||||
G_ClearControlKeys(gamecontrol4, i);
|
||||
G_ClearControlKeys(gamecontrol[3], i);
|
||||
break;
|
||||
case 3:
|
||||
G_ClearControlKeys(gamecontrol3, i);
|
||||
G_ClearControlKeys(gamecontrol[2], i);
|
||||
break;
|
||||
case 2:
|
||||
G_ClearControlKeys(gamecontrolbis, i);
|
||||
G_ClearControlKeys(gamecontrol[1], i);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
G_ClearControlKeys(gamecontrol, i);
|
||||
G_ClearControlKeys(gamecontrol[0], i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1577,9 +1577,9 @@ boolean M_ScreenshotResponder(event_t *ev)
|
||||
if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
|
||||
return false;
|
||||
|
||||
if (ch == KEY_F8 || ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8
|
||||
if (ch == KEY_F8 || ch == gamecontrol[0][gc_screenshot][0] || ch == gamecontrol[0][gc_screenshot][1]) // remappable F8
|
||||
M_ScreenShot();
|
||||
else if (ch == KEY_F9 || ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9
|
||||
else if (ch == KEY_F9 || ch == gamecontrol[0][gc_recordgif][0] || ch == gamecontrol[0][gc_recordgif][1]) // remappable F9
|
||||
((moviemode) ? M_StopMovie : M_StartMovie)();
|
||||
else
|
||||
return false;
|
||||
|
||||
+2
-2
@@ -506,8 +506,8 @@ static void ST_drawLevelTitle(void)
|
||||
static const char *ST_GetButtonName(INT32 control, const char *inputtext, boolean unbound, boolean gamectrl)
|
||||
{
|
||||
static char buttname[32] = "";
|
||||
const char *butt1 = (gamecontrol[control][0] != 0 ? G_KeynumToString(gamecontrol[control][0]) : NULL);
|
||||
const char *butt2 = (gamecontrol[control][1] != 0 ? G_KeynumToString(gamecontrol[control][1]) : NULL); // alternative bind
|
||||
const char *butt1 = (gamecontrol[0][control][0] != 0 ? G_KeynumToString(gamecontrol[0][control][0]) : NULL);
|
||||
const char *butt2 = (gamecontrol[0][control][1] != 0 ? G_KeynumToString(gamecontrol[0][control][1]) : NULL); // alternative bind
|
||||
|
||||
if (butt1 == NULL && butt2 == NULL) // not bound to a button
|
||||
snprintf(buttname, 32, (unbound ? "%s - %s" : (gamectrl ? "-%s - %s" : "%s - %s")), (unbound ? "Unbound" : ""), inputtext);
|
||||
|
||||
Reference in new issue
Block a user