Compare commits
31
Commits
fixuphwbsp
...
fixupnet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48d9b2bc98 | ||
|
|
939bf588b3 | ||
|
|
cb2e017bcf | ||
|
|
d91fbf5d36 | ||
|
|
9859e43be7 | ||
|
|
306fec6f9e | ||
|
|
3e8b3e868b | ||
|
|
9261d9c5b2 | ||
|
|
f97941f86e | ||
|
|
a4810bd6c8 | ||
|
|
93cbba218a | ||
|
|
a658883664 | ||
|
|
d94c10014f | ||
|
|
9fb3f4c9a3 | ||
|
|
b0653416f6 | ||
|
|
d1a6394e52 | ||
|
|
ccc90842a7 | ||
|
|
dc069d7bb5 | ||
|
|
f4a827dfc2 | ||
|
|
4f3232b6cc | ||
|
|
3685502edf | ||
|
|
f87bcef079 | ||
|
|
c3458afe2b | ||
|
|
17bc8a4a36 | ||
|
|
b04f017ab6 | ||
|
|
083ddb6396 | ||
|
|
c3129742c3 | ||
|
|
877bd640f3 | ||
|
|
3233df9c6c | ||
|
|
9ad5f5189c | ||
|
|
c7718dea79 |
No files matched your search
+833
-701
File diff suppressed because it is too large.
Load diff
+2
-3
@@ -42,8 +42,8 @@ applications may follow different packet versions.
|
||||
#define VANILLA_GT_MATCH 3
|
||||
|
||||
// Networking and tick handling related.
|
||||
#define BACKUPTICS 32
|
||||
#define TICQUEUE 512 // more than enough for most timeouts....
|
||||
#define BACKUPTICS 512 // more than enough for most timeouts....
|
||||
#define CLIENTBACKUPTICS 32
|
||||
#define MAXTEXTCMD 256
|
||||
|
||||
// No. of tics your controls can be delayed by.
|
||||
@@ -533,7 +533,6 @@ extern UINT32 serverlistultimatecount;
|
||||
extern INT32 mapchangepending;
|
||||
|
||||
// Points inside doomcom
|
||||
extern doomdata_t *netbuffer;
|
||||
extern consvar_t cv_stunserver;
|
||||
extern consvar_t cv_httpsource;
|
||||
extern consvar_t cv_kicktime;
|
||||
|
||||
+21
-3
@@ -152,6 +152,8 @@ boolean dedicated = false;
|
||||
|
||||
boolean loaded_config = false; // true once config.cfg loaded AND executed
|
||||
|
||||
static void D_CleanFile(char **filearray);
|
||||
|
||||
//
|
||||
// D_PostEvent
|
||||
// Called by the I/O functions when input is detected
|
||||
@@ -896,9 +898,25 @@ void D_SRB2Loop(void)
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
|
||||
if ((interp || doDisplay) && !frameskip)
|
||||
|
||||
if (interp || doDisplay)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
if (!frameskip)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
}
|
||||
else if (frameskip)
|
||||
{
|
||||
// always update console and hud
|
||||
// otherwise it may take minutes to open it
|
||||
CON_Drawer();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only take screenshots after drawing.
|
||||
@@ -1215,7 +1233,7 @@ void D_AddPostloadFiles(void)
|
||||
postautoloaded = true;
|
||||
}
|
||||
|
||||
void D_CleanFile(char **filearray)
|
||||
static void D_CleanFile(char **filearray)
|
||||
{
|
||||
size_t pnumwadfiles;
|
||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
||||
|
||||
@@ -85,8 +85,6 @@ void D_PostEvent(const event_t *ev);
|
||||
|
||||
void D_ProcessEvents(void);
|
||||
|
||||
void D_CleanFile(char **filearray);
|
||||
|
||||
const char *D_Home(void);
|
||||
|
||||
//
|
||||
|
||||
+34
-29
@@ -48,12 +48,6 @@ tic_t connectiontimeout = (10*TICRATE);
|
||||
|
||||
/// \brief network packet
|
||||
doomcom_t *doomcom = NULL;
|
||||
/// \brief network packet data, points inside doomcom
|
||||
doomdata_t *netbuffer = NULL;
|
||||
/// \brief hole punching packet, also points inside doomcom
|
||||
#ifdef HOLEPUNCH
|
||||
holepunch_t *holepunchpacket = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
FILE *debugfile = NULL; // put some net info in a file during the game
|
||||
@@ -209,13 +203,9 @@ static node_t nodes[MAXNETNODES];
|
||||
// 0 if a = n (mod 256)
|
||||
// >0 if a > b (mod 256)
|
||||
// mnemonic: to use it compare to 0: cmpack(a,b)<0 is "a < b" ...
|
||||
FUNCMATH static INT32 cmpack(UINT8 a, UINT8 b)
|
||||
FUNCMATH static inline INT32 cmpack(UINT8 a, UINT8 b)
|
||||
{
|
||||
register INT32 d = a - b;
|
||||
|
||||
if (d >= 127 || d < -128)
|
||||
return -d;
|
||||
return d;
|
||||
return (SINT8)(a - b);
|
||||
}
|
||||
|
||||
/** Sets freeack to a free acknum and copies the netbuffer in the ackpak table
|
||||
@@ -229,6 +219,8 @@ static boolean GetFreeAcknum(UINT8 *freeack)
|
||||
node_t *node = &nodes[doomcom->remotenode];
|
||||
INT32 i, numfreeslot = 0;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
if (cmpack((UINT8)((node->remotefirstack + MAXACKTOSEND) % 256), node->nextacknum) < 0)
|
||||
{
|
||||
DEBFILE(va("too fast %d %d\n",node->remotefirstack,node->nextacknum));
|
||||
@@ -298,6 +290,7 @@ static boolean Processackpak(void)
|
||||
INT32 i;
|
||||
boolean goodpacket = true;
|
||||
node_t *node = &nodes[doomcom->remotenode];
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
// Received an ack return, so remove the ack in the list
|
||||
if (netbuffer->ackreturn && cmpack(node->remotefirstack, netbuffer->ackreturn) < 0)
|
||||
@@ -307,7 +300,7 @@ static boolean Processackpak(void)
|
||||
// Search the ackbuffer and free it
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == node - nodes
|
||||
if (ackpak[i].acknum && ackpak[i].destinationnode == doomcom->remotenode
|
||||
&& cmpack(ackpak[i].acknum, netbuffer->ackreturn) <= 0)
|
||||
{
|
||||
RemoveAck(i);
|
||||
@@ -423,6 +416,7 @@ void Net_SendAcks(INT32 node)
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
netbuffer->packettype = PT_NOTHING;
|
||||
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
||||
HSendPacket(node, false, 0, MAXACKTOSEND);
|
||||
@@ -434,6 +428,8 @@ static void GotAcks(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
for (j = 0; j < MAXACKTOSEND; j++)
|
||||
{
|
||||
if (netbuffer->u.textcmd[j])
|
||||
@@ -487,6 +483,8 @@ void Net_AckTicker(void)
|
||||
#ifndef NONET
|
||||
INT32 i;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
{
|
||||
const INT32 nodei = ackpak[i].destinationnode;
|
||||
@@ -542,6 +540,7 @@ void Net_UnAcknowledgePacket(INT32 node)
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
|
||||
DEBFILE(va("UnAcknowledge node %d\n", node));
|
||||
|
||||
@@ -736,6 +735,7 @@ void Net_CloseConnection(INT32 node)
|
||||
//
|
||||
static UINT32 NetbufferChecksum(void)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
UINT32 c = 0x1234567;
|
||||
const INT32 l = doomcom->datalength - 4;
|
||||
const UINT8 *buf = (UINT8 *)netbuffer + 4;
|
||||
@@ -852,6 +852,8 @@ const char *Net_GetPacketName(UINT8 packettype)
|
||||
|
||||
static void DebugPrintpacket(const char *header)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
fprintf(debugfile, "%-12s (node %d,ack %d,ackret %d,size %d) type(%d) : %s\n",
|
||||
header, doomcom->remotenode, netbuffer->ack, netbuffer->ackreturn, doomcom->datalength,
|
||||
netbuffer->packettype, Net_GetPacketName(netbuffer->packettype));
|
||||
@@ -1021,6 +1023,7 @@ void Command_Droprate(void)
|
||||
#ifndef NONET
|
||||
static boolean ShouldDropPacket(void)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
return (packetdropquantity[netbuffer->packettype])
|
||||
|| (packetdroprate != 0 && rand() < (((double)RAND_MAX) * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
}
|
||||
@@ -1032,6 +1035,7 @@ static boolean ShouldDropPacket(void)
|
||||
//
|
||||
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlength)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
doomcom->datalength = (INT16)(packetlength + BASEPACKETSIZE);
|
||||
|
||||
if (node == 0) // Packet is to go back to us
|
||||
@@ -1132,7 +1136,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
//
|
||||
boolean HGetPacket(void)
|
||||
{
|
||||
//boolean nodejustjoined;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
// Get a packet from self
|
||||
if (rebound_tail != rebound_head)
|
||||
@@ -1220,6 +1224,18 @@ static void Internal_FreeNodenum(INT32 nodenum)
|
||||
(void)nodenum;
|
||||
}
|
||||
|
||||
static char *I_NetSplitAddress(char *host, char **port)
|
||||
{
|
||||
boolean v4 = (host[0] != '[');
|
||||
|
||||
host = strtok(host, v4 ? ":" : "[]");
|
||||
|
||||
if (port)
|
||||
*port = strtok(NULL, ":");
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
SINT8 I_NetMakeNode(const char *hostname)
|
||||
{
|
||||
SINT8 newnode = -1;
|
||||
@@ -1227,20 +1243,14 @@ SINT8 I_NetMakeNode(const char *hostname)
|
||||
if (I_NetMakeNodewPort)
|
||||
{
|
||||
char *localhostname = strdup(hostname);
|
||||
char *t = localhostname;
|
||||
const char *port;
|
||||
char *port;
|
||||
if (!localhostname)
|
||||
return newnode;
|
||||
|
||||
// retrieve portnum from address!
|
||||
strtok(localhostname, ":");
|
||||
port = strtok(NULL, ":");
|
||||
hostname = I_NetSplitAddress(localhostname, &port);
|
||||
|
||||
// remove the port in the hostname as we've it already
|
||||
while ((*t != ':') && (*t != '\0'))
|
||||
t++;
|
||||
*t = '\0';
|
||||
|
||||
newnode = I_NetMakeNodewPort(localhostname, port);
|
||||
newnode = I_NetMakeNodewPort(hostname, port);
|
||||
free(localhostname);
|
||||
}
|
||||
return newnode;
|
||||
@@ -1332,11 +1342,6 @@ boolean D_CheckNetGame(void)
|
||||
if (doomcom->numnodes > MAXNETNODES)
|
||||
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
|
||||
|
||||
netbuffer = (doomdata_t *)(void *)&doomcom->data;
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket = (holepunch_t *)(void *)&doomcom->data;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
if (M_CheckParm("-debugfile"))
|
||||
{
|
||||
|
||||
@@ -142,6 +142,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
||||
{
|
||||
size_t i;
|
||||
UINT8 count = 0;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
UINT8 *p_start = netbuffer->packettype == PT_MOREFILESNEEDED ? netbuffer->u.filesneededcfg.files : netbuffer->u.serverinfo.fileneeded;
|
||||
UINT8 *p = p_start;
|
||||
char wadfilename[MAX_WADPATH] = "";
|
||||
@@ -323,6 +324,7 @@ boolean CL_SendRequestFile(void)
|
||||
#ifdef MORELEGACYDOWNLOADER
|
||||
boolean firstloop = true;
|
||||
#endif
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (M_CheckParm("-nodownload"))
|
||||
@@ -451,9 +453,11 @@ tryagain:
|
||||
// returns false if a requested file was not found or cannot be sent
|
||||
boolean Got_RequestFilePak(INT32 node)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
char wad[MAX_WADPATH+1];
|
||||
UINT8 *p = netbuffer->u.textcmd;
|
||||
UINT8 id;
|
||||
|
||||
while (p < netbuffer->u.textcmd + MAXTEXTCMD) // Don't allow hacked client to overflow
|
||||
{
|
||||
id = READUINT8(p);
|
||||
@@ -817,6 +821,7 @@ void SV_FileSendTicker(void)
|
||||
size_t size;
|
||||
filetx_t *f;
|
||||
INT32 packetsent, ram, i, j;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
if (!filestosend) // No file to send
|
||||
return;
|
||||
@@ -945,6 +950,7 @@ void SV_FileSendTicker(void)
|
||||
|
||||
void Got_Filetxpak(void)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
INT32 filenum = netbuffer->u.filetxpak.fileid;
|
||||
fileneeded_t *file = &fileneeded[filenum];
|
||||
char *filename = file->filename;
|
||||
@@ -1185,6 +1191,18 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
badmd5 = true;
|
||||
// if not found at all, just move on without doing anything
|
||||
|
||||
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
|
||||
{
|
||||
// next, check any custom directory if specified
|
||||
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
|
||||
|
||||
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
|
||||
return FS_FOUND;
|
||||
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
|
||||
badmd5 = true;
|
||||
// if not found at all, just move on without doing anything
|
||||
}
|
||||
|
||||
// finally check "." directory
|
||||
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
|
||||
|
||||
|
||||
+1
-1
@@ -575,7 +575,7 @@ extern consvar_t cv_downloading; // allow clients to downloading WADs.
|
||||
extern consvar_t cv_nettimeout; // SRB2Kart: Advanced server options menu
|
||||
extern consvar_t cv_jointimeout;
|
||||
extern consvar_t cv_maxping;
|
||||
extern ticcmd_t netcmds[TICQUEUE][MAXPLAYERS];
|
||||
extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS];
|
||||
extern INT32 serverplayer;
|
||||
extern INT32 adminplayers[MAXPLAYERS];
|
||||
|
||||
|
||||
+35
-32
@@ -681,47 +681,49 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
INT32 axisval;
|
||||
boolean flp = false;
|
||||
|
||||
UINT8 pnum = player-1;
|
||||
|
||||
//find what axis to get
|
||||
switch (axissel)
|
||||
{
|
||||
case AXISTURN:
|
||||
axisval = cv_turnaxis[player-1].value;
|
||||
axisval = cv_turnaxis[pnum].value;
|
||||
break;
|
||||
case AXISMOVE:
|
||||
axisval = cv_moveaxis[player-1].value;
|
||||
axisval = cv_moveaxis[pnum].value;
|
||||
break;
|
||||
case AXISCAMTURN:
|
||||
axisval = cv_camturnaxis[player-1].value;
|
||||
axisval = cv_camturnaxis[pnum].value;
|
||||
break;
|
||||
case AXISCAMSTRAFE:
|
||||
axisval = cv_camstrafeaxis[player-1].value;
|
||||
axisval = cv_camstrafeaxis[pnum].value;
|
||||
break;
|
||||
case AXISBRAKE:
|
||||
axisval = cv_brakeaxis[player-1].value;
|
||||
axisval = cv_brakeaxis[pnum].value;
|
||||
break;
|
||||
case AXISAIM:
|
||||
axisval = cv_aimaxis[player-1].value;
|
||||
axisval = cv_aimaxis[pnum].value;
|
||||
break;
|
||||
case AXISLOOK:
|
||||
axisval = cv_lookaxis[player-1].value;
|
||||
axisval = cv_lookaxis[pnum].value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis[player-1].value;
|
||||
axisval = cv_fireaxis[pnum].value;
|
||||
break;
|
||||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis[player-1].value;
|
||||
axisval = cv_driftaxis[pnum].value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis[player-1].value;
|
||||
axisval = cv_lookbackaxis[pnum].value;
|
||||
break;
|
||||
case AXISCUSTOM1:
|
||||
axisval = cv_custom1axis[player-1].value;
|
||||
axisval = cv_custom1axis[pnum].value;
|
||||
break;
|
||||
case AXISCUSTOM2:
|
||||
axisval = cv_custom2axis[player-1].value;
|
||||
axisval = cv_custom2axis[pnum].value;
|
||||
break;
|
||||
case AXISCUSTOM3:
|
||||
axisval = cv_custom3axis[player-1].value;
|
||||
axisval = cv_custom3axis[pnum].value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
@@ -732,44 +734,51 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 player)
|
||||
axisval = -axisval;
|
||||
flp = true;
|
||||
}
|
||||
|
||||
if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
|
||||
return 0;
|
||||
|
||||
if (axisval%2)
|
||||
if (axisval % 2)
|
||||
{
|
||||
axisval /= 2;
|
||||
retaxis = joyxmove[axisval];
|
||||
retaxis = joyxmove[pnum][axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[player-1].value) >> FRACBITS;
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_xdeadzone[pnum].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
}
|
||||
else
|
||||
{
|
||||
axisval--;
|
||||
axisval /= 2;
|
||||
retaxis = joyymove[axisval];
|
||||
retaxis = joyymove[pnum][axisval];
|
||||
|
||||
if (retaxis < (-JOYAXISRANGE))
|
||||
retaxis = -JOYAXISRANGE;
|
||||
if (retaxis > (+JOYAXISRANGE))
|
||||
retaxis = +JOYAXISRANGE;
|
||||
if (!Joystick[player-1].bGamepadStyle && axissel < AXISDEAD)
|
||||
if (!Joystick[pnum].bGamepadStyle && axissel < AXISDEAD)
|
||||
{
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[player-1].value) >> FRACBITS;
|
||||
const INT32 jdeadzone = ((JOYAXISRANGE-1) * cv_ydeadzone[pnum].value) >> FRACBITS;
|
||||
if (abs(retaxis) <= jdeadzone)
|
||||
return 0;
|
||||
}
|
||||
if (flp) retaxis = -retaxis; //flip it around
|
||||
|
||||
if (flp)
|
||||
retaxis = -retaxis; // flip it around
|
||||
|
||||
return retaxis;
|
||||
}
|
||||
}
|
||||
@@ -1216,15 +1225,9 @@ static void G_DoLoadLevel(boolean resetplayer)
|
||||
}
|
||||
|
||||
// clear cmd building stuff
|
||||
memset(gamekeydown, 0, sizeof (gamekeydown));
|
||||
|
||||
for (i = 0; i < JOYAXISSET; i++)
|
||||
{
|
||||
joyxmove[i] = joyymove[i] = 0;
|
||||
joy2xmove[i] = joy2ymove[i] = 0;
|
||||
joy3xmove[i] = joy3ymove[i] = 0;
|
||||
joy4xmove[i] = joy4ymove[i] = 0;
|
||||
}
|
||||
memset(gamekeydown, 0, sizeof(gamekeydown));
|
||||
memset(joyxmove, 0, sizeof(joyxmove));
|
||||
memset(joyymove, 0, sizeof(joyymove));
|
||||
mousex = mousey = 0;
|
||||
|
||||
// clear hud messages remains (usually from game startup)
|
||||
@@ -1784,7 +1787,7 @@ void G_Ticker(boolean run)
|
||||
}
|
||||
}
|
||||
|
||||
buf = gametic % TICQUEUE;
|
||||
buf = gametic % BACKUPTICS;
|
||||
|
||||
if (!demo.playback)
|
||||
{
|
||||
|
||||
+9
-19
@@ -114,8 +114,7 @@ INT32 mousex, mousey;
|
||||
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
|
||||
|
||||
// joystick values are repeated
|
||||
INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
|
||||
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
|
||||
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
// current state of the keys: true if pushed
|
||||
UINT8 gamekeydown[NUMINPUTS];
|
||||
@@ -187,32 +186,32 @@ void G_MapEventsToControls(event_t *ev)
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[0][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[0][i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_joystick2: // buttons are virtual keys
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET || menuactive)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[1][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[1][i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_joystick3:
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy3xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy3ymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_joystick4:
|
||||
i = ev->data1;
|
||||
if (i >= JOYAXISSET)
|
||||
break;
|
||||
if (ev->data2 != INT32_MAX) joy4xmove[i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3;
|
||||
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
|
||||
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -258,15 +257,6 @@ void G_ResetControls(void)
|
||||
memset(joyxmove, 0, sizeof(joyxmove));
|
||||
memset(joyymove, 0, sizeof(joyymove));
|
||||
|
||||
memset(joy2xmove, 0, sizeof(joy2xmove));
|
||||
memset(joy2ymove, 0, sizeof(joy2ymove));
|
||||
|
||||
memset(joy3xmove, 0, sizeof(joy3xmove));
|
||||
memset(joy3ymove, 0, sizeof(joy3ymove));
|
||||
|
||||
memset(joy4xmove, 0, sizeof(joy4xmove));
|
||||
memset(joy4ymove, 0, sizeof(joy4ymove));
|
||||
|
||||
// reset those just in case the game missed the keyup event
|
||||
memset(dpadscrollstate, false, sizeof(dpadscrollstate));
|
||||
}
|
||||
|
||||
+8
-5
@@ -41,10 +41,12 @@ typedef enum
|
||||
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS,
|
||||
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
|
||||
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS,
|
||||
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
|
||||
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
|
||||
@@ -61,8 +63,10 @@ typedef enum
|
||||
|
||||
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
|
||||
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
|
||||
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
|
||||
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
|
||||
|
||||
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
|
||||
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1, // FIXME: all the mouse 2 stuff should be removed, but it screws up mappings somehow
|
||||
} key_input_e;
|
||||
|
||||
typedef enum
|
||||
@@ -113,8 +117,7 @@ extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
|
||||
extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
|
||||
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
|
||||
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||
|
||||
// current state of the keys: true if pushed
|
||||
extern UINT8 gamekeydown[NUMINPUTS];
|
||||
|
||||
+5
-1
@@ -220,7 +220,11 @@ HMS_connect (const char *format, ...)
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4);
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
if (!M_CheckParm("-ipv6"))
|
||||
#endif
|
||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read);
|
||||
|
||||
+6
-8
@@ -310,7 +310,7 @@ void HU_LoadGraphics(void)
|
||||
lt_font[0] = (patch_t *)W_CachePatchName("LTFNT039", PU_HUDGFX); /// \note fake start hack
|
||||
|
||||
// Number support
|
||||
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
|
||||
lt_font[9] = (patch_t *)W_CachePatchName("LTFNT048", PU_HUDGFX);
|
||||
lt_font[10] = (patch_t *)W_CachePatchName("LTFNT049", PU_HUDGFX);
|
||||
lt_font[11] = (patch_t *)W_CachePatchName("LTFNT050", PU_HUDGFX);
|
||||
lt_font[12] = (patch_t *)W_CachePatchName("LTFNT051", PU_HUDGFX);
|
||||
@@ -747,7 +747,7 @@ static void Command_CSay_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!server && !IsPlayerAdmin(consoleplayer))
|
||||
if (!server && !IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Only servers and admins can use csay.\n"));
|
||||
return;
|
||||
@@ -2881,13 +2881,11 @@ void HU_DoCEcho(const char *msg)
|
||||
*p = '\n';
|
||||
|
||||
CONS_Printf("%s\n", temp);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (cv_cechotoggle.value)
|
||||
cechotimer = cechoduration;
|
||||
|
||||
I_OutputMsg("%s\n", msg); // print to log
|
||||
|
||||
if (!cv_cechotoggle.value)
|
||||
return;
|
||||
|
||||
cechotimer = cechoduration;
|
||||
I_OutputMsg("%s\n", msg); // ALWAYS print to log
|
||||
}
|
||||
+4
-4
@@ -82,6 +82,8 @@ typedef struct
|
||||
char data[MAXPACKETLENGTH];
|
||||
} ATTRPACK doomcom_t;
|
||||
|
||||
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
|
||||
|
||||
#ifdef HOLEPUNCH
|
||||
typedef struct
|
||||
{
|
||||
@@ -89,6 +91,8 @@ typedef struct
|
||||
INT32 addr;
|
||||
INT16 port;
|
||||
} ATTRPACK holepunch_t;
|
||||
|
||||
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@@ -97,10 +101,6 @@ typedef struct
|
||||
|
||||
extern doomcom_t *doomcom;
|
||||
|
||||
#ifdef HOLEPUNCH
|
||||
extern holepunch_t *holepunchpacket;
|
||||
#endif
|
||||
|
||||
/** \brief return packet in doomcom struct
|
||||
*/
|
||||
extern boolean (*I_NetGet)(void);
|
||||
|
||||
+77
-21
@@ -371,8 +371,16 @@ static inline void I_UPnP_rem(const char *port, const char * servicetype)
|
||||
|
||||
static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
{
|
||||
static char s[64]; // 255.255.255.255:65535 or IPv6:65535
|
||||
static char s[64]; // 255.255.255.255:65535 or
|
||||
// [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535
|
||||
|
||||
#ifdef HAVE_NTOP
|
||||
#ifdef HAVE_IPV6
|
||||
int v6 = (sk->any.sa_family == AF_INET6);
|
||||
#else
|
||||
int v6 = 0;
|
||||
#endif
|
||||
|
||||
void *addr;
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
|
||||
@@ -387,14 +395,20 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||
|
||||
if(addr == NULL)
|
||||
sprintf(s, "No address");
|
||||
else if(inet_ntop(sk->any.sa_family, addr, s, sizeof (s)) == NULL)
|
||||
else if(inet_ntop(sk->any.sa_family, addr, &s[v6], sizeof (s) - v6) == NULL)
|
||||
{
|
||||
e = errno;
|
||||
sprintf(s, "Unknown family type, error #%u: %s", e, strerror(e));
|
||||
}
|
||||
#ifdef HAVE_IPV6
|
||||
else if(sk->any.sa_family == AF_INET6 && sk->ip6.sin6_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||
else if(sk->any.sa_family == AF_INET6)
|
||||
{
|
||||
s[0] = '[';
|
||||
strcat(s, "]");
|
||||
|
||||
if (sk->ip6.sin6_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip6.sin6_port)));
|
||||
}
|
||||
#endif
|
||||
else if(sk->any.sa_family == AF_INET && sk->ip4.sin_port != 0)
|
||||
strcat(s, va(":%d", ntohs(sk->ip4.sin_port)));
|
||||
@@ -486,10 +500,30 @@ static time_t SOCK_GetUnbanTime(size_t ban)
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
static boolean SOCK_cmpipv6(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
{
|
||||
UINT8 bitmask;
|
||||
I_Assert(mask <= 128);
|
||||
if (mask == 0)
|
||||
mask = 128;
|
||||
if (memcmp(&a->ip6.sin6_addr.s6_addr, &b->ip6.sin6_addr.s6_addr, mask / 8) != 0)
|
||||
return false;
|
||||
if (mask % 8 == 0)
|
||||
return true;
|
||||
bitmask = 255 << (mask % 8);
|
||||
return (a->ip6.sin6_addr.s6_addr[mask / 8] & bitmask) == (b->ip6.sin6_addr.s6_addr[mask / 8] & bitmask);
|
||||
}
|
||||
#endif
|
||||
|
||||
static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
{
|
||||
UINT32 bitmask = INADDR_NONE;
|
||||
|
||||
if (a->any.sa_family != b->any.sa_family)
|
||||
return false;
|
||||
|
||||
if (mask && mask < 32)
|
||||
bitmask = htonl((UINT32)(-1) << (32 - mask));
|
||||
|
||||
@@ -498,13 +532,14 @@ static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
&& (b->ip4.sin_port == 0 || (a->ip4.sin_port == b->ip4.sin_port));
|
||||
#ifdef HAVE_IPV6
|
||||
else if (b->any.sa_family == AF_INET6)
|
||||
return memcmp(&a->ip6.sin6_addr, &b->ip6.sin6_addr, sizeof(b->ip6.sin6_addr))
|
||||
return SOCK_cmpipv6(a, b, mask)
|
||||
&& (b->ip6.sin6_port == 0 || (a->ip6.sin6_port == b->ip6.sin6_port));
|
||||
#endif
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This is a hack. For some reason, nodes aren't being freed properly.
|
||||
// This goes through and cleans up what nodes were supposed to be freed.
|
||||
/** \warning This function causes the file downloading to stop if someone joins.
|
||||
@@ -620,6 +655,7 @@ is_external_address (UINT32 p)
|
||||
|
||||
static boolean hole_punch(ssize_t c)
|
||||
{
|
||||
holepunch_t *holepunchpacket = HOLEPUNCH_DATA(doomcom);
|
||||
|
||||
/* See ../doc/Holepunch-Protocol.txt */
|
||||
if (cv_rendezvousserver.string[0] &&
|
||||
@@ -659,6 +695,7 @@ static boolean SOCK_Get(void)
|
||||
fromlen = (socklen_t)sizeof(fromaddress);
|
||||
c = recvfrom(mysockets[n], (char *)&doomcom->data, MAXPACKETLENGTH, 0,
|
||||
(void *)&fromaddress, &fromlen);
|
||||
|
||||
if (c > 0)
|
||||
{
|
||||
#ifdef USE_STUN
|
||||
@@ -868,11 +905,11 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
unsigned long trueval = true;
|
||||
#endif
|
||||
mysockaddr_t straddr;
|
||||
struct sockaddr_in sin;
|
||||
socklen_t len = sizeof(sin);
|
||||
socklen_t len = sizeof(straddr);
|
||||
|
||||
if (s == (SOCKET_TYPE)ERRSOCKET)
|
||||
return (SOCKET_TYPE)ERRSOCKET;
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
{ // Alam_GBC: disable the new UDP connection reset behavior for Win2k and up
|
||||
#ifdef USE_WINSOCK2
|
||||
@@ -892,14 +929,12 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
}
|
||||
#endif
|
||||
|
||||
straddr.any = *addr;
|
||||
memcpy(&straddr, addr, addrlen);
|
||||
I_OutputMsg("Binding to %s\n", SOCK_AddrToStr(&straddr));
|
||||
|
||||
if (family == AF_INET)
|
||||
{
|
||||
mysockaddr_t tmpaddr;
|
||||
tmpaddr.any = *addr ;
|
||||
if (tmpaddr.ip4.sin_addr.s_addr == htonl(INADDR_ANY))
|
||||
if (straddr.ip4.sin_addr.s_addr == htonl(INADDR_ANY))
|
||||
{
|
||||
opt = true;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
@@ -924,7 +959,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
#ifdef HAVE_IPV6
|
||||
else if (family == AF_INET6)
|
||||
{
|
||||
if (memcmp(addr, &in6addr_any, sizeof(in6addr_any)) == 0) //IN6_ARE_ADDR_EQUAL
|
||||
if (memcmp(&straddr.ip6.sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0) //IN6_ARE_ADDR_EQUAL
|
||||
{
|
||||
opt = true;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
@@ -939,7 +974,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
// make it IPv6 ony
|
||||
opt = true;
|
||||
opts = (socklen_t)sizeof(opt);
|
||||
rc = setsockopt(s, SOL_SOCKET, IPV6_V6ONLY, (char *)&opt, opts);
|
||||
rc = setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&opt, opts);
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
@@ -969,7 +1004,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
|
||||
inet_pton(AF_INET6, IPV6_MULTICAST_ADDRESS, &maddr.ipv6mr_multiaddr);
|
||||
maddr.ipv6mr_interface = 0;
|
||||
rc = setsockopt(s, SOL_SOCKET, IPV6_JOIN_GROUP, (const char *)&maddr, sizeof(maddr));
|
||||
rc = setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&maddr, sizeof(maddr));
|
||||
if (rc <= -1)
|
||||
{
|
||||
e = errno;
|
||||
@@ -1032,7 +1067,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
CONS_Printf(M_GetText("Network system buffer set to: %dKb\n"), opt>>10);
|
||||
}
|
||||
|
||||
rc = getsockname(s, (struct sockaddr *)&sin, &len);
|
||||
rc = getsockname(s, &straddr.any, &len);
|
||||
if (rc != 0)
|
||||
{
|
||||
e = errno;
|
||||
@@ -1040,7 +1075,14 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
||||
I_OutputMsg("getsockname failed: #%u, %s\n", e, strerror(e));
|
||||
}
|
||||
else
|
||||
current_port = (UINT16)ntohs(sin.sin_port);
|
||||
{
|
||||
if (family == AF_INET)
|
||||
current_port = (UINT16)ntohs(straddr.ip4.sin_port);
|
||||
#ifdef HAVE_IPV6
|
||||
else if (family == AF_INET6)
|
||||
current_port = (UINT16)ntohs(straddr.ip6.sin6_port);
|
||||
#endif
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -1121,6 +1163,7 @@ static boolean UDP_Socket(void)
|
||||
I_freeaddrinfo(ai);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
if (b_ipv6)
|
||||
{
|
||||
@@ -1319,12 +1362,13 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
||||
{
|
||||
struct my_addrinfo *ai = NULL, *runp, hints;
|
||||
int gaie;
|
||||
size_t i;
|
||||
|
||||
if (!port || !port[0])
|
||||
port = DEFAULTPORT;
|
||||
|
||||
memset (&hints, 0x00, sizeof (hints));
|
||||
hints.ai_flags = 0;
|
||||
hints.ai_flags = AI_ADDRCONFIG;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_protocol = IPPROTO_UDP;
|
||||
@@ -1343,10 +1387,19 @@ static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const
|
||||
{
|
||||
while (runp != NULL)
|
||||
{
|
||||
if (sendto(mysockets[0], NULL, 0, 0, runp->ai_addr, runp->ai_addrlen) == 0)
|
||||
break;
|
||||
// test ip address of server
|
||||
for (i = 0; i < mysocketses; ++i)
|
||||
{
|
||||
if (runp->ai_addr->sa_family == myfamily[i])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
runp = runp->ai_next;
|
||||
if (i >= mysocketses)
|
||||
runp = runp->ai_next;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,6 +1443,8 @@ static void rendezvous(int size)
|
||||
|
||||
tic_t tic = I_GetTime();
|
||||
|
||||
holepunch_t *holepunchpacket = HOLEPUNCH_DATA(doomcom);
|
||||
|
||||
if (tic != refreshtic)
|
||||
{
|
||||
if (SOCK_GetAddr(&rzv.ip4, host, (port ? port : "7777"), false))
|
||||
@@ -1415,6 +1470,7 @@ static void rendezvous(int size)
|
||||
static void SOCK_RequestHolePunch(INT32 node)
|
||||
{
|
||||
mysockaddr_t * addr = &clientaddress[node];
|
||||
holepunch_t *holepunchpacket = HOLEPUNCH_DATA(doomcom);
|
||||
|
||||
holepunchpacket->addr = addr->ip4.sin_addr.s_addr;
|
||||
holepunchpacket->port = addr->ip4.sin_port;
|
||||
@@ -1736,7 +1792,7 @@ boolean I_InitTcpNetwork(void)
|
||||
|
||||
// server address only in ip
|
||||
if (serverhostname[0])
|
||||
{
|
||||
{
|
||||
CONS_Printf("SERVERNAME: %s\n", serverhostname);
|
||||
COM_BufAddText("connect \"");
|
||||
COM_BufAddText(serverhostname);
|
||||
|
||||
+6
-5
@@ -3081,14 +3081,12 @@ static void K_SpawnDriftSparks(player_t *player)
|
||||
if (leveltime % 2 == 1)
|
||||
return;
|
||||
|
||||
if (cv_airsparks.value)
|
||||
goto skipground;
|
||||
const boolean onground = P_IsObjectOnGround(player->mo);
|
||||
|
||||
if (!P_IsObjectOnGround(player->mo))
|
||||
// kinda sketchy
|
||||
if (!cv_airsparks.value && onground)
|
||||
return;
|
||||
|
||||
skipground: // idk im sleepy
|
||||
|
||||
if (!player->kartstuff[k_drift] || player->kartstuff[k_driftcharge] < K_GetKartDriftSparkValue(player))
|
||||
return;
|
||||
|
||||
@@ -3105,6 +3103,8 @@ skipground: // idk im sleepy
|
||||
newy = player->mo->y + P_ReturnThrustY(player->mo, thrustangle, smolscale);
|
||||
spark = P_SpawnMobj(newx, newy, player->mo->z, MT_DRIFTSPARK);
|
||||
|
||||
spark->islocal = cv_airsparks.value && !onground;
|
||||
|
||||
P_SetTarget(&spark->target, player->mo);
|
||||
spark->angle = travelangle-(ANGLE_45/5)*player->kartstuff[k_drift];
|
||||
|
||||
@@ -5361,6 +5361,7 @@ FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, bool
|
||||
fast->momx = 3*player->mo->momx/4;
|
||||
fast->momy = 3*player->mo->momy/4;
|
||||
fast->momz = 3*player->mo->momz/4;
|
||||
fast->islocal = !synched;
|
||||
P_SetTarget(&fast->target, player->mo); // easier lua access
|
||||
|
||||
K_MatchGenericExtraFlags(fast, player->mo);
|
||||
|
||||
+2
-1
@@ -150,7 +150,8 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, cvmem, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
|
||||
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, islocal, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
{ NULL, 0, NULL, NULL },
|
||||
};
|
||||
#undef FIELD
|
||||
|
||||
+13
-12
@@ -1114,10 +1114,10 @@ static menuitem_t MP_PlayerSetupMenu[] =
|
||||
#ifndef NONET
|
||||
static menuitem_t MP_ConnectMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "", M_HandleServerSearch,0},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sort By", &cv_serversort, 16},
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "Page", M_HandleServerPage, 24},
|
||||
{IT_STRING | IT_CALL, NULL, "Refresh", M_Refresh, 32},
|
||||
{IT_STRING | IT_CVAR, NULL, "Sort By", &cv_serversort, 0},
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "Page", M_HandleServerPage, 8},
|
||||
{IT_STRING | IT_CALL, NULL, "Refresh", M_Refresh, 16},
|
||||
{IT_STRING | IT_KEYHANDLER, NULL, "", M_HandleServerSearch,25},
|
||||
|
||||
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 48},
|
||||
{IT_STRING | IT_SPACE, NULL, "", M_Connect, 60},
|
||||
@@ -1133,10 +1133,10 @@ static menuitem_t MP_ConnectMenu[] =
|
||||
|
||||
enum
|
||||
{
|
||||
mp_connect_search,
|
||||
mp_connect_sort,
|
||||
mp_connect_page,
|
||||
mp_connect_refresh,
|
||||
mp_connect_search,
|
||||
FIRSTSERVERLINE
|
||||
};
|
||||
#endif
|
||||
@@ -6072,8 +6072,8 @@ static void M_AddonsOptions(INT32 choice)
|
||||
M_SetupNextMenu(&OP_AddonsOptionsDef);
|
||||
}
|
||||
|
||||
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
#define LOCATIONSTRING1 "Visit \x83mb.srb2.org/addons\x80 to get & make addons!"
|
||||
#define LOCATIONSTRING2 "Visit \x88mb.srb2.org/addons\x80 to get & make addons!"
|
||||
|
||||
static void M_AddonsInternal(void)
|
||||
{
|
||||
@@ -9884,15 +9884,16 @@ static void M_DrawConnectMenu(void)
|
||||
M_DrawServerLines(currentMenu->x, serverlistpage);
|
||||
}
|
||||
|
||||
V_DrawFill(currentMenu->x, currentMenu->y, MAXSTRINGLENGTH*8+6, 8+6, 239);
|
||||
INT32 input_y = currentMenu->menuitems[mp_connect_search].alphaKey;
|
||||
|
||||
V_DrawFill(currentMenu->x, currentMenu->y+input_y, MAXSTRINGLENGTH*8+6, 8+6, 239);
|
||||
|
||||
const INT32 xoff = 3, yoff = 3;
|
||||
|
||||
|
||||
if (itemOn != 0)
|
||||
V_DrawString(currentMenu->x+xoff, currentMenu->y+yoff, V_ALLOWLOWERCASE, menuinput.buffer);
|
||||
if (itemOn != mp_connect_search)
|
||||
V_DrawString(currentMenu->x+xoff, currentMenu->y+yoff+input_y, V_ALLOWLOWERCASE, menuinput.buffer);
|
||||
else
|
||||
M_DrawTextInput(currentMenu->x+xoff, currentMenu->y+yoff, &menuinput, 0);
|
||||
M_DrawTextInput(currentMenu->x+xoff, currentMenu->y+yoff+input_y, &menuinput, 0);
|
||||
|
||||
localservercount = serverlistcount;
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@ typedef union
|
||||
typedef struct
|
||||
{
|
||||
msg_header_t header;
|
||||
#ifndef HAVE_IPV6
|
||||
char ip[16];
|
||||
#else
|
||||
char ip[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
|
||||
#endif
|
||||
char port[8];
|
||||
char contact[32];
|
||||
char version[8]; // format is: x.yy.z (like 1.30.2 or 1.31)
|
||||
|
||||
+1
-1
@@ -6089,7 +6089,7 @@ void P_MobjThinker(mobj_t *mobj)
|
||||
const sector_t *sec1 = mobj->subsector ? mobj->subsector->sector : NULL;
|
||||
|
||||
// 970 allows ANY mobj to trigger a linedef exec
|
||||
if (UNLIKELY(sec1 && GETSECSPECIAL(sec1->special, 2) == 8))
|
||||
if (UNLIKELY(!mobj->islocal && sec1 && GETSECSPECIAL(sec1->special, 2) == 8)) // BEWARE: islocal does not exist in vanilla
|
||||
{
|
||||
sector_t *sec2;
|
||||
sec2 = P_ThingOnSpecial3DFloor(mobj);
|
||||
|
||||
@@ -414,6 +414,7 @@ typedef struct mobj_s
|
||||
boolean init_salty;
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
boolean islocal; // BEWARE: islocal does not exist in vanilla, strictly to be used for locally loaded addons to not cause desynchs with the mobj linedef trigger check. DO NOT USE THIS IN ACTUAL ADDONS YOU INTEND TO USE ON YOUR SERVER
|
||||
} mobj_t;
|
||||
|
||||
//
|
||||
|
||||
+1
-1
@@ -3071,7 +3071,7 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
|
||||
if (!fromnetsave) // uglier hack
|
||||
{ // to make a newly loaded level start on the second frame.
|
||||
INT32 buf = gametic % TICQUEUE;
|
||||
INT32 buf = gametic % BACKUPTICS;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
||||
+8
-20
@@ -42,13 +42,13 @@ static CV_PossibleValue_t fpscap_cons_t[] = {
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fpscap = {"fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fpscapbg = {"fpscapbackground", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_precipinterp = {"precipinterpolation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
ps_metric_t ps_interp_frac = {0};
|
||||
ps_metric_t ps_interp_lag = {0};
|
||||
ps_metric_t ps_interp_lag = {0};
|
||||
|
||||
static boolean R_UseBackgroundFramerateCap(void)
|
||||
{
|
||||
@@ -67,21 +67,21 @@ static boolean R_UseBackgroundFramerateCap(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
static UINT32 R_GetBackgroundFramerateCap(void)
|
||||
static UINT32 R_GetFrameCap(INT32 val)
|
||||
{
|
||||
if (cv_fpscapbg.value == 0)
|
||||
if (val == 0)
|
||||
{
|
||||
// 0: Match refresh rate
|
||||
return I_GetRefreshRate();
|
||||
}
|
||||
|
||||
if (cv_fpscapbg.value < 0)
|
||||
if (val < 0)
|
||||
{
|
||||
// -1: Unlimited
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cv_fpscapbg.value;
|
||||
return val;
|
||||
}
|
||||
|
||||
UINT32 R_GetFramerateCap(void)
|
||||
@@ -95,22 +95,10 @@ UINT32 R_GetFramerateCap(void)
|
||||
|
||||
if (R_UseBackgroundFramerateCap())
|
||||
{
|
||||
return R_GetBackgroundFramerateCap();
|
||||
return R_GetFrameCap(cv_fpscapbg.value);
|
||||
}
|
||||
|
||||
if (cv_fpscap.value == 0)
|
||||
{
|
||||
// 0: Match refresh rate
|
||||
return I_GetRefreshRate();
|
||||
}
|
||||
|
||||
if (cv_fpscap.value < 0)
|
||||
{
|
||||
// -1: Unlimited
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cv_fpscap.value;
|
||||
return R_GetFrameCap(cv_fpscap.value);
|
||||
}
|
||||
|
||||
boolean R_UsingFrameInterpolation(void)
|
||||
|
||||
+34
-32
@@ -1133,7 +1133,6 @@ static void R_SetupSkyScale(player_t *player, camera_t *thiscam, mapheader_t *mh
|
||||
{
|
||||
if (skyboxmo[1])
|
||||
{
|
||||
angle_t ang;
|
||||
fixed_t x = 0, y = 0;
|
||||
|
||||
if (mh->skybox_scalex > 0)
|
||||
@@ -1165,8 +1164,8 @@ static void R_SetupSkyScale(player_t *player, camera_t *thiscam, mapheader_t *mh
|
||||
newview->y -= x;
|
||||
break;
|
||||
default:
|
||||
ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT;
|
||||
newview->x += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang));
|
||||
newview->y += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang));
|
||||
break;
|
||||
}
|
||||
@@ -1192,14 +1191,14 @@ static void R_SetupSkyScale(player_t *player, camera_t *thiscam, mapheader_t *mh
|
||||
}
|
||||
}
|
||||
|
||||
void R_SkyboxFrame(int s)
|
||||
void R_SkyboxFrame(UINT8 pnum)
|
||||
{
|
||||
player_t *player = &players[displayplayers[s]];
|
||||
camera_t *thiscam = &camera[s];
|
||||
subsector_t *subsector = NULL;
|
||||
player_t *player = &players[displayplayers[pnum]];
|
||||
camera_t *thiscam = &camera[pnum];
|
||||
sector_t *viewsec = NULL;
|
||||
mapheader_t *mh = mapheaderinfo[gamemap-1];
|
||||
|
||||
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_SKY1 + s));
|
||||
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_SKY1 + pnum));
|
||||
|
||||
// cut-away view stuff
|
||||
newview->sky = true;
|
||||
@@ -1215,35 +1214,38 @@ void R_SkyboxFrame(int s)
|
||||
|
||||
R_SetupAimingFrame(player, thiscam);
|
||||
|
||||
newview->angle += viewmobj->angle;
|
||||
if (!P_MobjWasRemoved(viewmobj))
|
||||
{
|
||||
newview->angle += viewmobj->angle;
|
||||
|
||||
newview->x = viewmobj->x;
|
||||
newview->y = viewmobj->y;
|
||||
newview->z = (viewmobj->spawnpoint) ? (((fixed_t)viewmobj->spawnpoint->angle)<<FRACBITS) : 0;
|
||||
newview->x = viewmobj->x;
|
||||
newview->y = viewmobj->y;
|
||||
newview->z = (viewmobj->spawnpoint) ? (((fixed_t)viewmobj->spawnpoint->angle) << FRACBITS) : 0;
|
||||
|
||||
if (viewmobj->subsector)
|
||||
viewsec = viewmobj->subsector->sector;
|
||||
}
|
||||
|
||||
if (mh)
|
||||
{
|
||||
R_SetupSkyScale(player, thiscam, mh);
|
||||
}
|
||||
|
||||
if (!P_MobjWasRemoved(viewmobj) && viewmobj->subsector && viewmobj->subsector->sector)
|
||||
subsector = viewmobj->subsector;
|
||||
|
||||
R_SetupCommonFrame(player, subsector->sector);
|
||||
R_SetupCommonFrame(player, viewsec);
|
||||
}
|
||||
|
||||
void R_SetupFrame(int s, boolean skybox)
|
||||
void R_SetupFrame(UINT8 pnum, boolean skybox)
|
||||
{
|
||||
player_t *player = &players[displayplayers[s]];
|
||||
camera_t *thiscam = &camera[s];
|
||||
boolean chasecam = (cv_chasecam[s].value);
|
||||
sector_t * sector = NULL;
|
||||
player_t *player = &players[displayplayers[pnum]];
|
||||
camera_t *thiscam = &camera[pnum];
|
||||
boolean chasecam = (cv_chasecam[pnum].value);
|
||||
sector_t *viewsec = NULL;
|
||||
|
||||
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_PLAYER1 + s));
|
||||
R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_PLAYER1 + pnum));
|
||||
|
||||
if (thiscam->reset)
|
||||
{
|
||||
R_ResetViewInterpolation(s);
|
||||
R_ResetViewInterpolation(pnum);
|
||||
thiscam->reset = false;
|
||||
}
|
||||
|
||||
@@ -1278,10 +1280,10 @@ void R_SetupFrame(int s, boolean skybox)
|
||||
newview->y = viewmobj->y;
|
||||
newview->z = viewmobj->z + 20*FRACUNIT;
|
||||
|
||||
if (viewmobj->subsector && viewmobj->subsector->sector)
|
||||
sector = viewmobj->subsector->sector;
|
||||
if (viewmobj->subsector)
|
||||
viewsec = viewmobj->subsector->sector;
|
||||
|
||||
R_SetupCommonFrame(player, sector);
|
||||
R_SetupCommonFrame(player, viewsec);
|
||||
}
|
||||
else if (thiscam && chasecam) // use outside cam view
|
||||
{
|
||||
@@ -1292,10 +1294,10 @@ void R_SetupFrame(int s, boolean skybox)
|
||||
newview->y = thiscam->y;
|
||||
newview->z = thiscam->z + (thiscam->height>>1);
|
||||
|
||||
if (thiscam->subsector && thiscam->subsector->sector)
|
||||
sector = thiscam->subsector->sector;
|
||||
if (thiscam->subsector)
|
||||
viewsec = thiscam->subsector->sector;
|
||||
|
||||
R_SetupCommonFrame(player, sector);
|
||||
R_SetupCommonFrame(player, viewsec);
|
||||
}
|
||||
else if (player->mo) // use the player's eyes view
|
||||
{
|
||||
@@ -1306,10 +1308,10 @@ void R_SetupFrame(int s, boolean skybox)
|
||||
newview->y = viewmobj->y;
|
||||
newview->z = player->viewz;
|
||||
|
||||
if (viewmobj->subsector && viewmobj->subsector->sector)
|
||||
sector = viewmobj->subsector->sector;
|
||||
if (viewmobj->subsector)
|
||||
viewsec = viewmobj->subsector->sector;
|
||||
|
||||
R_SetupCommonFrame(player, sector);
|
||||
R_SetupCommonFrame(player, viewsec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -215,8 +215,8 @@ void R_SetViewSize(void);
|
||||
void R_ExecuteSetViewSize(void);
|
||||
|
||||
fixed_t R_GetPlayerFov(player_t *player);
|
||||
void R_SkyboxFrame(int s);
|
||||
void R_SetupFrame(int s, boolean skybox);
|
||||
void R_SkyboxFrame(UINT8 pnum);
|
||||
void R_SetupFrame(UINT8 pnum, boolean skybox);
|
||||
|
||||
// Called by G_Drawer.
|
||||
void R_RenderPlayerView(player_t *player);
|
||||
|
||||
+17
-16
@@ -419,27 +419,28 @@ static void ST_drawDebugInfo(void)
|
||||
|
||||
static void ST_drawLevelTitle(void)
|
||||
{
|
||||
char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
|
||||
char *subttl = mapheaderinfo[gamemap-1]->subttl;
|
||||
char *zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
|
||||
char *actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
INT32 lvlttlxpos;
|
||||
INT32 ttlnumxpos;
|
||||
INT32 zonexpos;
|
||||
INT32 dupcalc = (vid.width/vid.dupx);
|
||||
UINT8 gtc = G_GetGametypeColor(gametype);
|
||||
char *lvlttl, *subttl, *zonttl, *actnum;
|
||||
INT32 lvlttlxpos, ttlnumxpos, zonexpos;
|
||||
INT32 dupcalc;
|
||||
UINT8 gtc;
|
||||
INT32 sub = 0;
|
||||
INT32 bary = (splitscreen)
|
||||
? BASEVIDHEIGHT/2
|
||||
: 163;
|
||||
INT32 bary;
|
||||
INT32 lvlw;
|
||||
|
||||
if (!cv_stagetitle.value)
|
||||
if (!cv_stagetitle.value || (timeinmap > 113))
|
||||
return;
|
||||
|
||||
if (timeinmap > 113)
|
||||
if (*mapheaderinfo[gamemap-1]->lvlttl == '\0')
|
||||
return;
|
||||
|
||||
lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
|
||||
subttl = mapheaderinfo[gamemap-1]->subttl;
|
||||
zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
|
||||
actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
dupcalc = (vid.width/vid.dupx);
|
||||
gtc = G_GetGametypeColor(gametype);
|
||||
bary = (splitscreen) ? BASEVIDHEIGHT/2 : 163;
|
||||
|
||||
lvlw = V_LevelNameWidth(lvlttl);
|
||||
|
||||
if (actnum[0])
|
||||
@@ -603,7 +604,7 @@ static void ST_overlayDrawer(void)
|
||||
}
|
||||
|
||||
// draw level title Tails
|
||||
if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud)
|
||||
if (!(hu_showscores && (netgame || multiplayer) && !mapreset) && LUA_HudEnabled(hud_stagetitle) && !forceshowhud)
|
||||
ST_drawLevelTitle();
|
||||
|
||||
if (!hu_showscores && netgame && !mapreset)
|
||||
@@ -740,7 +741,7 @@ void ST_Drawer(void)
|
||||
UINT8 i;
|
||||
|
||||
#ifdef SEENAMES
|
||||
if (cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset)
|
||||
if (UNLIKELY(cv_seenames.value && cv_allowseenames.value && displayplayers[0] == consoleplayer && seenplayer && seenplayer->mo && !mapreset))
|
||||
{
|
||||
if (cv_seenames.value == 1)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]);
|
||||
|
||||
Reference in new issue
Block a user