Compare commits

...
Author SHA1 Message Date
Alug 00bc8bc149 limit addon only stuff to server info screen
quite honestly everything else is awful and i dont want to bother with it
2026-01-27 18:23:51 +01:00
Alug f12b55f63b rename addonsonly variable to cl_addonsonly
very generic name so add the prefix for whatever cl means
2026-01-27 18:08:12 +01:00
Alug 3e476d7658 implement allowing to load addons and gamestate only instead of joining server
really messy, needs some cleanup, not sure if this is good at all
2026-01-27 18:06:22 +01:00
Alug c4581bd9a6 Only save and keep track of controller ids on SDL versions 2.32.4 and up
Older versions break and have unstable ids on Windows, cant check for linux but ill just add a version check at this point
This was part of updating sdl with v9, which got reverted due to other issues but this was not reverted oopsie
2026-01-24 18:20:54 +01:00
5 changed files with 102 additions and 31 deletions

No files matched your search

+42 -17
View File
@@ -100,6 +100,10 @@ static int map_icon_request_count; // current count of icon requests sent
static UINT8 *map_icon_data;
static patch_t *map_icon;
// if true, signals the game to only load addons AND gamestate
// instead of fully joining a server
static boolean cl_addonsonly = false;
plrinfo playerinfo[MAXPLAYERS] = {};
SINT8 joinnode = 0; // used for CL_VIEWSERVER
@@ -1438,6 +1442,7 @@ static void CL_DrawConnectionStatus(void)
// Buttons
V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239);
V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80"));
V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sSPACE%s] = Load Addons", "\x82", "\x80"));
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80"));
}
else if (filedownload.current != -1)
@@ -2579,7 +2584,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
return true;
}
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
cl_mode = cv_serverinfoscreen.value ? CL_VIEWSERVER : CL_CHECKFILES;
}
else
{
@@ -2600,6 +2605,17 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
return true;
}
static void FreeMapIcon(void)
{
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
map_icon_request_count = 0;
}
/** Called by CL_ConnectToServer
*
* \param tmpsave The name of the gamestate file???
@@ -2624,7 +2640,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_ASKFULLFILELIST:
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
cl_mode = cv_serverinfoscreen.value ? CL_VIEWSERVER : CL_CHECKFILES;
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
{
if (CL_AskFileList(fileneedednum))
@@ -2757,7 +2773,19 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
{
// Gamestate is now handled within CL_LoadReceivedSavegame()
CL_LoadReceivedSavegame(false);
cl_mode = CL_CONNECTED;
if (cl_addonsonly)
{
// close connection after savegame load
// we want the actual server state
// in case theres some stuff like records to be synched
cl_mode = CL_ABORTED;
}
else
{
cl_mode = CL_CONNECTED;
}
break;
} // don't break case continue to CL_CONNECTED
else
@@ -2771,7 +2799,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
case CL_ABORTED:
cl_mode = CL_SEARCHING;
return false;
}
GetPackets();
@@ -2793,24 +2820,21 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
{
if (key == KEY_ENTER || key == KEY_JOY1)
{
cl_addonsonly = false;
cl_mode = CL_CHECKFILES;
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
FreeMapIcon();
}
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
{
cl_mode = CL_ABORTED;
if (map_icon != NULL)
Patch_Free(map_icon);
map_icon = NULL;
if (map_icon_data != NULL)
Z_Free(map_icon_data);
map_icon_data = NULL;
map_icon_request_count = 0;
cl_addonsonly = false;
FreeMapIcon();
}
else if (key == KEY_SPACE || key == KEY_JOY1+2)
{
cl_addonsonly = true;
cl_mode = CL_CHECKFILES;
FreeMapIcon();
}
}
@@ -2819,6 +2843,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
{
CONS_Printf(M_GetText("Network game synchronization aborted.\n"));
CL_AbortConnection();
cl_addonsonly = false;
return false;
}
+23 -13
View File
@@ -186,8 +186,8 @@ static INT16 itemOn = 1; // menu item skull is on, Hack by Tails 09-18-2002
static INT16 skullAnimCounter = 10; // skull animation counter
static boolean interpTimerHackAllow = 0;
static UINT8 setupcontrolplayer;
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
static UINT8 setupcontrolplayer;
static INT32 (*setupcontrols)[2]; // pointer to the gamecontrols of the player being edited
// shhh... what am I doing... nooooo!
static INT32 vidm_testingmode = 0;
@@ -201,8 +201,8 @@ static char setupm_ip[64];
static textinput_t setupm_input_ip;
static fixed_t multi_tics;
static state_t *multi_state;
static fixed_t multi_tics;
static state_t *multi_state;
// this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2
@@ -1024,9 +1024,9 @@ boolean M_Responder(event_t *ev)
//case KEY_JOY1 + 2:
ch = KEY_ENTER;
break;
/*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
ch = 'n';
break;*/
/*case KEY_JOY1 + 3: // Brake can function as 'n' for message boxes now.
ch = 'n';
break;*/
case KEY_MOUSE1 + 1:
//case KEY_JOY1 + 1:
ch = KEY_BACKSPACE;
@@ -1305,12 +1305,21 @@ boolean M_Responder(event_t *ev)
{
playback_last_menu_interaction_leveltime = leveltime;
// Flip left/right with up/down for the playback menu, since it's a horizontal icon row.
switch (ch)
{
case KEY_LEFTARROW: ch = KEY_UPARROW; break;
case KEY_UPARROW: ch = KEY_RIGHTARROW; break;
case KEY_RIGHTARROW: ch = KEY_DOWNARROW; break;
case KEY_DOWNARROW: ch = KEY_LEFTARROW; break;
case KEY_LEFTARROW:
ch = KEY_UPARROW;
break;
case KEY_UPARROW:
ch = KEY_RIGHTARROW;
break;
case KEY_RIGHTARROW:
ch = KEY_DOWNARROW;
break;
case KEY_DOWNARROW:
ch = KEY_LEFTARROW;
break;
// arbitrary keyboard shortcuts because fuck you
@@ -1361,7 +1370,8 @@ boolean M_Responder(event_t *ev)
G_AdjustView(4, 1, true);
break;
default: break;
default:
break;
}
}
@@ -1486,6 +1496,7 @@ boolean M_Responder(event_t *ev)
}
return false;
break;
default:
CON_Responder(ev);
@@ -10046,7 +10057,6 @@ static void M_DrawVideoMode(void)
va("Wait %d second%s", testtime, (testtime > 1) ? "s" : ""));
M_CentreText(OP_VideoModeDef.y + 158,
"or press ESC to return");
}
else
{
+21 -1
View File
@@ -726,7 +726,9 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
JoySet->dev = NULL;
JoySet->oldjoy = -1;
#if (SDL_VERSION_ATLEAST(2,32,4))
JoySet->id = -1;
#endif
}
/** \brief SDL info about joystick
@@ -783,7 +785,11 @@ void I_UpdateJoystickDeviceIndex(UINT8 player)
///////////////////////////////////////////////
if (JoyInfo[player].dev)
{
#if (SDL_VERSION_ATLEAST(2,32,4))
cv_usejoystick[player].value = JoyInfo[player].id + 1;
#else
cv_usejoystick[player].value = I_GetJoystickDeviceIndex(JoyInfo[player].dev) + 1;
#endif
}
else
{
@@ -939,7 +945,9 @@ static int joy_open(int playerIndex, int joyIndex)
CONS_Debug(DBG_GAMELOGIC, "Joystick %d: %s\n", playerIndex+1, SDL_GameControllerName(JoyInfo[playerIndex].dev));
#if (SDL_VERSION_ATLEAST(2,32,4))
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
#endif
return SDL_CONTROLLER_AXIS_MAX;
}
@@ -985,7 +993,9 @@ void I_InitJoystick(UINT8 index)
JoyInfo[index].dev = NULL;
JoyInfo[index].oldjoy = -1;
#if (SDL_VERSION_ATLEAST(2,32,4))
JoyInfo[index].id = -1;
#endif
if (cv_usejoystick[index].value)
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
@@ -999,17 +1009,27 @@ void I_InitJoystick(UINT8 index)
break;
}
#if (SDL_VERSION_ATLEAST(2,32,4))
JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
#endif
if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device
{
#if (SDL_VERSION_ATLEAST(2,32,4))
cv_usejoystick[index].value = JoyInfo[index].id + 1;
#else
cv_usejoystick[index].value = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1;
#endif
}
else if (newcontroller && joy_open(index, cv_usejoystick[index].value) != -1)
{
#if (SDL_VERSION_ATLEAST(2,32,4))
JoyInfo[index].oldjoy = JoyInfo[index].id + 1;
#else
// SDL's device indexes are unstable, so cv_usejoystick may not match
// the actual device index. So let's cheat a bit and find the device's current index.
JoyInfo[index].oldjoy = JoyInfo[index].id + 1;
JoyInfo[index].oldjoy = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1;
#endif
}
else
{
+12
View File
@@ -784,7 +784,11 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
// Determine the Joystick IDs for each current open joystick
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
#if (SDL_VERSION_ATLEAST(2,32,4))
if (evt.which == JoyInfo[i].id)
#else
if (evt.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)))
#endif
{
event.type = ev_joystick + i;
break;
@@ -844,7 +848,11 @@ static void Impl_HandleControllerHatEvent(SDL_ControllerButtonEvent evt, Uint32
// Determine the Joystick IDs for each current open joystick
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
#if (SDL_VERSION_ATLEAST(2,32,4))
if (evt.which == JoyInfo[i].id)
#else
if (evt.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)))
#endif
{
event.data1 = hat_buttons_base[i];
break;
@@ -906,7 +914,11 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
// Determine the Joystick IDs for each current open joystick
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
#if (SDL_VERSION_ATLEAST(2,32,4))
if (evt.which == JoyInfo[i].id)
#else
if (evt.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)))
#endif
{
event.data1 = buttons_base[i];
break;
+4
View File
@@ -23,6 +23,8 @@
extern "C" {
#endif
#include "SDL_version.h"
#include "../m_fixed.h"
// SDL2 stub macro
@@ -39,8 +41,10 @@ typedef struct SDLJoyInfo_s
{
/// Controller handle
SDL_GameController *dev;
#if (SDL_VERSION_ATLEAST(2,32,4))
/// Controller index
INT32 id;
#endif
/// number of old joystick
int oldjoy;
/// number of axies