mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-05 05:06:24 +00:00
Conflicts from merging profiles back
This commit is contained in:
commit
3deba803ae
39 changed files with 13724 additions and 2669 deletions
|
|
@ -115,4 +115,6 @@ k_menufunc.c
|
|||
k_menudraw.c
|
||||
k_terrain.c
|
||||
k_brightmap.c
|
||||
k_director.c
|
||||
k_terrain.c
|
||||
k_director.c
|
||||
k_profiles.c
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ boolean AM_Responder(event_t *ev)
|
|||
{
|
||||
//faB: prevent alt-tab in win32 version to activate automap just before
|
||||
// minimizing the app; doesn't do any harm to the DOS version
|
||||
if (!gamekeydown[KEY_LALT] && !gamekeydown[KEY_RALT])
|
||||
if (!gamekeydown[0][KEY_LALT] && !gamekeydown[0][KEY_RALT])
|
||||
{
|
||||
bigstate = 0; //added : 24-01-98 : toggle off large view
|
||||
AM_Start();
|
||||
|
|
|
|||
|
|
@ -2161,58 +2161,10 @@ static void CV_EnforceExecVersion(void)
|
|||
CV_StealthSetValue(&cv_execversion, EXECVERSION);
|
||||
}
|
||||
|
||||
static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
||||
{
|
||||
#if 1
|
||||
// We don't have changed axis defaults yet
|
||||
(void)v;
|
||||
(void)valstr;
|
||||
#else
|
||||
UINT8 i;
|
||||
|
||||
// If ALL axis settings are previous defaults, set them to the new defaults
|
||||
// EXECVERSION < 26 (2.1.21)
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (joyaxis_default[i])
|
||||
{
|
||||
if (!stricmp(v->name, "joyaxis_fire"))
|
||||
{
|
||||
if (joyaxis_count[i] > 7) return false;
|
||||
else if (joyaxis_count[i] == 7) return true;
|
||||
|
||||
if (!stricmp(valstr, "None")) joyaxis_count[i]++;
|
||||
else joyaxis_default[i] = false;
|
||||
}
|
||||
// reset all axis settings to defaults
|
||||
if (joyaxis_count[i] == 7)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
default:
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_turnaxis[0].name, cv_turnaxis[0].defaultvalue));
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_moveaxis[0].name, cv_moveaxis[0].defaultvalue));
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_brakeaxis[0].name, cv_brakeaxis[0].defaultvalue));
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_aimaxis[0].name, cv_aimaxis[0].defaultvalue));
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_lookaxis[0].name, cv_lookaxis[0].defaultvalue));
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_fireaxis[0].name, cv_fireaxis[0].defaultvalue));
|
||||
COM_BufInsertText(va("%s \"%s\"\n", cv_driftaxis[0].name, cv_driftaxis[0].defaultvalue));
|
||||
break;
|
||||
}
|
||||
joyaxis_count[i]++;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// we haven't reached our counts yet, or we're not default
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
||||
{
|
||||
(void)valstr;
|
||||
|
||||
// True means allow the CV change, False means block it
|
||||
|
||||
// We only care about CV_SAVE because this filters the user's config files
|
||||
|
|
@ -2230,11 +2182,6 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
|||
|| !stricmp(v->name, "mousemove2"))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// axis defaults were changed to be friendly to 360 controllers
|
||||
// if ALL axis settings are defaults, then change them to new values
|
||||
if (!CV_FilterJoyAxisVars(v, valstr))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -915,7 +915,7 @@ boolean CON_Responder(event_t *ev)
|
|||
if (modeattacking || metalrecording || marathonmode)
|
||||
return false;
|
||||
|
||||
if (ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder
|
||||
if (ev->data1 >= NUMKEYS) // See also: HUD_Responder
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
|
|
|
|||
|
|
@ -1503,7 +1503,7 @@ 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[0][gc_accelerate][0] || ev->data1 == gamecontrol[0][gc_accelerate][1])
|
||||
if (G_PlayerInputDown(0, gc_a, 1))
|
||||
{
|
||||
if (totalfilesrequestednum > 0)
|
||||
{
|
||||
|
|
@ -1526,7 +1526,7 @@ static void M_ConfirmConnect(event_t *ev)
|
|||
|
||||
M_ClearMenus(true);
|
||||
}
|
||||
else if (ev->data1 == 'n' || ev->data1 == KEY_ESCAPE|| ev->data1 == gamecontrol[0][gc_brake][0] || ev->data1 == gamecontrol[0][gc_brake][1])
|
||||
else if (G_PlayerInputDown(0, gc_b, 1))
|
||||
{
|
||||
cl_mode = CL_ABORTED;
|
||||
M_ClearMenus(true);
|
||||
|
|
@ -1926,13 +1926,15 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||
if (*oldtic != I_GetTime())
|
||||
{
|
||||
I_OsPolling();
|
||||
|
||||
memset(deviceResponding, false, sizeof (deviceResponding));
|
||||
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
|
||||
G_MapEventsToControls(&events[eventtail]);
|
||||
|
||||
if (cl_mode == CL_CONFIRMCONNECT)
|
||||
D_ProcessEvents(); //needed for menu system to receive inputs
|
||||
|
||||
if ((gamekeydown[KEY_ESCAPE] || gamekeydown[KEY_JOY1+1]) || cl_mode == CL_ABORTED)
|
||||
if (G_PlayerInputDown(0, gc_b, 1) || cl_mode == CL_ABORTED)
|
||||
{
|
||||
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
|
||||
// M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING);
|
||||
|
|
@ -1940,7 +1942,8 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
D_StartTitle();
|
||||
memset(gamekeydown, 0, NUMKEYS);
|
||||
memset(gamekeydown, 0, sizeof (gamekeydown));
|
||||
memset(deviceResponding, false, sizeof (deviceResponding));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ typedef enum
|
|||
ev_console,
|
||||
ev_mouse,
|
||||
ev_joystick,
|
||||
ev_joystick2,
|
||||
ev_joystick3,
|
||||
ev_joystick4,
|
||||
} evtype_t;
|
||||
|
||||
// Event structure.
|
||||
|
|
@ -37,6 +34,7 @@ typedef struct
|
|||
INT32 data1; // keys / mouse/joystick buttons
|
||||
INT32 data2; // mouse/joystick x move
|
||||
INT32 data3; // mouse/joystick y move
|
||||
INT32 device; // which player's device it belongs to
|
||||
} event_t;
|
||||
|
||||
//
|
||||
|
|
|
|||
18
src/d_main.c
18
src/d_main.c
|
|
@ -183,6 +183,7 @@ void D_ProcessEvents(void)
|
|||
|
||||
boolean eaten;
|
||||
|
||||
memset(deviceResponding, false, sizeof (deviceResponding));
|
||||
for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1))
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
|
|
@ -949,15 +950,6 @@ void D_StartTitle(void)
|
|||
V_SetPaletteLump("PLAYPAL");
|
||||
|
||||
// The title screen is obviously not a tutorial! (Unless I'm mistaken)
|
||||
/*
|
||||
if (tutorialmode && tutorialgcs)
|
||||
{
|
||||
G_CopyControls(gamecontrol[0], gamecontroldefault[0][gcs_custom], gcl_full, num_gcl_full); // using gcs_custom as temp storage
|
||||
M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls",
|
||||
M_TutorialSaveControlResponse, MM_YESNO);
|
||||
}
|
||||
*/
|
||||
|
||||
tutorialmode = false;
|
||||
}
|
||||
|
||||
|
|
@ -1101,13 +1093,12 @@ static void IdentifyVersion(void)
|
|||
#endif
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,TEXTURESNAME));
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,"chars.pk3"));
|
||||
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,MAPSNAME));
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,"followers.pk3"));
|
||||
#ifdef USE_PATCH_FILE
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,PATCHNAME));
|
||||
// SPECIFIC HACK TO NEW-MENUS SO THAT MY DUMBASS STOPS FORGETTING TO ADD THE FILE (rip :youfuckedup:)
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,"newmenus.pk3"));
|
||||
D_AddFile(startupiwads, va(pandf,srb2waddir,"newmenus.pk3"));
|
||||
#endif
|
||||
////
|
||||
#undef TEXTURESNAME
|
||||
|
|
@ -1367,7 +1358,6 @@ void D_SRB2Main(void)
|
|||
mainwads++; // chars.pk3
|
||||
mainwads++; // maps.pk3
|
||||
mainwads++; // followers.pk3
|
||||
|
||||
#ifdef USE_PATCH_FILE
|
||||
mainwads++; // patch.pk3
|
||||
// TODO: DON'T FORGET TO REMOVE THIS ONCE WE DON'T NEED IT ANYMORE.
|
||||
|
|
@ -1489,6 +1479,10 @@ void D_SRB2Main(void)
|
|||
//--------------------------------------------------------- CONFIG.CFG
|
||||
M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()"
|
||||
|
||||
// Load Profiles now that default controls have been defined
|
||||
PR_LoadProfiles(); // load control profiles
|
||||
PR_SaveProfiles(); // Test @TODO: remove this lol
|
||||
|
||||
M_Init();
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#ifndef __D_MAIN__
|
||||
#define __D_MAIN__
|
||||
|
||||
#include "k_profiles.h" // PR_LoadProfiles()
|
||||
#include "d_event.h"
|
||||
#include "w_wad.h" // for MAX_WADFILES
|
||||
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"},
|
|||
{4, "/dev/js3"}, {0, NULL}};
|
||||
#else
|
||||
// accept whatever value - it is in fact the joystick device number
|
||||
#define usejoystick_cons_t NULL
|
||||
static CV_PossibleValue_t usejoystick_cons_t[] = {{-1, "MIN"}, {MAXGAMEPADS, "MAX"}, {0, NULL}};
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
|
||||
|
|
@ -306,10 +306,10 @@ INT32 cv_debug;
|
|||
consvar_t cv_usemouse = CVAR_INIT ("use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse);
|
||||
|
||||
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("use_gamepad", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1),
|
||||
CVAR_INIT ("use_gamepad2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2),
|
||||
CVAR_INIT ("use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3),
|
||||
CVAR_INIT ("use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4)
|
||||
CVAR_INIT ("use_device", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1),
|
||||
CVAR_INIT ("use_device2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2),
|
||||
CVAR_INIT ("use_device3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3),
|
||||
CVAR_INIT ("use_device4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4)
|
||||
};
|
||||
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
|
|
@ -935,15 +935,7 @@ void D_RegisterClientCommands(void)
|
|||
{
|
||||
CV_RegisterVar(&cv_kickstartaccel[i]);
|
||||
CV_RegisterVar(&cv_shrinkme[i]);
|
||||
CV_RegisterVar(&cv_turnaxis[i]);
|
||||
CV_RegisterVar(&cv_moveaxis[i]);
|
||||
CV_RegisterVar(&cv_brakeaxis[i]);
|
||||
CV_RegisterVar(&cv_aimaxis[i]);
|
||||
CV_RegisterVar(&cv_lookaxis[i]);
|
||||
CV_RegisterVar(&cv_fireaxis[i]);
|
||||
CV_RegisterVar(&cv_driftaxis[i]);
|
||||
CV_RegisterVar(&cv_deadzone[i]);
|
||||
CV_RegisterVar(&cv_digitaldeadzone[i]);
|
||||
}
|
||||
|
||||
// filesrch.c
|
||||
|
|
@ -2800,10 +2792,6 @@ static void Command_Map_f(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (tutorialmode && tutorialgcs)
|
||||
{
|
||||
G_CopyControls(gamecontrol[0], gamecontroldefault[0][gcs_custom], gcl_full, num_gcl_full); // using gcs_custom as temp storage
|
||||
}
|
||||
tutorialmode = false; // warping takes us out of tutorial mode
|
||||
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, fromlevelselect);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ extern consvar_t cv_kartusepwrlv;
|
|||
|
||||
extern consvar_t cv_votetime;
|
||||
|
||||
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartallowgiveitem, cv_kartdebugdistribution, cv_kartdebughuddrop;
|
||||
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartallowgiveitem, cv_kartdebugshrink, cv_kartdebugdistribution, cv_kartdebughuddrop;
|
||||
extern consvar_t cv_kartdebugcheckpoint, cv_kartdebugnodes, cv_kartdebugcolorize, cv_kartdebugdirector;
|
||||
extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbotpredict;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,22 +26,23 @@
|
|||
// Button/action code definitions.
|
||||
typedef enum
|
||||
{
|
||||
BT_ACCELERATE = 1, // Accelerate
|
||||
BT_DRIFT = 1<<2, // Drift (direction is cmd->turning)
|
||||
BT_BRAKE = 1<<3, // Brake
|
||||
BT_ATTACK = 1<<4, // Use Item
|
||||
BT_FORWARD = 1<<5, // Aim Item Forward
|
||||
BT_BACKWARD = 1<<6, // Aim Item Backward
|
||||
BT_LOOKBACK = 1<<7, // Look Backward
|
||||
BT_ACCELERATE = 1, // Accelerate
|
||||
BT_DRIFT = 1<<2, // Drift (direction is cmd->turning)
|
||||
BT_BRAKE = 1<<3, // Brake
|
||||
BT_ATTACK = 1<<4, // Use Item
|
||||
BT_FORWARD = 1<<5, // Aim Item Forward
|
||||
BT_BACKWARD = 1<<6, // Aim Item Backward
|
||||
BT_LOOKBACK = 1<<7, // Look Backward
|
||||
|
||||
BT_EBRAKEMASK = (BT_ACCELERATE|BT_BRAKE),
|
||||
BT_SPINDASHMASK = (BT_ACCELERATE|BT_BRAKE|BT_DRIFT),
|
||||
|
||||
// free: 1<<9 to 1<<12
|
||||
|
||||
// Lua garbage
|
||||
BT_CUSTOM1 = 1<<13,
|
||||
BT_CUSTOM2 = 1<<14,
|
||||
BT_CUSTOM3 = 1<<15,
|
||||
BT_LUAA = 1<<13,
|
||||
BT_LUAB = 1<<14,
|
||||
BT_LUAC = 1<<15,
|
||||
} buttoncode_t;
|
||||
|
||||
// The data sampled per tick (single player)
|
||||
|
|
|
|||
|
|
@ -6667,9 +6667,9 @@ struct int_const_s const INT_CONST[] = {
|
|||
{"BT_ATTACK",BT_ATTACK},
|
||||
{"BT_FORWARD",BT_FORWARD},
|
||||
{"BT_BACKWARD",BT_BACKWARD},
|
||||
{"BT_CUSTOM1",BT_CUSTOM1}, // Lua customizable
|
||||
{"BT_CUSTOM2",BT_CUSTOM2}, // Lua customizable
|
||||
{"BT_CUSTOM3",BT_CUSTOM3}, // Lua customizable
|
||||
{"BT_LUAA",BT_LUAA}, // Lua customizable
|
||||
{"BT_LUAB",BT_LUAB}, // Lua customizable
|
||||
{"BT_LUAC",BT_LUAC}, // Lua customizable
|
||||
|
||||
// Lua command registration flags
|
||||
{"COM_ADMIN",COM_ADMIN},
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ extern char logfilename[1024];
|
|||
#define PLAYERSMASK (MAXPLAYERS-1)
|
||||
#define MAXPLAYERNAME 21
|
||||
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
|
||||
#define MAXGAMEPADS (MAXSPLITSCREENPLAYERS * 2) // Number of gamepads we'll be allowing
|
||||
|
||||
#define MAXSKINS 128
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@ extern INT16 bootmap; //bootmap for loading a map on startup
|
|||
|
||||
extern INT16 tutorialmap; // map to load for tutorial
|
||||
extern boolean tutorialmode; // are we in a tutorial right now?
|
||||
extern INT32 tutorialgcs; // which control scheme is loaded?
|
||||
|
||||
extern boolean looptitle;
|
||||
|
||||
|
|
|
|||
|
|
@ -1792,6 +1792,8 @@ static void F_CacheTitleScreen(void)
|
|||
|
||||
void F_StartTitleScreen(void)
|
||||
{
|
||||
setup_numplayers = 0;
|
||||
|
||||
if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)
|
||||
{
|
||||
ttuser_count = 0;
|
||||
|
|
@ -2699,12 +2701,13 @@ void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postex
|
|||
|
||||
static boolean F_GetTextPromptTutorialTag(char *tag, INT32 length)
|
||||
{
|
||||
INT32 gcs = gcs_custom;
|
||||
INT32 gcs = 0;
|
||||
boolean suffixed = true;
|
||||
|
||||
if (!tag || !tag[0] || !tutorialmode)
|
||||
return false;
|
||||
|
||||
/*
|
||||
if (!strncmp(tag, "TAA", 3)) // Accelerate
|
||||
gcs = G_GetControlScheme(gamecontrol[0], gcl_accelerate, num_gcl_accelerate);
|
||||
else if (!strncmp(tag, "TAB", 3)) // Brake
|
||||
|
|
@ -2719,14 +2722,10 @@ static boolean F_GetTextPromptTutorialTag(char *tag, INT32 length)
|
|||
gcs = G_GetControlScheme(gamecontrol[0], gcl_item, num_gcl_item);
|
||||
else
|
||||
gcs = G_GetControlScheme(gamecontrol[0], gcl_full, num_gcl_full);
|
||||
*/
|
||||
|
||||
switch (gcs)
|
||||
{
|
||||
case gcs_kart:
|
||||
// strncat(tag, "KART", length);
|
||||
suffixed = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
strncat(tag, "CUSTOM", length);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3867,7 +3867,7 @@ boolean G_DemoTitleResponder(event_t *ev)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (ch == KEY_ENTER || ch >= KEY_MOUSE1)
|
||||
if (ch == KEY_ENTER || ch >= NUMKEYS)
|
||||
{
|
||||
demo.savemode = DSM_WILLSAVE;
|
||||
return true;
|
||||
|
|
|
|||
490
src/g_game.c
490
src/g_game.c
|
|
@ -156,7 +156,6 @@ INT16 bootmap; //bootmap for loading a map on startup
|
|||
|
||||
INT16 tutorialmap = 0; // map to load for tutorial
|
||||
boolean tutorialmode = false; // are we in a tutorial right now?
|
||||
INT32 tutorialgcs = gcs_custom; // which control scheme is loaded?
|
||||
|
||||
boolean looptitle = true;
|
||||
|
||||
|
|
@ -347,22 +346,6 @@ static void weaponPrefChange2(void);
|
|||
static void weaponPrefChange3(void);
|
||||
static void weaponPrefChange4(void);
|
||||
|
||||
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
|
||||
{1, "X-Axis"}, {2, "Y-Axis"}, {-1, "X-Axis-"}, {-2, "Y-Axis-"},
|
||||
#if JOYAXISSET > 1
|
||||
{3, "Z-Axis"}, {4, "X-Rudder"}, {-3, "Z-Axis-"}, {-4, "X-Rudder-"},
|
||||
#endif
|
||||
#if JOYAXISSET > 2
|
||||
{5, "Y-Rudder"}, {6, "Z-Rudder"}, {-5, "Y-Rudder-"}, {-6, "Z-Rudder-"},
|
||||
#endif
|
||||
#if JOYAXISSET > 3
|
||||
{7, "U-Axis"}, {8, "V-Axis"}, {-7, "U-Axis-"}, {-8, "V-Axis-"},
|
||||
#endif
|
||||
{0, NULL}};
|
||||
#if JOYAXISSET > 4
|
||||
"More Axis Sets"
|
||||
#endif
|
||||
|
||||
// don't mind me putting these here, I was lazy to figure out where else I could put those without blowing up the compiler.
|
||||
|
||||
// chat timer thingy
|
||||
|
|
@ -419,68 +402,12 @@ consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS] = {
|
|||
CVAR_INIT ("shrinkme4", "Off", CV_CALL, CV_OnOff, weaponPrefChange4)
|
||||
};
|
||||
|
||||
consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis3_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis4_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis_move2", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis_move3", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis_move4", "None", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_brake", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis2_brake", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis3_brake", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis4_brake", "None", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis2_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis3_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis4_aim", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_fire", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis_fire2", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis_fire3", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis_fire4", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joyaxis_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis2_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis3_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL),
|
||||
CVAR_INIT ("joyaxis4_drift", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL)
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t zerotoone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("joy2_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("joy3_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("joy4_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL)
|
||||
};
|
||||
|
||||
consvar_t cv_digitaldeadzone[MAXSPLITSCREENPLAYERS] = {
|
||||
CVAR_INIT ("joy_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("joy2_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("joy3_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("joy4_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL)
|
||||
CVAR_INIT ("deadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("deadzone2", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("deadzone3", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL),
|
||||
CVAR_INIT ("deadzone4", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL)
|
||||
};
|
||||
|
||||
// now automatically allocated in D_RegisterClientCommands
|
||||
|
|
@ -732,74 +659,143 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
|
|||
return (INT16)((*aiming)>>16);
|
||||
}
|
||||
|
||||
INT32 PlayerJoyAxis(UINT8 player, axis_input_e axissel)
|
||||
static INT32 KeyValue(UINT8 p, INT32 key, UINT8 menuPlayers)
|
||||
{
|
||||
INT32 retaxis;
|
||||
INT32 axisval;
|
||||
boolean flp = false;
|
||||
INT32 deviceID;
|
||||
INT32 i, j;
|
||||
|
||||
//find what axis to get
|
||||
switch (axissel)
|
||||
if (key <= 0 || key >= NUMINPUTS)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis[player-1].value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis[player-1].value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis[player-1].value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis[player-1].value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis[player-1].value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis[player-1].value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis[player-1].value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (axisval < 0) //odd -axises
|
||||
{
|
||||
axisval = -axisval;
|
||||
flp = true;
|
||||
}
|
||||
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (axisval%2)
|
||||
deviceID = cv_usejoystick[p].value;
|
||||
|
||||
if (menuPlayers > 0)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joyxmove[player-1][axisval];
|
||||
// Try every device that does NOT belong to another player.
|
||||
for (i = MAXDEVICES-1; i >= 0; i--)
|
||||
{
|
||||
if (i == deviceID)
|
||||
{
|
||||
// We've tried this one multiple times :V
|
||||
continue;
|
||||
}
|
||||
|
||||
if (menuPlayers > 1)
|
||||
{
|
||||
for (j = 1; j < menuPlayers; j++)
|
||||
{
|
||||
if (i == cv_usejoystick[j].value)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j < menuPlayers)
|
||||
{
|
||||
// This one's taken.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (gamekeydown[i][key] != 0)
|
||||
{
|
||||
return gamekeydown[i][key];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joyymove[player-1][axisval];
|
||||
}
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel >= AXISDIGITAL)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_digitaldeadzone[player-1].value) >> FRACBITS;
|
||||
if (-jdeadzone < retaxis && retaxis < jdeadzone)
|
||||
if (deviceID < 0 || deviceID >= MAXDEVICES)
|
||||
{
|
||||
// Device is unset
|
||||
return 0;
|
||||
}
|
||||
|
||||
return gamekeydown[deviceID][key];
|
||||
}
|
||||
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
return retaxis;
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 G_PlayerInputAnalog(UINT8 p, INT32 gc, UINT8 menuPlayers)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 deadzone = 0;
|
||||
|
||||
if (p >= MAXSPLITSCREENPLAYERS)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
CONS_Debug(DBG_GAMELOGIC, "G_PlayerInputAnalog: Invalid player ID %d\n", p);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
deadzone = (JOYAXISRANGE * cv_deadzone[p].value) / FRACUNIT;
|
||||
|
||||
for (i = 0; i < MAXINPUTMAPPING; i++)
|
||||
{
|
||||
INT32 key = gamecontrol[p][gc][i];
|
||||
INT32 value = 0;
|
||||
|
||||
if (key <= 0 || key >= NUMINPUTS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
value = KeyValue(p, key, false);
|
||||
|
||||
if (value >= deadzone)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
if (menuPlayers != 0)
|
||||
{
|
||||
// We don't want menus to become unnavigable if people unbind
|
||||
// all of their controls, so we do several things in this scenario.
|
||||
|
||||
// First: check the same device, but with default binds.
|
||||
for (i = 0; i < MAXINPUTMAPPING; i++)
|
||||
{
|
||||
INT32 key = gamecontroldefault[gc][i];
|
||||
INT32 value = 0;
|
||||
|
||||
if (key <= 0 || key >= NUMINPUTS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
value = KeyValue(p, key, false);
|
||||
|
||||
if (value >= deadzone)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (p == 0 && menuPlayers == 1)
|
||||
{
|
||||
// Second: if we're Player 1 and there are no other players,
|
||||
// then we can use keyboard defaults as a final resort.
|
||||
|
||||
value = KeyValue(p, key, menuPlayers);
|
||||
|
||||
if (value >= deadzone)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean G_PlayerInputDown(UINT8 p, INT32 gc, UINT8 menuPlayers)
|
||||
{
|
||||
return (G_PlayerInputAnalog(p, gc, menuPlayers) != 0);
|
||||
}
|
||||
|
||||
// Take a magnitude of two axes, and adjust it to take out the deadzone
|
||||
|
|
@ -874,27 +870,15 @@ angle_t localangle[MAXSPLITSCREENPLAYERS];
|
|||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
{
|
||||
const UINT8 forplayer = ssplayer-1;
|
||||
|
||||
const INT32 lookaxis = cv_lookaxis[forplayer].value;
|
||||
const boolean invertmouse = cv_invertmouse.value;
|
||||
const boolean analogjoystickmove = cv_usejoystick[forplayer].value && !Joystick[forplayer].bGamepadStyle;
|
||||
const boolean gamepadjoystickmove = cv_usejoystick[forplayer].value && Joystick[forplayer].bGamepadStyle;
|
||||
const boolean usejoystick = (analogjoystickmove || gamepadjoystickmove);
|
||||
|
||||
static boolean keyboard_look[MAXSPLITSCREENPLAYERS]; // true if lookup/down using keyboard
|
||||
static boolean resetdown[MAXSPLITSCREENPLAYERS]; // don't cam reset every frame
|
||||
|
||||
INT32 forward, axis;
|
||||
INT32 forward;
|
||||
|
||||
joystickvector2_t joystickvector;
|
||||
|
||||
boolean turnleft, turnright;
|
||||
|
||||
player_t *player = &players[g_localplayers[forplayer]];
|
||||
camera_t *thiscam = &camera[forplayer];
|
||||
boolean *kbl = &keyboard_look[forplayer];
|
||||
boolean *rd = &resetdown[forplayer];
|
||||
const boolean mouseaiming = player->spectator;
|
||||
//camera_t *thiscam = &camera[forplayer];
|
||||
//boolean *kbl = &keyboard_look[forplayer];
|
||||
//boolean *rd = &resetdown[forplayer];
|
||||
//const boolean mouseaiming = player->spectator;
|
||||
|
||||
(void)realtics;
|
||||
|
||||
|
|
@ -931,10 +915,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
return;
|
||||
}
|
||||
|
||||
turnright = PlayerInputDown(ssplayer, gc_turnright);
|
||||
turnleft = PlayerInputDown(ssplayer, gc_turnleft);
|
||||
|
||||
joystickvector.xaxis = PlayerJoyAxis(ssplayer, AXISTURN);
|
||||
joystickvector.xaxis = G_PlayerInputAnalog(forplayer, gc_right, 0) - G_PlayerInputAnalog(forplayer, gc_left, 0);
|
||||
joystickvector.yaxis = 0;
|
||||
G_HandleAxisDeadZone(forplayer, &joystickvector);
|
||||
|
||||
|
|
@ -942,138 +923,104 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
// use it for aiming to throw items forward/backward and the vote screen
|
||||
// This mean that the turn axis will still be gradient but up/down will be 0
|
||||
// until the stick is pushed far enough
|
||||
joystickvector.yaxis = PlayerJoyAxis(ssplayer, AXISAIM);
|
||||
joystickvector.yaxis = G_PlayerInputAnalog(forplayer, gc_down, 0) - G_PlayerInputAnalog(forplayer, gc_up, 0);
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
turnright ^= turnleft; // swap these using three XORs
|
||||
turnleft ^= turnright;
|
||||
turnright ^= turnleft;
|
||||
joystickvector.xaxis = -joystickvector.xaxis;
|
||||
}
|
||||
|
||||
if (gamepadjoystickmove && joystickvector.xaxis != 0)
|
||||
{
|
||||
turnright = turnright || (joystickvector.xaxis > 0);
|
||||
turnleft = turnleft || (joystickvector.xaxis < 0);
|
||||
}
|
||||
forward = 0;
|
||||
|
||||
cmd->turning = 0;
|
||||
|
||||
// let movement keys cancel each other out
|
||||
if (turnright && !(turnleft))
|
||||
{
|
||||
cmd->turning -= KART_FULLTURN;
|
||||
}
|
||||
else if (turnleft && !(turnright))
|
||||
{
|
||||
cmd->turning += KART_FULLTURN;
|
||||
}
|
||||
|
||||
if (analogjoystickmove && joystickvector.xaxis != 0)
|
||||
if (joystickvector.xaxis != 0)
|
||||
{
|
||||
cmd->turning -= (joystickvector.xaxis * KART_FULLTURN) >> 10;
|
||||
}
|
||||
|
||||
// Specator mouse turning
|
||||
if (player->spectator)
|
||||
{
|
||||
cmd->turning -= (mousex * 8) * (encoremode ? -1 : 1);
|
||||
}
|
||||
|
||||
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
||||
{
|
||||
axis = PlayerJoyAxis(ssplayer, AXISMOVE);
|
||||
if (PlayerInputDown(ssplayer, gc_accelerate) || (usejoystick && axis > 0))
|
||||
if (G_PlayerInputDown(forplayer, gc_a, 0))
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
axis = PlayerJoyAxis(ssplayer, AXISBRAKE);
|
||||
if (PlayerInputDown(ssplayer, gc_brake) || (usejoystick && axis > 0))
|
||||
}
|
||||
|
||||
if (G_PlayerInputDown(forplayer, gc_b, 0))
|
||||
{
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
axis = PlayerJoyAxis(ssplayer, AXISAIM);
|
||||
if (PlayerInputDown(ssplayer, gc_aimforward) || (usejoystick && axis < 0))
|
||||
}
|
||||
|
||||
if (joystickvector.yaxis < 0)
|
||||
{
|
||||
forward += MAXPLMOVE;
|
||||
if (PlayerInputDown(ssplayer, gc_aimbackward) || (usejoystick && axis > 0))
|
||||
}
|
||||
|
||||
if (joystickvector.yaxis > 0)
|
||||
{
|
||||
forward -= MAXPLMOVE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward.
|
||||
axis = PlayerJoyAxis(ssplayer, AXISMOVE);
|
||||
if (PlayerInputDown(ssplayer, gc_accelerate) || (gamepadjoystickmove && axis > 0))
|
||||
INT32 value = G_PlayerInputAnalog(forplayer, gc_a, 0);
|
||||
if (value != 0)
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
forward = MAXPLMOVE; // 50
|
||||
}
|
||||
else if (analogjoystickmove && axis > 0)
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
forward += ((axis * MAXPLMOVE) >> 10);
|
||||
forward += ((value * MAXPLMOVE) >> 10);
|
||||
}
|
||||
|
||||
axis = PlayerJoyAxis(ssplayer, AXISBRAKE);
|
||||
if (PlayerInputDown(ssplayer, gc_brake) || (gamepadjoystickmove && axis > 0))
|
||||
value = G_PlayerInputAnalog(forplayer, gc_b, 0);
|
||||
if (value != 0)
|
||||
{
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||
forward -= MAXPLMOVE;
|
||||
}
|
||||
else if (analogjoystickmove && axis > 0)
|
||||
{
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||
forward -= ((axis * MAXPLMOVE) >> 10);
|
||||
forward -= ((value * MAXPLMOVE) >> 10);
|
||||
}
|
||||
|
||||
// But forward/backward IS used for aiming.
|
||||
if (PlayerInputDown(ssplayer, gc_aimforward) || (joystickvector.yaxis < 0))
|
||||
if (joystickvector.yaxis < 0)
|
||||
{
|
||||
cmd->buttons |= BT_FORWARD;
|
||||
if (PlayerInputDown(ssplayer, gc_aimbackward) || (joystickvector.yaxis > 0))
|
||||
}
|
||||
|
||||
if (joystickvector.yaxis > 0)
|
||||
{
|
||||
cmd->buttons |= BT_BACKWARD;
|
||||
}
|
||||
}
|
||||
|
||||
// fire with any button/key
|
||||
axis = PlayerJoyAxis(ssplayer, AXISFIRE);
|
||||
if (PlayerInputDown(ssplayer, gc_fire) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
|
||||
// drift with any button/key
|
||||
axis = PlayerJoyAxis(ssplayer, AXISDRIFT);
|
||||
if (PlayerInputDown(ssplayer, gc_drift) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
|
||||
// Spindash with any button/key
|
||||
// Simply holds all of the inputs for you.
|
||||
axis = PlayerJoyAxis(ssplayer, AXISSPINDASH);
|
||||
if (PlayerInputDown(ssplayer, gc_spindash) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= (BT_ACCELERATE|BT_BRAKE|BT_DRIFT);
|
||||
|
||||
// rear view with any button/key
|
||||
axis = PlayerJoyAxis(ssplayer, AXISLOOKBACK);
|
||||
if (PlayerInputDown(ssplayer, gc_lookback) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_LOOKBACK;
|
||||
|
||||
// Lua scriptable buttons
|
||||
if (PlayerInputDown(ssplayer, gc_custom1))
|
||||
cmd->buttons |= BT_CUSTOM1;
|
||||
if (PlayerInputDown(ssplayer, gc_custom2))
|
||||
cmd->buttons |= BT_CUSTOM2;
|
||||
if (PlayerInputDown(ssplayer, gc_custom3))
|
||||
cmd->buttons |= BT_CUSTOM3;
|
||||
|
||||
// Reset camera
|
||||
if (PlayerInputDown(ssplayer, gc_camreset))
|
||||
// drift
|
||||
if (G_PlayerInputDown(forplayer, gc_c, 0))
|
||||
{
|
||||
if (thiscam->chase && *rd == false)
|
||||
P_ResetCamera(player, thiscam);
|
||||
*rd = true;
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
}
|
||||
else
|
||||
*rd = false;
|
||||
|
||||
// A + B + C shortcut
|
||||
if (G_PlayerInputDown(forplayer, gc_abc, 0))
|
||||
{
|
||||
forward = 0;
|
||||
cmd->buttons |= BT_SPINDASHMASK;
|
||||
}
|
||||
|
||||
// fire
|
||||
if (G_PlayerInputDown(forplayer, gc_x, 0))
|
||||
{
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
}
|
||||
|
||||
// rear view
|
||||
if (G_PlayerInputDown(forplayer, gc_y, 0))
|
||||
{
|
||||
cmd->buttons |= BT_LOOKBACK;
|
||||
}
|
||||
|
||||
// lua buttons a thru c
|
||||
if (G_PlayerInputDown(forplayer, gc_luaa, 0)) { cmd->buttons |= BT_LUAA; }
|
||||
if (G_PlayerInputDown(forplayer, gc_luab, 0)) { cmd->buttons |= BT_LUAB; }
|
||||
if (G_PlayerInputDown(forplayer, gc_luac, 0)) { cmd->buttons |= BT_LUAC; }
|
||||
|
||||
// spectator aiming shit, ahhhh...
|
||||
/*
|
||||
{
|
||||
INT32 player_invert = invertmouse ? -1 : 1;
|
||||
INT32 screen_invert =
|
||||
|
|
@ -1081,15 +1028,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
&& (!thiscam->chase)) //because chasecam's not inverted
|
||||
? -1 : 1; // set to -1 or 1 to multiply
|
||||
|
||||
// mouse look stuff (mouse look is not the same as mouse aim)
|
||||
if (mouseaiming && player->spectator)
|
||||
{
|
||||
*kbl = false;
|
||||
|
||||
// looking up/down
|
||||
cmd->aiming += (mlooky<<19)*player_invert*screen_invert;
|
||||
}
|
||||
|
||||
axis = PlayerJoyAxis(ssplayer, AXISLOOK);
|
||||
if (analogjoystickmove && axis != 0 && lookaxis && player->spectator)
|
||||
cmd->aiming += (axis<<16) * screen_invert;
|
||||
|
|
@ -1115,11 +1053,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
if (PlayerInputDown(ssplayer, gc_centerview)) // No need to put a spectator limit on this one though :V
|
||||
cmd->aiming = 0;
|
||||
}
|
||||
|
||||
mousex = mousey = mlooky = 0;
|
||||
*/
|
||||
|
||||
cmd->forwardmove += (SINT8)forward;
|
||||
|
||||
cmd->flags = 0;
|
||||
|
||||
if (chat_on || CON_Ready())
|
||||
|
|
@ -1217,7 +1153,7 @@ static void weaponPrefChange4(void)
|
|||
//
|
||||
void G_DoLoadLevel(boolean resetplayer)
|
||||
{
|
||||
INT32 i, j;
|
||||
INT32 i;
|
||||
|
||||
// Make sure objectplace is OFF when you first start the level!
|
||||
OP_ResetObjectplace();
|
||||
|
|
@ -1277,12 +1213,7 @@ void G_DoLoadLevel(boolean resetplayer)
|
|||
|
||||
// clear cmd building stuff
|
||||
memset(gamekeydown, 0, sizeof (gamekeydown));
|
||||
for (i = 0;i < JOYAXISSET; i++)
|
||||
{
|
||||
for (j = 0; j < MAXSPLITSCREENPLAYERS; j++)
|
||||
joyxmove[j][i] = joyymove[j][i] = 0;
|
||||
}
|
||||
mousex = mousey = 0;
|
||||
memset(deviceResponding, false, sizeof (deviceResponding));
|
||||
|
||||
// clear hud messages remains (usually from game startup)
|
||||
CON_ClearHUD();
|
||||
|
|
@ -1368,7 +1299,7 @@ static INT32 camtoggledelay[MAXSPLITSCREENPLAYERS];
|
|||
//
|
||||
boolean G_Responder(event_t *ev)
|
||||
{
|
||||
UINT8 i;
|
||||
//INT32 i;
|
||||
|
||||
// any other key pops up menu if in demos
|
||||
if (gameaction == ga_nothing && !demo.quitafterplaying &&
|
||||
|
|
@ -1463,7 +1394,7 @@ boolean G_Responder(event_t *ev)
|
|||
|
||||
// allow spy mode changes even during the demo
|
||||
if (gamestate == GS_LEVEL && ev->type == ev_keydown
|
||||
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[0][gc_viewpoint][0] || ev->data1 == gamecontrol[0][gc_viewpoint][1]))
|
||||
&& (ev->data1 == KEY_F12 /*|| ev->data1 == gamecontrol[0][gc_viewpoint][0] || ev->data1 == gamecontrol[0][gc_viewpoint][1]*/))
|
||||
{
|
||||
if (!demo.playback && (r_splitscreen || !netgame))
|
||||
g_localplayers[0] = consoleplayer;
|
||||
|
|
@ -1481,6 +1412,7 @@ boolean G_Responder(event_t *ev)
|
|||
|
||||
if (gamestate == GS_LEVEL && ev->type == ev_keydown && multiplayer && demo.playback && !demo.freecam)
|
||||
{
|
||||
/*
|
||||
if (ev->data1 == gamecontrol[1][gc_viewpoint][0] || ev->data1 == gamecontrol[1][gc_viewpoint][1])
|
||||
{
|
||||
G_AdjustView(2, 1, true);
|
||||
|
|
@ -1496,12 +1428,13 @@ boolean G_Responder(event_t *ev)
|
|||
G_AdjustView(4, 1, true);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
// Allow pausing
|
||||
if (
|
||||
ev->data1 == gamecontrol[0][gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[0][gc_pause][1]
|
||||
|| ev->data1 == KEY_PAUSE
|
||||
//ev->data1 == gamecontrol[0][gc_pause][0]
|
||||
//|| ev->data1 == gamecontrol[0][gc_pause][1]
|
||||
ev->data1 == KEY_PAUSE
|
||||
)
|
||||
{
|
||||
paused = !paused;
|
||||
|
|
@ -1535,9 +1468,9 @@ boolean G_Responder(event_t *ev)
|
|||
switch (ev->type)
|
||||
{
|
||||
case ev_keydown:
|
||||
if (ev->data1 == gamecontrol[0][gc_pause][0]
|
||||
|| ev->data1 == gamecontrol[0][gc_pause][1]
|
||||
|| ev->data1 == KEY_PAUSE)
|
||||
if (//ev->data1 == gamecontrol[0][gc_pause][0]
|
||||
//|| ev->data1 == gamecontrol[0][gc_pause][1]
|
||||
ev->data1 == KEY_PAUSE)
|
||||
{
|
||||
if (modeattacking && !demo.playback && (gamestate == GS_LEVEL))
|
||||
{
|
||||
|
|
@ -1567,6 +1500,7 @@ boolean G_Responder(event_t *ev)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (ev->data1 == gamecontrol[i][gc_camtoggle][0]
|
||||
|
|
@ -1579,6 +1513,7 @@ boolean G_Responder(event_t *ev)
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
|
||||
|
|
@ -1591,15 +1526,6 @@ boolean G_Responder(event_t *ev)
|
|||
case ev_joystick:
|
||||
return true; // eat events
|
||||
|
||||
case ev_joystick2:
|
||||
return true; // eat events
|
||||
|
||||
case ev_joystick3:
|
||||
return true; // eat events
|
||||
|
||||
case ev_joystick4:
|
||||
return true; // eat events
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
24
src/g_game.h
24
src/g_game.h
|
|
@ -65,7 +65,6 @@ extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
|
|||
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_digitaldeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
|
|
@ -95,29 +94,12 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n);
|
|||
INT32 G_ClipAimingPitch(INT32 *aiming);
|
||||
INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AXISNONE = 0,
|
||||
|
||||
AXISTURN,
|
||||
AXISMOVE,
|
||||
AXISBRAKE,
|
||||
AXISLOOK,
|
||||
|
||||
AXISDIGITAL, // axes below this use digital deadzone
|
||||
|
||||
AXISFIRE = AXISDIGITAL,
|
||||
AXISDRIFT,
|
||||
AXISSPINDASH,
|
||||
AXISLOOKBACK,
|
||||
AXISAIM,
|
||||
} axis_input_e;
|
||||
|
||||
INT32 PlayerJoyAxis(UINT8 player, axis_input_e axissel);
|
||||
|
||||
extern angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed
|
||||
|
||||
INT32 G_PlayerInputAnalog(UINT8 p, INT32 gc, UINT8 menuPlayers);
|
||||
boolean G_PlayerInputDown(UINT8 p, INT32 gc, UINT8 menuPlayers);
|
||||
|
||||
//
|
||||
// GAME
|
||||
//
|
||||
|
|
|
|||
1151
src/g_input.c
1151
src/g_input.c
File diff suppressed because it is too large
Load diff
127
src/g_input.h
127
src/g_input.h
|
|
@ -27,106 +27,74 @@
|
|||
#define JOYHATS 4 // 4 hats
|
||||
#define JOYAXISSET 4 // 4 Sets of 2 axises
|
||||
|
||||
#define MAXINPUTMAPPING 4
|
||||
|
||||
//
|
||||
// mouse and joystick buttons are handled as 'virtual' keys
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
KEY_MOUSE1 = NUMKEYS,
|
||||
KEY_JOY1 = KEY_MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_JOY1 = NUMKEYS,
|
||||
KEY_HAT1 = KEY_JOY1 + JOYBUTTONS,
|
||||
KEY_AXIS1 = KEY_HAT1 + JOYHATS*4,
|
||||
|
||||
KEY_DBLMOUSE1 =KEY_HAT1 + JOYHATS*4, // double clicks
|
||||
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
|
||||
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
|
||||
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
|
||||
KEY_3HAT1 = KEY_3JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBL3JOY1 = KEY_3HAT1 + JOYHATS*4,
|
||||
KEY_DBL3HAT1 = KEY_DBL3JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_4JOY1 = KEY_DBL3HAT1 + JOYHATS*4,
|
||||
KEY_4HAT1 = KEY_4JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBL4JOY1 = KEY_4HAT1 + JOYHATS*4,
|
||||
KEY_DBL4HAT1 = KEY_DBL4JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
|
||||
KEY_MOUSE1 = KEY_AXIS1 + JOYAXISSET*2*2, // 4 sets of 2 axes, each with positive & negative
|
||||
KEY_MOUSEMOVE = KEY_MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_MOUSEWHEELUP = KEY_MOUSEMOVE + 4,
|
||||
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
|
||||
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
|
||||
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
|
||||
|
||||
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1,
|
||||
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
|
||||
} key_input_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
gc_null = 0, // a key/button mapped to gc_null has no effect
|
||||
gc_aimforward,
|
||||
gc_aimbackward,
|
||||
gc_turnleft,
|
||||
gc_turnright,
|
||||
gc_accelerate,
|
||||
gc_drift,
|
||||
gc_brake,
|
||||
gc_spindash,
|
||||
gc_fire,
|
||||
gc_lookback,
|
||||
gc_camreset,
|
||||
gc_camtoggle,
|
||||
gc_spectate,
|
||||
gc_lookup,
|
||||
gc_lookdown,
|
||||
gc_centerview,
|
||||
gc_talkkey,
|
||||
gc_teamkey,
|
||||
gc_scores,
|
||||
|
||||
// The actual gamepad
|
||||
gc_up,
|
||||
gc_down,
|
||||
gc_left,
|
||||
gc_right,
|
||||
gc_a,
|
||||
gc_b,
|
||||
gc_c,
|
||||
gc_x,
|
||||
gc_y,
|
||||
gc_z,
|
||||
gc_l,
|
||||
gc_r,
|
||||
gc_start,
|
||||
|
||||
// special keys
|
||||
gc_abc,
|
||||
gc_luaa,
|
||||
gc_luab,
|
||||
gc_luac,
|
||||
gc_console,
|
||||
gc_pause,
|
||||
gc_systemmenu,
|
||||
gc_talk,
|
||||
gc_teamtalk,
|
||||
gc_screenshot,
|
||||
gc_recordgif,
|
||||
gc_viewpoint,
|
||||
gc_custom1, // Lua scriptable
|
||||
gc_custom2, // Lua scriptable
|
||||
gc_custom3, // Lua scriptable
|
||||
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
gcs_custom,
|
||||
gcs_kart, // Kart doesn't really need this code, like, at all? But I don't feel like removing it.
|
||||
num_gamecontrolschemes
|
||||
} gamecontrolschemes_e;
|
||||
|
||||
// mouse values are used once
|
||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||
extern consvar_t cv_mousesens2, cv_mouseysens2;
|
||||
extern consvar_t cv_controlperkey;
|
||||
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
// current state of the keys: JOYAXISRANGE or 0 when boolean.
|
||||
// Or anything inbetween for analog values
|
||||
#define MAXDEVICES (MAXGAMEPADS + 1) // Gamepads + keyboard & mouse
|
||||
extern INT32 gamekeydown[MAXDEVICES][NUMINPUTS];
|
||||
extern boolean deviceResponding[MAXDEVICES];
|
||||
|
||||
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
// current state of the keys: true if pushed
|
||||
extern UINT8 gamekeydown[NUMINPUTS];
|
||||
|
||||
// two key codes (or virtual key) per game control
|
||||
extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
|
||||
extern INT32 gamecontroldefault[MAXSPLITSCREENPLAYERS][num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention
|
||||
#define PlayerInputDown(p, gc) (gamekeydown[gamecontrol[p-1][gc][0]] || gamekeydown[gamecontrol[p-1][gc][1]])
|
||||
// several key codes (or virtual key) per game control
|
||||
extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][MAXINPUTMAPPING];
|
||||
extern INT32 gamecontroldefault[num_gamecontrols][MAXINPUTMAPPING]; // default control storage
|
||||
|
||||
/*
|
||||
#define num_gcl_accelerate 1
|
||||
#define num_gcl_brake 1
|
||||
#define num_gcl_drift 1
|
||||
|
|
@ -142,10 +110,13 @@ extern const INT32 gcl_spindash[num_gcl_spindash];
|
|||
extern const INT32 gcl_movement[num_gcl_movement];
|
||||
extern const INT32 gcl_item[num_gcl_item];
|
||||
extern const INT32 gcl_full[num_gcl_full];
|
||||
*/
|
||||
|
||||
// peace to my little coder fingers!
|
||||
// check a gamecontrol being active or not
|
||||
|
||||
INT32 G_GetDevicePlayer(INT32 deviceID);
|
||||
|
||||
// remaps the input event to a game control.
|
||||
void G_MapEventsToControls(event_t *ev);
|
||||
|
||||
|
|
@ -154,16 +125,16 @@ const char *G_KeynumToString(INT32 keynum);
|
|||
INT32 G_KeyStringtoNum(const char *keystr);
|
||||
|
||||
// detach any keys associated to the given game control
|
||||
void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control);
|
||||
void G_ClearControlKeys(INT32 (*setupcontrols)[MAXINPUTMAPPING], INT32 control);
|
||||
void G_ClearAllControlKeys(void);
|
||||
void Command_Setcontrol_f(void);
|
||||
void Command_Setcontrol2_f(void);
|
||||
void Command_Setcontrol3_f(void);
|
||||
void Command_Setcontrol4_f(void);
|
||||
void G_DefineDefaultControls(void);
|
||||
INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen);
|
||||
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen);
|
||||
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[2], INT32 (*fromcontrolsb)[2], INT32 (*fromcontrolsc)[2], INT32 (*fromcontrolsd)[2]);
|
||||
INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify);
|
||||
INT32 G_GetControlScheme(INT32 (*fromcontrols)[MAXINPUTMAPPING], const INT32 *gclist, INT32 gclen);
|
||||
void G_CopyControls(INT32 (*setupcontrols)[MAXINPUTMAPPING], INT32 (*fromcontrols)[MAXINPUTMAPPING], const INT32 *gclist, INT32 gclen);
|
||||
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING]);
|
||||
INT32 G_CheckDoubleUsage(INT32 keynum, INT32 playernum, boolean modify);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -973,10 +973,12 @@ void HU_Ticker(void)
|
|||
hu_tick++;
|
||||
hu_tick &= 7; // currently only to blink chat input cursor
|
||||
|
||||
/*
|
||||
if (PlayerInputDown(1, gc_scores))
|
||||
hu_showscores = !chat_on;
|
||||
else
|
||||
hu_showscores = false;
|
||||
*/
|
||||
|
||||
hu_keystrokes = false;
|
||||
|
||||
|
|
@ -1195,16 +1197,24 @@ boolean HU_Responder(event_t *ev)
|
|||
// (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...)
|
||||
// (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...)
|
||||
|
||||
if (ev->data1 >= KEY_MOUSE1)
|
||||
if (ev->data1 >= NUMKEYS)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 i, j;
|
||||
for (i = 0; i < num_gamecontrols; i++)
|
||||
{
|
||||
if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1)
|
||||
for (j = 0; j < MAXINPUTMAPPING; j++)
|
||||
{
|
||||
if (gamecontrol[0][i][j] == ev->data1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (j < MAXINPUTMAPPING)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == num_gamecontrols)
|
||||
if (i == num_gamecontrols && j == MAXINPUTMAPPING)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1212,6 +1222,7 @@ boolean HU_Responder(event_t *ev)
|
|||
if (!chat_on)
|
||||
{
|
||||
// enter chat mode
|
||||
#if 0
|
||||
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.
|
||||
{
|
||||
|
|
@ -1232,6 +1243,7 @@ boolean HU_Responder(event_t *ev)
|
|||
typelines = 1;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // if chat_on
|
||||
{
|
||||
|
|
@ -1246,9 +1258,9 @@ boolean HU_Responder(event_t *ev)
|
|||
return true;
|
||||
|
||||
// Ignore non-keyboard keys, except when the talk key is bound
|
||||
if (ev->data1 >= KEY_MOUSE1
|
||||
&& (ev->data1 != gamecontrol[0][gc_talkkey][0]
|
||||
&& ev->data1 != gamecontrol[0][gc_talkkey][1]))
|
||||
if (ev->data1 >= NUMKEYS
|
||||
/*&& (ev->data1 != gamecontrol[0][gc_talkkey][0]
|
||||
&& ev->data1 != gamecontrol[0][gc_talkkey][1])*/)
|
||||
return false;
|
||||
|
||||
c = CON_ShiftChar(c);
|
||||
|
|
@ -1310,9 +1322,9 @@ boolean HU_Responder(event_t *ev)
|
|||
I_UpdateMouseGrab();
|
||||
}
|
||||
else if (c == KEY_ESCAPE
|
||||
|| ((c == gamecontrol[0][gc_talkkey][0] || c == gamecontrol[0][gc_talkkey][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.
|
||||
&& c >= NUMKEYS)*/) // If it's not a keyboard key, then the chat button is used as a toggle.
|
||||
{
|
||||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
|
|
|
|||
69
src/k_menu.h
69
src/k_menu.h
|
|
@ -19,6 +19,7 @@
|
|||
#include "command.h"
|
||||
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
|
||||
#include "g_demo.h" //menudemo_t
|
||||
#include "k_profiles.h" // profile data & functions
|
||||
|
||||
// flags for items in the menu
|
||||
// menu handle (what we do when key is pressed
|
||||
|
|
@ -134,6 +135,7 @@ typedef struct menu_s
|
|||
|
||||
void (*drawroutine)(void); // draw routine
|
||||
void (*tickroutine)(void); // ticker routine
|
||||
void (*initroutine)(void); // called when starting a new menu
|
||||
boolean (*quitroutine)(void); // called before quit a menu return true if we can
|
||||
boolean (*inputroutine)(INT32); // if set, called every frame in the input handler. Returning true overwrites normal input handling.
|
||||
} menu_t;
|
||||
|
|
@ -218,6 +220,9 @@ typedef enum
|
|||
mopt_manual,
|
||||
} mopt_e;
|
||||
|
||||
extern menuitem_t OPTIONS_Profiles[];
|
||||
extern menu_t OPTIONS_ProfilesDef;
|
||||
|
||||
extern menuitem_t OPTIONS_Video[];
|
||||
extern menu_t OPTIONS_VideoDef;
|
||||
|
||||
|
|
@ -347,6 +352,36 @@ extern char dummystaffname[22];
|
|||
extern INT16 itemOn; // menu item skull is on, Hack by Tails 09-18-2002
|
||||
extern INT16 skullAnimCounter; // skull animation counter
|
||||
|
||||
extern INT32 menuKey; // keyboard key pressed for menu
|
||||
|
||||
#define MENUDELAYTIME 7
|
||||
#define MENUMINDELAY 2
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MBT_A = 1,
|
||||
MBT_B = 1<<1,
|
||||
MBT_C = 1<<2,
|
||||
MBT_X = 1<<3,
|
||||
MBT_Y = 1<<4,
|
||||
MBT_Z = 1<<5,
|
||||
MBT_L = 1<<6,
|
||||
MBT_R = 1<<7,
|
||||
MBT_START = 1<<8
|
||||
} menuButtonCode_t;
|
||||
|
||||
typedef struct menucmd_s
|
||||
{
|
||||
SINT8 dpad_ud; // up / down dpad
|
||||
SINT8 dpad_lr; // left / right
|
||||
UINT32 buttons; // buttons
|
||||
UINT32 buttonsHeld; // prev frame's buttons
|
||||
UINT16 delay; // menu wait
|
||||
UINT32 delayCount; // num times ya did menu wait (to make the wait shorter each time)
|
||||
} menucmd_t;
|
||||
|
||||
extern menucmd_t menucmd[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern struct menutransition_s {
|
||||
INT16 tics;
|
||||
INT16 dest;
|
||||
|
|
@ -367,6 +402,7 @@ void Addons_option_Onchange(void);
|
|||
void M_SortServerList(void);
|
||||
|
||||
boolean M_Responder(event_t *ev);
|
||||
boolean M_MenuButtonPressed(UINT8 pid, UINT32 bt);
|
||||
void M_StartControlPanel(void);
|
||||
void M_ClearMenus(boolean callexitmenufunc);
|
||||
void M_SelectableClearMenus(INT32 choice);
|
||||
|
|
@ -391,20 +427,22 @@ void M_InitPlayerSetupColors(void);
|
|||
void M_FreePlayerSetupColors(void);
|
||||
|
||||
// If you want to waste a bunch of memory for a limit no one will hit, feel free to boost this to MAXSKINS :P
|
||||
// I figure this will be enough clone characters to fit onto the character select.
|
||||
// (If someone runs into it after release I'll probably boost it, though.)
|
||||
#define MAXCLONES MAXSKINS/16
|
||||
// I figure this will be enough clone characters to fit onto one grid space.
|
||||
#define MAXCLONES MAXSKINS/8
|
||||
|
||||
extern struct setup_chargrid_s {
|
||||
SINT8 skinlist[MAXCLONES];
|
||||
UINT8 numskins;
|
||||
} setup_chargrid[9][9];
|
||||
|
||||
#define CSSTEP_NONE 0
|
||||
#define CSSTEP_CHARS 1
|
||||
#define CSSTEP_ALTS 2
|
||||
#define CSSTEP_COLORS 3
|
||||
#define CSSTEP_READY 4
|
||||
typedef enum
|
||||
{
|
||||
CSSTEP_NONE = 0,
|
||||
CSSTEP_CHARS,
|
||||
CSSTEP_ALTS,
|
||||
CSSTEP_COLORS,
|
||||
CSSTEP_READY
|
||||
} setup_mdepth_t;
|
||||
|
||||
typedef struct setup_player_s
|
||||
{
|
||||
|
|
@ -442,8 +480,9 @@ typedef enum
|
|||
} splitscreencvars_t;
|
||||
extern consvar_t *setup_playercvars[MAXSPLITSCREENPLAYERS][SPLITCV_MAX];
|
||||
|
||||
void M_CharacterSelectInit(INT32 choice);
|
||||
void M_CharacterSelectHandler(INT32 choice);
|
||||
void M_CharacterSelectInit(void);
|
||||
void M_CharacterSelect(INT32 choice);
|
||||
boolean M_CharacterSelectHandler(INT32 choice);
|
||||
void M_CharacterSelectTick(void);
|
||||
boolean M_CharacterSelectQuit(void);
|
||||
|
||||
|
|
@ -584,8 +623,10 @@ void M_OptionsChangeBGColour(INT16 newcolour); // changes the background colour
|
|||
void M_HandleItemToggles(INT32 choice); // For item toggling
|
||||
void M_EraseData(INT32 choice); // For data erasing
|
||||
|
||||
// video modes menu (resolution)
|
||||
// profile selection menu
|
||||
void M_HandleProfileSelect(INT32 ch);
|
||||
|
||||
// video modes menu (resolution)
|
||||
void M_VideoModeMenu(INT32 choice);
|
||||
void M_HandleVideoModes(INT32 ch);
|
||||
|
||||
|
|
@ -682,7 +723,7 @@ char *M_AddonsHeaderPath(void);
|
|||
void M_Manual(INT32 choice);
|
||||
void M_HandleImageDef(INT32 choice);
|
||||
|
||||
// M_MENUDRAW.C
|
||||
// K_MENUDRAW.C
|
||||
|
||||
// flags for text highlights
|
||||
#define highlightflags V_ORANGEMAP
|
||||
|
|
@ -723,6 +764,7 @@ void M_DrawPlaybackMenu(void);
|
|||
void M_DrawOptionsMovingButton(void); // for sick transitions...
|
||||
void M_DrawOptions(void);
|
||||
void M_DrawGenericOptions(void);
|
||||
void M_DrawProfileSelect(void);
|
||||
void M_DrawVideoModes(void);
|
||||
void M_DrawItemToggles(void);
|
||||
|
||||
|
|
@ -750,6 +792,7 @@ void M_DrawAddons(void);
|
|||
M_DrawGenericMenu,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL\
|
||||
}
|
||||
|
||||
|
|
@ -766,6 +809,7 @@ void M_DrawAddons(void);
|
|||
M_DrawKartGamemodeMenu,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL\
|
||||
}
|
||||
|
||||
|
|
@ -781,6 +825,7 @@ void M_DrawAddons(void);
|
|||
M_DrawImageDef,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL\
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ menuitem_t MainMenu[] =
|
|||
{
|
||||
{IT_STRING | IT_CALL, "Play",
|
||||
"Cut to the chase and start the race!", NULL,
|
||||
M_CharacterSelectInit, 0, 0},
|
||||
M_CharacterSelect, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "Extras",
|
||||
"Check out some bonus features.", "MENUI001",
|
||||
|
|
@ -52,7 +52,7 @@ menu_t MainDef = KARTGAMEMODEMENU(MainMenu, NULL);
|
|||
|
||||
menuitem_t PLAY_CharSelect[] =
|
||||
{
|
||||
{IT_NOTHING | IT_KEYHANDLER, NULL, NULL, NULL, M_CharacterSelectHandler, 0, 0},
|
||||
{IT_NOTHING, NULL, NULL, NULL, NULL, 0, 0},
|
||||
};
|
||||
|
||||
menu_t PLAY_CharSelectDef = {
|
||||
|
|
@ -65,8 +65,9 @@ menu_t PLAY_CharSelectDef = {
|
|||
0, 0,
|
||||
M_DrawCharacterSelect,
|
||||
M_CharacterSelectTick,
|
||||
M_CharacterSelectInit,
|
||||
M_CharacterSelectQuit,
|
||||
NULL
|
||||
M_CharacterSelectHandler
|
||||
};
|
||||
|
||||
menuitem_t PLAY_MainMenu[] =
|
||||
|
|
@ -155,6 +156,7 @@ menu_t PLAY_RaceDifficultyDef = {
|
|||
M_DrawRaceDifficulty,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -175,6 +177,7 @@ menu_t PLAY_CupSelectDef = {
|
|||
M_DrawCupSelect,
|
||||
M_CupSelectTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -194,6 +197,7 @@ menu_t PLAY_LevelSelectDef = {
|
|||
M_DrawLevelSelect,
|
||||
M_LevelSelectTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -216,6 +220,7 @@ menu_t PLAY_TimeAttackDef = {
|
|||
M_DrawTimeAttack,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -259,6 +264,7 @@ menu_t PLAY_MP_OptSelectDef = {
|
|||
M_DrawMPOptSelect,
|
||||
M_MPOptSelectTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -294,6 +300,7 @@ menu_t PLAY_MP_HostDef = {
|
|||
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
|
||||
M_DrawMPHost,
|
||||
M_MPOptSelectTick, // This handles the unfolding options
|
||||
NULL,
|
||||
M_MPResetOpts,
|
||||
NULL
|
||||
};
|
||||
|
|
@ -330,6 +337,7 @@ menu_t PLAY_MP_JoinIPDef = {
|
|||
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
|
||||
M_DrawMPJoinIP,
|
||||
M_MPOptSelectTick, // This handles the unfolding options
|
||||
NULL,
|
||||
M_MPResetOpts,
|
||||
M_JoinIPInputs
|
||||
};
|
||||
|
|
@ -351,6 +359,7 @@ menu_t PLAY_MP_RoomSelectDef = {
|
|||
M_DrawMPRoomSelect,
|
||||
M_MPRoomSelectTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -358,8 +367,8 @@ menu_t PLAY_MP_RoomSelectDef = {
|
|||
menuitem_t OPTIONS_Main[] =
|
||||
{
|
||||
|
||||
{IT_STRING | IT_TRANSTEXT, "Profile Setup", "Remap keys & buttons to your likings.",
|
||||
NULL, NULL, 0, 0},
|
||||
{IT_STRING | IT_SUBMENU, "Profile Setup", "Remap keys & buttons to your likings.",
|
||||
NULL, &OPTIONS_ProfilesDef, 0, 0},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, "Video Options", "Change video settings such as the resolution.",
|
||||
NULL, &OPTIONS_VideoDef, 0, 0},
|
||||
|
|
@ -395,9 +404,32 @@ menu_t OPTIONS_MainDef = {
|
|||
M_DrawOptions,
|
||||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
M_OptionsInputs
|
||||
};
|
||||
|
||||
// profiles menu
|
||||
// profile select
|
||||
menuitem_t OPTIONS_Profiles[] = {
|
||||
{IT_KEYHANDLER | IT_NOTHING, NULL, "Select a Profile.",
|
||||
NULL, M_HandleProfileSelect, 0, 0}, // dummy menuitem for the control func
|
||||
};
|
||||
|
||||
menu_t OPTIONS_ProfilesDef = {
|
||||
sizeof (OPTIONS_Profiles) / sizeof (menuitem_t),
|
||||
&OPTIONS_MainDef,
|
||||
0,
|
||||
OPTIONS_Profiles,
|
||||
32, 80,
|
||||
SKINCOLOR_ULTRAMARINE, 0,
|
||||
2, 10,
|
||||
M_DrawProfileSelect,
|
||||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// video options menu...
|
||||
// options menu
|
||||
menuitem_t OPTIONS_Video[] =
|
||||
|
|
@ -457,6 +489,7 @@ menu_t OPTIONS_VideoDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_VideoModes[] = {
|
||||
|
|
@ -478,6 +511,7 @@ menu_t OPTIONS_VideoModesDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
|
@ -536,6 +570,7 @@ menu_t OPTIONS_VideoOGLDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -599,6 +634,7 @@ menu_t OPTIONS_SoundDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_HUD[] =
|
||||
|
|
@ -654,6 +690,7 @@ menu_t OPTIONS_HUDDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_HUDOnline[] =
|
||||
|
|
@ -703,6 +740,7 @@ menu_t OPTIONS_HUDOnlineDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -756,6 +794,7 @@ menu_t OPTIONS_GameplayDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_GameplayItems[] =
|
||||
|
|
@ -801,6 +840,7 @@ menu_t OPTIONS_GameplayItemsDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_Server[] =
|
||||
|
|
@ -865,6 +905,7 @@ menu_t OPTIONS_ServerDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#ifndef NONET
|
||||
|
|
@ -923,6 +964,7 @@ menu_t OPTIONS_ServerAdvancedDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -964,6 +1006,7 @@ menu_t OPTIONS_DataDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_DataAddon[] =
|
||||
|
|
@ -1010,6 +1053,7 @@ menu_t OPTIONS_DataAddonDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_DataScreenshot[] =
|
||||
|
|
@ -1050,6 +1094,7 @@ menu_t OPTIONS_DataScreenshotDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
menuitem_t OPTIONS_DataReplay[] =
|
||||
|
|
@ -1076,6 +1121,7 @@ menu_t OPTIONS_DataReplayDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
|
|
@ -1114,6 +1160,7 @@ menu_t OPTIONS_DataDiscordDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -1147,6 +1194,7 @@ menu_t OPTIONS_DataEraseDef = {
|
|||
M_OptionsTick,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1180,6 +1228,7 @@ menu_t EXTRAS_MainDef = {
|
|||
M_DrawExtras,
|
||||
M_ExtrasTick,
|
||||
NULL,
|
||||
NULL,
|
||||
M_ExtrasInputs
|
||||
};
|
||||
|
||||
|
|
@ -1204,6 +1253,7 @@ menu_t EXTRAS_ReplayHutDef =
|
|||
0, 0,
|
||||
M_DrawReplayHut,
|
||||
NULL,
|
||||
NULL,
|
||||
M_QuitReplayHut,
|
||||
NULL
|
||||
};
|
||||
|
|
@ -1236,6 +1286,7 @@ menu_t EXTRAS_ReplayStartDef =
|
|||
M_DrawReplayStartMenu,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -1276,7 +1327,7 @@ menuitem_t PAUSE_Main[] =
|
|||
NULL, NULL, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "PLAYER SETUP", "M_ICOCHR",
|
||||
NULL, M_CharacterSelectInit, 0, 0},
|
||||
NULL, M_CharacterSelect, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CALL, "OPTIONS", "M_ICOOPT",
|
||||
NULL, M_InitOptions, 0, 0},
|
||||
|
|
@ -1296,6 +1347,7 @@ menu_t PAUSE_MainDef = {
|
|||
M_DrawPause,
|
||||
M_PauseTick,
|
||||
NULL,
|
||||
NULL,
|
||||
M_PauseInputs
|
||||
};
|
||||
|
||||
|
|
@ -1346,6 +1398,7 @@ menu_t PAUSE_PlaybackMenuDef = {
|
|||
M_DrawPlaybackMenu,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -1390,5 +1443,6 @@ menu_t MISC_AddonsDef = {
|
|||
M_DrawAddons,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -834,12 +834,10 @@ static void M_DrawCharSelectPreview(UINT8 num)
|
|||
{
|
||||
V_DrawScaledPatch(x+1, y+36, 0, W_CachePatchName("4PSTART", PU_CACHE));
|
||||
}
|
||||
/*
|
||||
else if (p->mdepth >= CSSTEP_READY)
|
||||
{
|
||||
V_DrawScaledPatch(x+1, y+36, 0, W_CachePatchName("4PREADY", PU_CACHE));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(x+9, y+2, 0, W_CachePatchName("FILEBACK", PU_CACHE));
|
||||
|
|
@ -937,10 +935,15 @@ static void M_DrawCharSelectCursor(UINT8 num)
|
|||
void M_DrawCharacterSelect(void)
|
||||
{
|
||||
UINT8 i, j, k;
|
||||
UINT8 priority = setup_animcounter % setup_numplayers;
|
||||
UINT8 priority = 0;
|
||||
INT16 quadx, quady;
|
||||
SINT8 skin;
|
||||
|
||||
if (setup_numplayers > 0)
|
||||
{
|
||||
priority = setup_animcounter % setup_numplayers;
|
||||
}
|
||||
|
||||
// We have to loop twice -- first time to draw the drop shadows, a second time to draw the icons.
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
|
|
@ -1016,8 +1019,11 @@ void M_DrawCharacterSelect(void)
|
|||
M_DrawCharSelectCursor(i);
|
||||
}
|
||||
|
||||
// Draw the priority player over the other ones
|
||||
M_DrawCharSelectCursor(priority);
|
||||
if (setup_numplayers > 0)
|
||||
{
|
||||
// Draw the priority player over the other ones
|
||||
M_DrawCharSelectCursor(priority);
|
||||
}
|
||||
}
|
||||
|
||||
// DIFFICULTY SELECT
|
||||
|
|
@ -2005,6 +2011,40 @@ void M_DrawGenericOptions(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Draws profile selection
|
||||
void M_DrawProfileSelect(void)
|
||||
{
|
||||
INT32 i;
|
||||
patch_t *card = W_CachePatchName("PR_CARD", PU_CACHE);
|
||||
|
||||
INT32 x = 160;
|
||||
INT32 y = 75 + menutransition.tics*16;
|
||||
|
||||
M_DrawOptionsCogs();
|
||||
M_DrawMenuTooltips();
|
||||
M_DrawOptionsMovingButton();
|
||||
|
||||
for (i=0; i < MAXPROFILES; i++)
|
||||
{
|
||||
profile_t *p = PR_GetProfile(i);
|
||||
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLACK, GTC_CACHE);
|
||||
char pname[PROFILENAMELEN+1] = "EMPTY";
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, p->color, GTC_CACHE);
|
||||
strcpy(pname, p->profilename);
|
||||
}
|
||||
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, FRACUNIT, 0, card, colormap);
|
||||
V_DrawCenteredGamemodeString(x, y+18, 0, 0, pname);
|
||||
|
||||
CONS_Printf("pname %s\n", pname);
|
||||
|
||||
x += 96;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the video modes list, a-la-Quake
|
||||
void M_DrawVideoModes(void)
|
||||
{
|
||||
|
|
|
|||
1795
src/k_menufunc.c
1795
src/k_menufunc.c
File diff suppressed because it is too large
Load diff
98
src/k_profiles.c
Normal file
98
src/k_profiles.c
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_profiles.c
|
||||
/// \brief implements methods for profiles etc.
|
||||
|
||||
#include "k_profiles.h"
|
||||
|
||||
// List of all the profiles.
|
||||
static profile_t profilesList[MAXPROFILES+1]; // +1 because we're gonna add a default "GUEST' profile.
|
||||
static UINT8 numprofiles = 0; // # of loaded profiles
|
||||
|
||||
profile_t PR_MakeProfile(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, INT32 controlarray[num_gamecontrols][MAXINPUTMAPPING])
|
||||
{
|
||||
profile_t new;
|
||||
|
||||
new.version = PROFILEVER;
|
||||
|
||||
strcpy(new.profilename, prname);
|
||||
|
||||
strcpy(new.playername, pname);
|
||||
new.color = col;
|
||||
|
||||
strcpy(new.follower, fname);
|
||||
new.followercolor = fcol;
|
||||
|
||||
// Copy from gamecontrol directly as we'll be setting controls up directly in the profile.
|
||||
memcpy(new.controls, controlarray, sizeof(new.controls));
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
profile_t PR_MakeProfileFromPlayer(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, UINT8 pnum)
|
||||
{
|
||||
// Generate profile using the player's gamecontrol, as we set them directly when making profiles from menus.
|
||||
profile_t new = PR_MakeProfile(prname, pname, col, fname, fcol, gamecontrol[pnum]);
|
||||
|
||||
// Player bound cvars:
|
||||
new.kickstartaccel = cv_kickstartaccel[pnum].value;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
boolean PR_AddProfile(profile_t p)
|
||||
{
|
||||
if (numprofiles < MAXPROFILES)
|
||||
{
|
||||
memcpy(&profilesList[numprofiles], &p, sizeof(profile_t));
|
||||
numprofiles++;
|
||||
|
||||
CONS_Printf("Profile '%s' added\n", p.profilename);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
profile_t* PR_GetProfile(INT32 num)
|
||||
{
|
||||
if (num < numprofiles)
|
||||
return &profilesList[num];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PR_SaveProfiles(void)
|
||||
{
|
||||
FILE *f = NULL;
|
||||
|
||||
f = fopen(PROFILESFILE, "w");
|
||||
if (f != NULL)
|
||||
{
|
||||
fwrite(profilesList, sizeof(profile_t), MAXPROFILES, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
void PR_LoadProfiles(void)
|
||||
{
|
||||
//FILE *f = NULL;
|
||||
profile_t dprofile = PR_MakeProfile(PROFILEDEFAULTNAME, PROFILEDEFAULTPNAME, PROFILEDEFAULTCOLOR, PROFILEDEFAULTFOLLOWER, PROFILEDEFAULTFOLLOWERCOLOR, gamecontroldefault);
|
||||
PR_AddProfile(dprofile);
|
||||
|
||||
/*f = fopen(PROFILESFILE, "r");
|
||||
|
||||
if (f != NULL)
|
||||
{
|
||||
fread(&profilesList[1], sizeof(profile_t)*(MAXPROFILES), MAXPROFILES, f);
|
||||
fclose(f);
|
||||
}*/
|
||||
}
|
||||
101
src/k_profiles.h
Normal file
101
src/k_profiles.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file k_profiles.h
|
||||
/// \brief Control profiles definition
|
||||
|
||||
#ifndef __PROFILES_H__
|
||||
#define __PROFILES_H__
|
||||
|
||||
#include "doomdef.h" // MAXPLAYERNAME
|
||||
//#include "r_skins.h" // SKINNAMESIZE // This cuases stupid issues.
|
||||
#include "g_input.h" // Input related stuff
|
||||
#include "string.h" // strcpy etc
|
||||
#include "g_game.h" // game CVs
|
||||
|
||||
// We have to redefine this because somehow including r_skins.h causes a redefinition of node_t since that's used for both net nodes and BSP nodes too......
|
||||
// And honestly I don't wanna refactor that.
|
||||
#define SKINNAMESIZE 16
|
||||
|
||||
#define PROFILENAMELEN 6
|
||||
#define PROFILEVER 1
|
||||
#define MAXPROFILES 16
|
||||
#define PROFILESFILE "kartprofiles.cfg"
|
||||
|
||||
#define PROFILEDEFAULTNAME "GUEST"
|
||||
#define PROFILEDEFAULTPNAME "Player"
|
||||
#define PROFILEDEFAULTSKIN "sonic"
|
||||
#define PROFILEDEFAULTCOLOR SKINCOLOR_SAPPHIRE
|
||||
#define PROFILEDEFAULTFOLLOWER "none"
|
||||
#define PROFILEDEFAULTFOLLOWERCOLOR 255
|
||||
|
||||
// Man I wish I had more than 16 friends!!
|
||||
|
||||
// profile_t definition (WIP)
|
||||
typedef struct profile_s
|
||||
{
|
||||
|
||||
// Versionning
|
||||
UINT8 version; // Version of the profile, this can be useful for backwards compatibility reading if we ever update the profile structure/format after release.
|
||||
// A version of 0 can easily be checked to identify an unitialized profile.
|
||||
|
||||
// Profile header
|
||||
char profilename[PROFILENAMELEN+1]; // Profile name (not to be confused with player name)
|
||||
|
||||
// Player data
|
||||
char playername[MAXPLAYERNAME+1]; // Player name
|
||||
UINT16 color; // Default player coloUr. ...But for consistency we'll name it color.
|
||||
char follower[SKINNAMESIZE+1]; // Follower
|
||||
UINT16 followercolor; // Follower color
|
||||
|
||||
// Player-specific consvars.
|
||||
// @TODO: List all of those
|
||||
boolean kickstartaccel; // cv_kickstartaccel
|
||||
|
||||
// Finally, control data itself
|
||||
INT32 controls[num_gamecontrols][MAXINPUTMAPPING]; // Lists of all the controls, defined the same way as default inputs in g_input.c
|
||||
} profile_t;
|
||||
|
||||
|
||||
// Functions
|
||||
|
||||
// PR_MakeProfile
|
||||
// Makes a profile from the supplied profile name, player name, colour, follower, followercolour and controls.
|
||||
// The consvar values are left untouched.
|
||||
profile_t PR_MakeProfile(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, INT32 controlarray[num_gamecontrols][MAXINPUTMAPPING]);
|
||||
|
||||
// PR_MakeProfileFromPlayer
|
||||
// Makes a profile_t from the supplied profile name, player name, colour, follower and followercolour.
|
||||
// The last argument is a player number to read cvars from; as for convenience, cvars will be set directly when making a profile (since loading another one will overwrite them, this will be inconsequential)
|
||||
profile_t PR_MakeProfileFromPlayer(const char *prname, const char *pname, const UINT16 col, const char *fname, UINT16 fcol, UINT8 pnum);
|
||||
|
||||
// PR_AddProfile(profile_t p)
|
||||
// Adds a profile to profilesList and increments numprofiles.
|
||||
// Returns true if succesful, false if not.
|
||||
boolean PR_AddProfile(profile_t p);
|
||||
|
||||
// PR_GetProfile(INT32 num)
|
||||
// Returns a pointer to the profile you're asking for or NULL if the profile is uninitialized.
|
||||
profile_t* PR_GetProfile(INT32 num);
|
||||
|
||||
// PR_SaveProfiles(void)
|
||||
// Saves all the profiles in profiles.cfg
|
||||
// This does not save profilesList[0] since that's always going to be the default profile.
|
||||
void PR_SaveProfiles(void);
|
||||
|
||||
// PR_LoadProfiles(void)
|
||||
// Loads all the profiles saved in profiles.cfg.
|
||||
// This also loads
|
||||
void PR_LoadProfiles(void);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
11579
src/m_menu.c
Normal file
11579
src/m_menu.c
Normal file
File diff suppressed because it is too large
Load diff
20
src/m_misc.c
20
src/m_misc.c
|
|
@ -624,7 +624,7 @@ void Command_LoadConfig_f(void)
|
|||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
G_CopyControls(gamecontrol[i], gamecontroldefault[i][gcs_kart], NULL, 0);
|
||||
G_CopyControls(gamecontrol[i], gamecontroldefault, NULL, 0);
|
||||
}
|
||||
|
||||
// temporarily reset execversion to default
|
||||
|
|
@ -678,7 +678,7 @@ void M_FirstLoadConfig(void)
|
|||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
G_CopyControls(gamecontrol[i], gamecontroldefault[i][gcs_kart], NULL, 0);
|
||||
G_CopyControls(gamecontrol[i], gamecontroldefault, NULL, 0);
|
||||
}
|
||||
|
||||
// register execversion here before we load any configs
|
||||
|
|
@ -780,15 +780,7 @@ void M_SaveConfig(const char *filename)
|
|||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (tutorialmode && tutorialgcs)
|
||||
{
|
||||
// using gcs_custom as temp storage
|
||||
G_SaveKeySetting(f, gamecontroldefault[0][gcs_custom], gamecontrol[1], gamecontrol[2], gamecontrol[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SaveKeySetting(f, gamecontrol[0], gamecontrol[1], gamecontrol[2], gamecontrol[3]);
|
||||
}
|
||||
G_SaveKeySetting(f, gamecontrol[0], gamecontrol[1], gamecontrol[2], gamecontrol[3]);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
|
@ -1768,12 +1760,12 @@ boolean M_ScreenshotResponder(event_t *ev)
|
|||
|
||||
ch = ev->data1;
|
||||
|
||||
if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
|
||||
if (ch >= NUMKEYS && menuactive) // If it's not a keyboard key, then don't allow it in the menus!
|
||||
return false;
|
||||
|
||||
if (ch == KEY_F8 || ch == gamecontrol[0][gc_screenshot][0] || ch == gamecontrol[0][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[0][gc_recordgif][0] || ch == gamecontrol[0][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;
|
||||
|
|
|
|||
119
src/p_mobj.c
119
src/p_mobj.c
|
|
@ -3106,12 +3106,6 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
}
|
||||
}
|
||||
|
||||
if (mobj->watertop > top2)
|
||||
mobj->watertop = top2;
|
||||
|
||||
if (mobj->waterbottom < bot2)
|
||||
mobj->waterbottom = bot2;
|
||||
|
||||
// Spectators and dead players don't get to do any of the things after this.
|
||||
if (p && (p->spectator || p->playerstate != PST_LIVE))
|
||||
{
|
||||
|
|
@ -3119,8 +3113,10 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
}
|
||||
|
||||
// The rest of this code only executes on a water state change.
|
||||
if (!!(mobj->eflags & MFE_UNDERWATER) == wasinwater)
|
||||
if (waterwasnotset || !!(mobj->eflags & MFE_UNDERWATER) == wasinwater)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (p && !p->waterskip &&
|
||||
p->curshield != KSHIELD_BUBBLE && wasinwater)
|
||||
|
|
@ -3157,62 +3153,6 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
diff = -diff;
|
||||
}
|
||||
|
||||
// Time to spawn the bubbles!
|
||||
{
|
||||
INT32 i;
|
||||
INT32 bubblecount;
|
||||
UINT8 prandom[4];
|
||||
mobj_t *bubble;
|
||||
mobjtype_t bubbletype;
|
||||
|
||||
if (mobj->eflags & MFE_GOOWATER || wasingoo)
|
||||
S_StartSound(mobj, sfx_ghit);
|
||||
else if (mobj->eflags & MFE_TOUCHLAVA)
|
||||
S_StartSound(mobj, sfx_splash);
|
||||
else
|
||||
S_StartSound(mobj, sfx_splish); // And make a sound!
|
||||
|
||||
bubblecount = FixedDiv(abs(mobj->momz), mobj->scale)>>(FRACBITS-1);
|
||||
// Max bubble count
|
||||
if (bubblecount > 128)
|
||||
bubblecount = 128;
|
||||
|
||||
// Create tons of bubbles
|
||||
for (i = 0; i < bubblecount; i++)
|
||||
{
|
||||
// P_RandomByte()s are called individually to allow consistency
|
||||
// across various compilers, since the order of function calls
|
||||
// in C is not part of the ANSI specification.
|
||||
prandom[0] = P_RandomByte();
|
||||
prandom[1] = P_RandomByte();
|
||||
prandom[2] = P_RandomByte();
|
||||
prandom[3] = P_RandomByte();
|
||||
|
||||
bubbletype = MT_SMALLBUBBLE;
|
||||
if (!(prandom[0] & 0x3)) // medium bubble chance up to 64 from 32
|
||||
bubbletype = MT_MEDIUMBUBBLE;
|
||||
|
||||
bubble = P_SpawnMobj(
|
||||
mobj->x + FixedMul((prandom[1]<<(FRACBITS-3)) * (prandom[0]&0x80 ? 1 : -1), mobj->scale),
|
||||
mobj->y + FixedMul((prandom[2]<<(FRACBITS-3)) * (prandom[0]&0x40 ? 1 : -1), mobj->scale),
|
||||
mobj->z + FixedMul((prandom[3]<<(FRACBITS-2)), mobj->scale), bubbletype);
|
||||
|
||||
if (bubble)
|
||||
{
|
||||
if (P_MobjFlip(mobj)*mobj->momz < 0)
|
||||
bubble->momz = mobj->momz >> 4;
|
||||
else
|
||||
bubble->momz = 0;
|
||||
|
||||
bubble->destscale = mobj->scale;
|
||||
P_SetScale(bubble, mobj->scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (waterwasnotset)
|
||||
return;
|
||||
|
||||
// Check to make sure you didn't just cross into a sector to jump out of
|
||||
// that has shallower water than the block you were originally in.
|
||||
if (diff <= (height >> 1))
|
||||
|
|
@ -3314,6 +3254,59 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
P_SetScale(splish, mobj->scale);
|
||||
}
|
||||
}
|
||||
|
||||
// Time to spawn the bubbles!
|
||||
{
|
||||
INT32 i;
|
||||
INT32 bubblecount;
|
||||
UINT8 prandom[4];
|
||||
mobj_t *bubble;
|
||||
mobjtype_t bubbletype;
|
||||
|
||||
if (mobj->eflags & MFE_GOOWATER || wasingoo)
|
||||
S_StartSound(mobj, sfx_ghit);
|
||||
else if (mobj->eflags & MFE_TOUCHLAVA)
|
||||
S_StartSound(mobj, sfx_splash);
|
||||
else
|
||||
S_StartSound(mobj, sfx_splish); // And make a sound!
|
||||
|
||||
bubblecount = FixedDiv(abs(mobj->momz), mobj->scale) >> (FRACBITS-1);
|
||||
// Max bubble count
|
||||
if (bubblecount > 128)
|
||||
bubblecount = 128;
|
||||
|
||||
// Create tons of bubbles
|
||||
for (i = 0; i < bubblecount; i++)
|
||||
{
|
||||
// P_RandomByte()s are called individually to allow consistency
|
||||
// across various compilers, since the order of function calls
|
||||
// in C is not part of the ANSI specification.
|
||||
prandom[0] = P_RandomByte();
|
||||
prandom[1] = P_RandomByte();
|
||||
prandom[2] = P_RandomByte();
|
||||
prandom[3] = P_RandomByte();
|
||||
|
||||
bubbletype = MT_SMALLBUBBLE;
|
||||
if (!(prandom[0] & 0x3)) // medium bubble chance up to 64 from 32
|
||||
bubbletype = MT_MEDIUMBUBBLE;
|
||||
|
||||
bubble = P_SpawnMobj(
|
||||
mobj->x + FixedMul((prandom[1]<<(FRACBITS-3)) * (prandom[0]&0x80 ? 1 : -1), mobj->scale),
|
||||
mobj->y + FixedMul((prandom[2]<<(FRACBITS-3)) * (prandom[0]&0x40 ? 1 : -1), mobj->scale),
|
||||
mobj->z + FixedMul((prandom[3]<<(FRACBITS-2)), mobj->scale), bubbletype);
|
||||
|
||||
if (bubble)
|
||||
{
|
||||
if (P_MobjFlip(mobj)*mobj->momz < 0)
|
||||
bubble->momz = mobj->momz >> 4;
|
||||
else
|
||||
bubble->momz = 0;
|
||||
|
||||
bubble->destscale = mobj->scale;
|
||||
P_SetScale(bubble, mobj->scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@
|
|||
#include "k_grandprix.h"
|
||||
#include "k_terrain.h" // TRF_TRIPWIRE
|
||||
#include "k_brightmap.h"
|
||||
#include "k_terrain.h" // TRF_TRIPWIRE
|
||||
#include "k_director.h" // K_InitDirector
|
||||
|
||||
// Replay names have time
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ void P_Ticker(boolean run)
|
|||
G_WriteAllGhostTics();
|
||||
|
||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && PlayerInputDown(1, gc_lookback))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && G_PlayerInputDown(0, gc_y, 0))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
}
|
||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||
|
|
|
|||
|
|
@ -2695,12 +2695,14 @@ void P_InitCameraCmd(void)
|
|||
|
||||
static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
{
|
||||
/*
|
||||
INT32 forward, axis; //i
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, mouseaiming;
|
||||
boolean invertmouse, lookaxis, usejoystick, kbl;
|
||||
INT32 player_invert;
|
||||
INT32 screen_invert;
|
||||
*/
|
||||
ticcmd_t *cmd = &cameracmd;
|
||||
|
||||
(void)cam;
|
||||
|
|
@ -2708,6 +2710,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
if (!demo.playback)
|
||||
return cmd; // empty cmd, no.
|
||||
|
||||
/*
|
||||
kbl = democam.keyboardlook;
|
||||
|
||||
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
|
||||
|
|
@ -2752,7 +2755,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
cmd->turning -= (mousex * 8) * (encoremode ? -1 : 1);
|
||||
|
||||
axis = PlayerJoyAxis(1, AXISMOVE);
|
||||
if (PlayerInputDown(1, gc_accelerate) || (usejoystick && axis > 0))
|
||||
if (PlayerInputDown(1, gc_a) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
axis = PlayerJoyAxis(1, AXISBRAKE);
|
||||
if (PlayerInputDown(1, gc_brake) || (usejoystick && axis > 0))
|
||||
|
|
@ -2798,8 +2801,6 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
if (PlayerInputDown(1, gc_centerview)) // No need to put a spectator limit on this one though :V
|
||||
cmd->aiming = 0;
|
||||
|
||||
mousex = mousey = mlooky = 0;
|
||||
|
||||
cmd->forwardmove += (SINT8)forward;
|
||||
|
||||
if (cmd->forwardmove > MAXPLMOVE)
|
||||
|
|
@ -2813,6 +2814,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
|||
cmd->turning = -KART_FULLTURN;
|
||||
|
||||
democam.keyboardlook = kbl;
|
||||
*/
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,6 +197,48 @@ static char returnWadPath[256];
|
|||
#include "../byteptr.h"
|
||||
#endif
|
||||
|
||||
void I_StoreExJoystick(SDL_Joystick *dev)
|
||||
{
|
||||
// ExJoystick is a massive hack to avoid needing to completely
|
||||
// rewrite pretty much all of the controller support from scratch...
|
||||
|
||||
// Used in favor of most instances of SDL_JoystickClose.
|
||||
// If a joystick would've been discarded, then save it in an array,
|
||||
// because we want it have it for the joystick input screen.
|
||||
|
||||
int index = 0;
|
||||
|
||||
if (dev == NULL)
|
||||
{
|
||||
// No joystick?
|
||||
return;
|
||||
}
|
||||
|
||||
index = SDL_JoystickInstanceID(dev);
|
||||
|
||||
if (index >= MAXGAMEPADS || index < 0)
|
||||
{
|
||||
// Not enough space to save this joystick, completely discard.
|
||||
SDL_JoystickClose(dev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ExJoystick[index] == dev)
|
||||
{
|
||||
// No need to do anything else.
|
||||
return;
|
||||
}
|
||||
|
||||
if (ExJoystick[index] != NULL)
|
||||
{
|
||||
// Discard joystick in the old slot.
|
||||
SDL_JoystickClose(ExJoystick[index]);
|
||||
}
|
||||
|
||||
// Keep for safe-keeping.
|
||||
ExJoystick[index] = dev;
|
||||
}
|
||||
|
||||
/** \brief The JoyReset function
|
||||
|
||||
\param JoySet Joystick info to reset
|
||||
|
|
@ -207,7 +249,7 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
|
|||
{
|
||||
if (JoySet->dev)
|
||||
{
|
||||
SDL_JoystickClose(JoySet->dev);
|
||||
I_StoreExJoystick(JoySet->dev);
|
||||
}
|
||||
JoySet->dev = NULL;
|
||||
JoySet->oldjoy = -1;
|
||||
|
|
@ -222,6 +264,7 @@ static INT32 joystick_started[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
|
|||
/** \brief SDL info about joystick 1
|
||||
*/
|
||||
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS];
|
||||
SDL_Joystick *ExJoystick[MAXGAMEPADS];
|
||||
|
||||
SDL_bool consolevent = SDL_FALSE;
|
||||
SDL_bool framebuffer = SDL_FALSE;
|
||||
|
|
@ -963,7 +1006,7 @@ INT32 I_GetJoystickDeviceIndex(SDL_Joystick *dev)
|
|||
}
|
||||
|
||||
if (j == MAXSPLITSCREENPLAYERS)
|
||||
SDL_JoystickClose(test);
|
||||
I_StoreExJoystick(test);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1030,44 +1073,39 @@ void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer)
|
|||
}
|
||||
}
|
||||
|
||||
/** \brief Joystick buttons states
|
||||
*/
|
||||
static UINT64 lastjoybuttons[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
|
||||
|
||||
/** \brief Joystick hats state
|
||||
*/
|
||||
static UINT64 lastjoyhats[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
|
||||
|
||||
/** \brief Shuts down joystick
|
||||
\return void
|
||||
*/
|
||||
void I_ShutdownJoystick(UINT8 index)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 i, j;
|
||||
event_t event;
|
||||
event.type=ev_keyup;
|
||||
|
||||
event.device = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
|
||||
event.type = ev_keyup;
|
||||
event.data2 = 0;
|
||||
event.data3 = 0;
|
||||
|
||||
lastjoybuttons[index] = lastjoyhats[index] = 0;
|
||||
|
||||
// emulate the up of all joystick buttons
|
||||
for (i=0;i<JOYBUTTONS;i++)
|
||||
for (i = 0; i < JOYBUTTONS; i++)
|
||||
{
|
||||
event.data1=KEY_JOY1+i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
// emulate the up of all joystick hats
|
||||
for (i=0;i<JOYHATS*4;i++)
|
||||
for (i = 0; i < JOYHATS*4; i++)
|
||||
{
|
||||
event.data1=KEY_HAT1+i;
|
||||
D_PostEvent(&event);
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
event.data1 = KEY_HAT1 + (i * 4) + j;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
// reset joystick position
|
||||
event.type = ev_joystick;
|
||||
for (i=0;i<JOYAXISSET; i++)
|
||||
for (i = 0; i < JOYAXISSET; i++)
|
||||
{
|
||||
event.data1 = i;
|
||||
D_PostEvent(&event);
|
||||
|
|
@ -1079,136 +1117,6 @@ void I_ShutdownJoystick(UINT8 index)
|
|||
// don't shut down the subsystem here, because hotplugging
|
||||
}
|
||||
|
||||
void I_GetJoystickEvents(UINT8 index)
|
||||
{
|
||||
static event_t event = {0,0,0,0};
|
||||
INT32 i = 0;
|
||||
UINT64 joyhats = 0;
|
||||
#if 0
|
||||
UINT64 joybuttons = 0;
|
||||
Sint16 axisx, axisy;
|
||||
#endif
|
||||
|
||||
if (!joystick_started[index]) return;
|
||||
|
||||
if (!JoyInfo[index].dev) //I_ShutdownJoystick(index);
|
||||
return;
|
||||
|
||||
#if 0
|
||||
//faB: look for as much buttons as g_input code supports,
|
||||
// we don't use the others
|
||||
for (i = JoyInfo[index].buttons - 1; i >= 0; i--)
|
||||
{
|
||||
joybuttons <<= 1;
|
||||
if (SDL_JoystickGetButton(JoyInfo[index].dev,i))
|
||||
joybuttons |= 1;
|
||||
}
|
||||
|
||||
if (joybuttons != lastjoybuttons[index])
|
||||
{
|
||||
INT64 j = 1; // keep only bits that changed since last time
|
||||
INT64 newbuttons = joybuttons ^ lastjoybuttons[index];
|
||||
lastjoybuttons[index] = joybuttons;
|
||||
|
||||
for (i = 0; i < JOYBUTTONS; i++, j <<= 1)
|
||||
{
|
||||
if (newbuttons & j) // button changed state?
|
||||
{
|
||||
if (joybuttons & j)
|
||||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_JOY1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = JoyInfo[index].hats - 1; i >= 0; i--)
|
||||
{
|
||||
Uint8 hat = SDL_JoystickGetHat(JoyInfo[index].dev, i);
|
||||
|
||||
if (hat & SDL_HAT_UP ) joyhats|=(UINT64)0x1<<(0 + 4*i);
|
||||
if (hat & SDL_HAT_DOWN ) joyhats|=(UINT64)0x1<<(1 + 4*i);
|
||||
if (hat & SDL_HAT_LEFT ) joyhats|=(UINT64)0x1<<(2 + 4*i);
|
||||
if (hat & SDL_HAT_RIGHT) joyhats|=(UINT64)0x1<<(3 + 4*i);
|
||||
}
|
||||
|
||||
if (joyhats != lastjoyhats[index])
|
||||
{
|
||||
INT64 j = 1; // keep only bits that changed since last time
|
||||
INT64 newhats = joyhats ^ lastjoyhats[index];
|
||||
lastjoyhats[index] = joyhats;
|
||||
|
||||
for (i = 0; i < JOYHATS*4; i++, j <<= 1)
|
||||
{
|
||||
if (newhats & j) // hat changed state?
|
||||
{
|
||||
if (joyhats & j)
|
||||
event.type = ev_keydown;
|
||||
else
|
||||
event.type = ev_keyup;
|
||||
event.data1 = KEY_HAT1 + i;
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// send joystick axis positions
|
||||
event.type = ev_joystick;
|
||||
|
||||
for (i = JOYAXISSET - 1; i >= 0; i--)
|
||||
{
|
||||
event.data1 = i;
|
||||
if (i*2 + 1 <= JoyInfo[index].axises)
|
||||
axisx = SDL_JoystickGetAxis(JoyInfo[index].dev, i*2 + 0);
|
||||
else axisx = 0;
|
||||
if (i*2 + 2 <= JoyInfo[index].axises)
|
||||
axisy = SDL_JoystickGetAxis(JoyInfo[index].dev, i*2 + 1);
|
||||
else axisy = 0;
|
||||
|
||||
|
||||
// -32768 to 32767
|
||||
axisx = axisx/32;
|
||||
axisy = axisy/32;
|
||||
|
||||
|
||||
if (Joystick[index].bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (axisx < -(JOYAXISRANGE/2))
|
||||
event.data2 = -1;
|
||||
else if (axisx > (JOYAXISRANGE/2))
|
||||
event.data2 = 1;
|
||||
else event.data2 = 0;
|
||||
if (axisy < -(JOYAXISRANGE/2))
|
||||
event.data3 = -1;
|
||||
else if (axisy > (JOYAXISRANGE/2))
|
||||
event.data3 = 1;
|
||||
else event.data3 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
axisx = JoyInfo[index].scale?((axisx/JoyInfo[index].scale)*JoyInfo[index].scale):axisx;
|
||||
axisy = JoyInfo[index].scale?((axisy/JoyInfo[index].scale)*JoyInfo[index].scale):axisy;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= axisx && axisx <= SDL_JDEADZONE) axisx = 0;
|
||||
if (-SDL_JDEADZONE <= axisy && axisy <= SDL_JDEADZONE) axisy = 0;
|
||||
#endif
|
||||
|
||||
// analog control style , just send the raw data
|
||||
event.data2 = axisx; // x axis
|
||||
event.data3 = axisy; // y axis
|
||||
}
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Open joystick handle
|
||||
|
||||
\param fname name of joystick
|
||||
|
|
@ -1373,7 +1281,7 @@ void I_InitJoystick(UINT8 index)
|
|||
if (i == MAXSPLITSCREENPLAYERS)
|
||||
{
|
||||
// Joystick didn't end up being used
|
||||
SDL_JoystickClose(newjoy);
|
||||
I_StoreExJoystick(newjoy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -526,95 +526,31 @@ static inline void SDLJoyRemap(event_t *event)
|
|||
(void)event;
|
||||
}
|
||||
|
||||
static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
||||
static INT32 SDLJoyAxis(const Sint16 axis, UINT8 pid)
|
||||
{
|
||||
// -32768 to 32767
|
||||
INT32 raxis = axis/32;
|
||||
if (which == ev_joystick)
|
||||
INT32 raxis = axis / 32;
|
||||
|
||||
if (Joystick[pid].bGamepadStyle)
|
||||
{
|
||||
if (Joystick[0].bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else
|
||||
raxis = 0;
|
||||
}
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo[0].scale!=1?((raxis/JoyInfo[0].scale)*JoyInfo[0].scale):raxis;
|
||||
raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = (JoyInfo[pid].scale != 1) ? ((raxis / JoyInfo[pid].scale) * JoyInfo[pid].scale) : raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (which == ev_joystick2)
|
||||
{
|
||||
if (Joystick[1].bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo[1].scale!=1?((raxis/JoyInfo[1].scale)*JoyInfo[1].scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (which == ev_joystick3)
|
||||
{
|
||||
if (Joystick[2].bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo[2].scale!=1?((raxis/JoyInfo[2].scale)*JoyInfo[2].scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (which == ev_joystick4)
|
||||
{
|
||||
if (Joystick[3].bGamepadStyle)
|
||||
{
|
||||
// gamepad control type, on or off, live or die
|
||||
if (raxis < -(JOYAXISRANGE/2))
|
||||
raxis = -1;
|
||||
else if (raxis > (JOYAXISRANGE/2))
|
||||
raxis = 1;
|
||||
else raxis = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
raxis = JoyInfo[3].scale!=1?((raxis/JoyInfo[3].scale)*JoyInfo[3].scale):raxis;
|
||||
|
||||
#ifdef SDL_JDEADZONE
|
||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||
raxis = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return raxis;
|
||||
}
|
||||
|
||||
|
|
@ -679,7 +615,8 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
{
|
||||
SDLforceUngrabMouse();
|
||||
}
|
||||
memset(gamekeydown, 0, NUMKEYS); // TODO this is a scary memset
|
||||
memset(gamekeydown, 0, sizeof(gamekeydown)); // TODO this is a scary memset
|
||||
memset(deviceResponding, false, sizeof (deviceResponding));
|
||||
|
||||
if (MOUSE_MENU)
|
||||
{
|
||||
|
|
@ -692,6 +629,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
|
||||
{
|
||||
event_t event;
|
||||
|
||||
event.device = 0;
|
||||
|
||||
if (type == SDL_KEYUP)
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
|
|
@ -773,6 +713,8 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
|
|||
/// \todo inputEvent.button.which
|
||||
if (USE_MOUSEINPUT)
|
||||
{
|
||||
event.device = 0;
|
||||
|
||||
if (type == SDL_MOUSEBUTTONUP)
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
|
|
@ -805,6 +747,8 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
|
|||
|
||||
SDL_memset(&event, 0, sizeof(event_t));
|
||||
|
||||
event.device = 0;
|
||||
|
||||
if (evt.y > 0)
|
||||
{
|
||||
event.data1 = KEY_MOUSEWHEELUP;
|
||||
|
|
@ -829,114 +773,99 @@ static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
|
|||
static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[MAXSPLITSCREENPLAYERS];
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
joyid[i] = SDL_JoystickInstanceID(JoyInfo[i].dev);
|
||||
event.type = ev_joystick;
|
||||
|
||||
event.device = 1 + evt.which;
|
||||
if (event.device == INT32_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
evt.axis++;
|
||||
event.data1 = event.data2 = event.data3 = INT32_MAX;
|
||||
|
||||
if (evt.which == joyid[0])
|
||||
{
|
||||
event.type = ev_joystick;
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
{
|
||||
event.type = ev_joystick2;
|
||||
}
|
||||
else if (evt.which == joyid[2])
|
||||
{
|
||||
event.type = ev_joystick3;
|
||||
}
|
||||
else if (evt.which == joyid[3])
|
||||
{
|
||||
event.type = ev_joystick4;
|
||||
}
|
||||
else return;
|
||||
//axis
|
||||
if (evt.axis > JOYAXISSET*2)
|
||||
{
|
||||
return;
|
||||
//vaule
|
||||
if (evt.axis%2)
|
||||
}
|
||||
|
||||
//vaule[sic]
|
||||
if (evt.axis % 2)
|
||||
{
|
||||
event.data1 = evt.axis / 2;
|
||||
event.data2 = SDLJoyAxis(evt.value, event.type);
|
||||
event.data2 = SDLJoyAxis(evt.value, 0); // TODO: replace 0 with pid
|
||||
}
|
||||
else
|
||||
{
|
||||
evt.axis--;
|
||||
event.data1 = evt.axis / 2;
|
||||
event.data3 = SDLJoyAxis(evt.value, event.type);
|
||||
event.data3 = SDLJoyAxis(evt.value, 0); // TODO: replace 0 with pid
|
||||
}
|
||||
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void Impl_HandleJoystickHatEvent(SDL_JoyHatEvent evt)
|
||||
static void Impl_SendHatEvent(SDL_JoyHatEvent evt, UINT64 hatFlag, UINT8 keyOffset)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[MAXSPLITSCREENPLAYERS];
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
joyid[i] = SDL_JoystickInstanceID(JoyInfo[i].dev);
|
||||
event.device = 1 + evt.which;
|
||||
if (event.device == INT32_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.hat >= JOYHATS)
|
||||
return; // ignore hats with too high an index
|
||||
event.data1 = KEY_HAT1 + keyOffset;
|
||||
|
||||
if (evt.which == joyid[0])
|
||||
if (evt.hat < JOYHATS)
|
||||
{
|
||||
event.data1 = KEY_HAT1 + (evt.hat*4);
|
||||
event.data1 += (evt.hat * 4);
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
else
|
||||
{
|
||||
event.data1 = KEY_2HAT1 + (evt.hat*4);
|
||||
return;
|
||||
}
|
||||
else if (evt.which == joyid[2])
|
||||
{
|
||||
event.data1 = KEY_3HAT1 + (evt.hat*4);
|
||||
}
|
||||
else if (evt.which == joyid[3])
|
||||
{
|
||||
event.data1 = KEY_4HAT1 + (evt.hat*4);
|
||||
}
|
||||
else return;
|
||||
|
||||
// NOTE: UNFINISHED
|
||||
if (evt.value & hatFlag)
|
||||
{
|
||||
event.type = ev_keydown;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
}
|
||||
|
||||
SDLJoyRemap(&event);
|
||||
|
||||
if (event.type != ev_console)
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
static void Impl_HandleJoystickHatEvent(SDL_JoyHatEvent evt)
|
||||
{
|
||||
Impl_SendHatEvent(evt, SDL_HAT_UP, 0);
|
||||
Impl_SendHatEvent(evt, SDL_HAT_DOWN, 1);
|
||||
Impl_SendHatEvent(evt, SDL_HAT_LEFT, 2);
|
||||
Impl_SendHatEvent(evt, SDL_HAT_RIGHT, 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
|
||||
{
|
||||
event_t event;
|
||||
SDL_JoystickID joyid[MAXSPLITSCREENPLAYERS];
|
||||
UINT8 i;
|
||||
|
||||
// Determine the Joystick IDs for each current open joystick
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
joyid[i] = SDL_JoystickInstanceID(JoyInfo[i].dev);
|
||||
event.device = 1 + evt.which;
|
||||
|
||||
if (evt.which == joyid[0])
|
||||
if (event.device == INT32_MAX)
|
||||
{
|
||||
event.data1 = KEY_JOY1;
|
||||
return;
|
||||
}
|
||||
else if (evt.which == joyid[1])
|
||||
{
|
||||
event.data1 = KEY_2JOY1;
|
||||
}
|
||||
else if (evt.which == joyid[2])
|
||||
{
|
||||
event.data1 = KEY_3JOY1;
|
||||
}
|
||||
else if (evt.which == joyid[3])
|
||||
{
|
||||
event.data1 = KEY_4JOY1;
|
||||
}
|
||||
else return;
|
||||
|
||||
event.data1 = KEY_JOY1;
|
||||
|
||||
if (type == SDL_JOYBUTTONUP)
|
||||
{
|
||||
event.type = ev_keyup;
|
||||
|
|
@ -945,19 +874,28 @@ static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
|
|||
{
|
||||
event.type = ev_keydown;
|
||||
}
|
||||
else return;
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.button < JOYBUTTONS)
|
||||
{
|
||||
event.data1 += evt.button;
|
||||
}
|
||||
else return;
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDLJoyRemap(&event);
|
||||
if (event.type != ev_console) D_PostEvent(&event);
|
||||
|
||||
if (event.type != ev_console)
|
||||
{
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void I_GetEvent(void)
|
||||
{
|
||||
SDL_Event evt;
|
||||
|
|
@ -1001,11 +939,9 @@ void I_GetEvent(void)
|
|||
case SDL_JOYAXISMOTION:
|
||||
Impl_HandleJoystickAxisEvent(evt.jaxis);
|
||||
break;
|
||||
#if 0
|
||||
case SDL_JOYHATMOTION:
|
||||
Impl_HandleJoystickHatEvent(evt.jhat)
|
||||
Impl_HandleJoystickHatEvent(evt.jhat);
|
||||
break;
|
||||
#endif
|
||||
case SDL_JOYBUTTONUP:
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
Impl_HandleJoystickButtonEvent(evt.jbutton, evt.type);
|
||||
|
|
@ -1097,7 +1033,7 @@ void I_GetEvent(void)
|
|||
}
|
||||
|
||||
if (i == MAXSPLITSCREENPLAYERS)
|
||||
SDL_JoystickClose(newjoy);
|
||||
I_StoreExJoystick(newjoy);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -1175,7 +1111,10 @@ void I_GetEvent(void)
|
|||
|
||||
// In order to make wheels act like buttons, we have to set their state to Up.
|
||||
// This is because wheel messages don't have an up/down state.
|
||||
gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0;
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
gamekeydown[i][KEY_MOUSEWHEELDOWN] = gamekeydown[i][KEY_MOUSEWHEELUP] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void I_StartupMouse(void)
|
||||
|
|
@ -1203,16 +1142,12 @@ void I_StartupMouse(void)
|
|||
void I_OsPolling(void)
|
||||
{
|
||||
SDL_Keymod mod;
|
||||
UINT8 i;
|
||||
|
||||
if (consolevent)
|
||||
I_GetConsoleEvents();
|
||||
|
||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||
{
|
||||
SDL_JoystickUpdate();
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
I_GetJoystickEvents(i);
|
||||
}
|
||||
|
||||
I_GetEvent();
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ typedef struct SDLJoyInfo_s
|
|||
/** \brief SDL info about joysticks
|
||||
*/
|
||||
extern SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS];
|
||||
extern SDL_Joystick *ExJoystick[MAXGAMEPADS];
|
||||
|
||||
void I_StoreExJoystick(SDL_Joystick *dev);
|
||||
|
||||
/** \brief joystick axis deadzone
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -291,6 +291,9 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st
|
|||
|
||||
#define V_DrawThinStringAtFixed( x,y,option,string ) \
|
||||
V__DrawOneScaleString (x,y,FRACUNIT,option,NULL,TINY_FONT,string)
|
||||
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
|
||||
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
#include "../screen.h"
|
||||
|
||||
#include "../m_menu.h"
|
||||
#include "../k_menu.h"
|
||||
|
||||
// Wheel support for Win95/WinNT3.51
|
||||
#include <zmouse.h>
|
||||
|
|
@ -399,6 +399,7 @@ void I_OsPolling(void)
|
|||
{
|
||||
MSG msg;
|
||||
HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
|
||||
INT32 i;
|
||||
|
||||
// we need to dispatch messages to the window
|
||||
// so the window procedure can respond to messages and PostEvent() for keys
|
||||
|
|
@ -425,8 +426,8 @@ void I_OsPolling(void)
|
|||
I_GetEvent();
|
||||
|
||||
// reset "emulated keys"
|
||||
gamekeydown[KEY_MOUSEWHEELUP] = 0;
|
||||
gamekeydown[KEY_MOUSEWHEELDOWN] = 0;
|
||||
gamekeydown[0][KEY_MOUSEWHEELUP] = 0;
|
||||
gamekeydown[0][KEY_MOUSEWHEELDOWN] = 0;
|
||||
}
|
||||
|
||||
// ===========================================================================================
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include "lua_hud.h"
|
||||
|
||||
#include "m_random.h" // M_RandomKey
|
||||
#include "g_input.h" // PlayerInputDown
|
||||
#include "g_input.h" // G_PlayerInputDown
|
||||
#include "k_battle.h"
|
||||
#include "k_pwrlv.h"
|
||||
#include "k_grandprix.h"
|
||||
|
|
@ -619,7 +619,7 @@ void Y_Ticker(void)
|
|||
|
||||
if (demo.recording)
|
||||
{
|
||||
if (demo.savemode == DSM_NOTSAVING && PlayerInputDown(1, gc_lookback))
|
||||
if (demo.savemode == DSM_NOTSAVING && G_PlayerInputDown(0, gc_y, 0))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
|
|
@ -1476,13 +1476,13 @@ void Y_VoteTicker(void)
|
|||
&& !voteclient.playerinfo[i].delay
|
||||
&& pickedvote == -1 && votes[p] == -1)
|
||||
{
|
||||
if (PlayerInputDown(i+1, gc_aimforward) || PlayerJoyAxis(i+1, AXISAIM) < 0)
|
||||
if (G_PlayerInputDown(i, gc_up, 0))
|
||||
{
|
||||
voteclient.playerinfo[i].selection--;
|
||||
pressed = true;
|
||||
}
|
||||
|
||||
if ((PlayerInputDown(i+1, gc_aimbackward) || PlayerJoyAxis(i+1, AXISAIM) > 0) && !pressed)
|
||||
if (G_PlayerInputDown(i, gc_down, 0) && pressed == false)
|
||||
{
|
||||
voteclient.playerinfo[i].selection++;
|
||||
pressed = true;
|
||||
|
|
@ -1493,7 +1493,7 @@ void Y_VoteTicker(void)
|
|||
if (voteclient.playerinfo[i].selection > 3)
|
||||
voteclient.playerinfo[i].selection = 0;
|
||||
|
||||
if ((PlayerInputDown(i+1, gc_accelerate) || PlayerJoyAxis(i+1, AXISMOVE) > 0) && !pressed)
|
||||
if (G_PlayerInputDown(i, gc_a, 0) && pressed == false)
|
||||
{
|
||||
D_ModifyClientVote(consoleplayer, voteclient.playerinfo[i].selection, i);
|
||||
pressed = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue