Merge branch 'james-kart' into 'master'
My changes to Kart See merge request STJr/SRB2Internal!406
This commit is contained in:
commit
2a8e5b7bff
|
@ -49,6 +49,7 @@ static void COM_Exec_f(void);
|
||||||
static void COM_Wait_f(void);
|
static void COM_Wait_f(void);
|
||||||
static void COM_Help_f(void);
|
static void COM_Help_f(void);
|
||||||
static void COM_Toggle_f(void);
|
static void COM_Toggle_f(void);
|
||||||
|
static void COM_Add_f(void);
|
||||||
|
|
||||||
static void CV_EnforceExecVersion(void);
|
static void CV_EnforceExecVersion(void);
|
||||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
||||||
|
@ -291,6 +292,7 @@ void COM_Init(void)
|
||||||
COM_AddCommand("wait", COM_Wait_f);
|
COM_AddCommand("wait", COM_Wait_f);
|
||||||
COM_AddCommand("help", COM_Help_f);
|
COM_AddCommand("help", COM_Help_f);
|
||||||
COM_AddCommand("toggle", COM_Toggle_f);
|
COM_AddCommand("toggle", COM_Toggle_f);
|
||||||
|
COM_AddCommand("add", COM_Add_f);
|
||||||
RegisterNetXCmd(XD_NETVAR, Got_NetVar);
|
RegisterNetXCmd(XD_NETVAR, Got_NetVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,6 +878,30 @@ static void COM_Toggle_f(void)
|
||||||
CV_AddValue(cvar, +1);
|
CV_AddValue(cvar, +1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Command variant of CV_AddValue
|
||||||
|
*/
|
||||||
|
static void COM_Add_f(void)
|
||||||
|
{
|
||||||
|
consvar_t *cvar;
|
||||||
|
|
||||||
|
if (COM_Argc() != 3)
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("Add <cvar_name> <value>: Add to the value of a cvar. Negative values work too!\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cvar = CV_FindVar(COM_Argv(1));
|
||||||
|
if (!cvar)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("%s is not a cvar\n"), COM_Argv(1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (( cvar->flags & CV_FLOAT ))
|
||||||
|
CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2))));
|
||||||
|
else
|
||||||
|
CV_AddValue(cvar, atoi(COM_Argv(2)));
|
||||||
|
}
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// VARIABLE SIZE BUFFERS
|
// VARIABLE SIZE BUFFERS
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
|
@ -83,11 +83,9 @@ tic_t jointimeout = (10*TICRATE);
|
||||||
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
|
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
|
||||||
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
|
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
|
||||||
|
|
||||||
#ifdef NEWPING
|
|
||||||
UINT16 pingmeasurecount = 1;
|
UINT16 pingmeasurecount = 1;
|
||||||
UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone.
|
UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone.
|
||||||
UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values.
|
UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values.
|
||||||
#endif
|
|
||||||
SINT8 nodetoplayer[MAXNETNODES];
|
SINT8 nodetoplayer[MAXNETNODES];
|
||||||
SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen)
|
SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen)
|
||||||
UINT8 playerpernode[MAXNETNODES]; // used specialy for scplitscreen
|
UINT8 playerpernode[MAXNETNODES]; // used specialy for scplitscreen
|
||||||
|
@ -1325,33 +1323,13 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
netbuffer->u.playerinfo[i].node = (UINT8)playernode[i];
|
netbuffer->u.playerinfo[i].node = i;
|
||||||
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||||
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
|
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
|
||||||
|
|
||||||
//fetch IP address
|
//fetch IP address
|
||||||
{
|
//No, don't do that, you fuckface.
|
||||||
const char *claddress;
|
|
||||||
UINT32 numericaddress[4];
|
|
||||||
|
|
||||||
memset(netbuffer->u.playerinfo[i].address, 0, 4);
|
memset(netbuffer->u.playerinfo[i].address, 0, 4);
|
||||||
if (playernode[i] == 0)
|
|
||||||
{
|
|
||||||
//127.0.0.1
|
|
||||||
netbuffer->u.playerinfo[i].address[0] = 127;
|
|
||||||
netbuffer->u.playerinfo[i].address[3] = 1;
|
|
||||||
}
|
|
||||||
else if (playernode[i] > 0 && I_GetNodeAddress && (claddress = I_GetNodeAddress(playernode[i])) != NULL)
|
|
||||||
{
|
|
||||||
if (sscanf(claddress, "%d.%d.%d.%d", &numericaddress[0], &numericaddress[1], &numericaddress[2], &numericaddress[3]) < 4)
|
|
||||||
goto badaddress;
|
|
||||||
netbuffer->u.playerinfo[i].address[0] = (UINT8)numericaddress[0];
|
|
||||||
netbuffer->u.playerinfo[i].address[1] = (UINT8)numericaddress[1];
|
|
||||||
netbuffer->u.playerinfo[i].address[2] = (UINT8)numericaddress[2];
|
|
||||||
netbuffer->u.playerinfo[i].address[3] = (UINT8)numericaddress[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
badaddress:
|
|
||||||
|
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
|
@ -2883,12 +2861,10 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false);
|
HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false);
|
||||||
kickreason = KR_KICK;
|
kickreason = KR_KICK;
|
||||||
break;
|
break;
|
||||||
#ifdef NEWPING
|
|
||||||
case KICK_MSG_PING_HIGH:
|
case KICK_MSG_PING_HIGH:
|
||||||
HU_AddChatText(va("\x82*%s left the game (Broke ping limit)", player_names[pnum]), false);
|
HU_AddChatText(va("\x82*%s left the game (Broke ping limit)", player_names[pnum]), false);
|
||||||
kickreason = KR_PINGLIMIT;
|
kickreason = KR_PINGLIMIT;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case KICK_MSG_CON_FAIL:
|
case KICK_MSG_CON_FAIL:
|
||||||
HU_AddChatText(va("\x82*%s left the game (Synch Failure)", player_names[pnum]), false);
|
HU_AddChatText(va("\x82*%s left the game (Synch Failure)", player_names[pnum]), false);
|
||||||
kickreason = KR_SYNCH;
|
kickreason = KR_SYNCH;
|
||||||
|
@ -2961,10 +2937,8 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
if (msg == KICK_MSG_CON_FAIL)
|
if (msg == KICK_MSG_CON_FAIL)
|
||||||
M_StartMessage(M_GetText("Server closed connection\n(synch failure)\nPress ESC\n"), NULL, MM_NOTHING);
|
M_StartMessage(M_GetText("Server closed connection\n(synch failure)\nPress ESC\n"), NULL, MM_NOTHING);
|
||||||
#ifdef NEWPING
|
|
||||||
else if (msg == KICK_MSG_PING_HIGH)
|
else if (msg == KICK_MSG_PING_HIGH)
|
||||||
M_StartMessage(M_GetText("Server closed connection\n(Broke ping limit)\nPress ESC\n"), NULL, MM_NOTHING);
|
M_StartMessage(M_GetText("Server closed connection\n(Broke ping limit)\nPress ESC\n"), NULL, MM_NOTHING);
|
||||||
#endif
|
|
||||||
else if (msg == KICK_MSG_BANNED)
|
else if (msg == KICK_MSG_BANNED)
|
||||||
M_StartMessage(M_GetText("You have been banned by the server\n\nPress ESC\n"), NULL, MM_NOTHING);
|
M_StartMessage(M_GetText("You have been banned by the server\n\nPress ESC\n"), NULL, MM_NOTHING);
|
||||||
else if (msg == KICK_MSG_CUSTOM_KICK)
|
else if (msg == KICK_MSG_CUSTOM_KICK)
|
||||||
|
@ -4188,7 +4162,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||||
resynch_local_inprogress = true;
|
resynch_local_inprogress = true;
|
||||||
CL_AcknowledgeResynch(&netbuffer->u.resynchpak);
|
CL_AcknowledgeResynch(&netbuffer->u.resynchpak);
|
||||||
break;
|
break;
|
||||||
#ifdef NEWPING
|
|
||||||
case PT_PING:
|
case PT_PING:
|
||||||
// Only accept PT_PING from the server.
|
// Only accept PT_PING from the server.
|
||||||
if (node != servernode)
|
if (node != servernode)
|
||||||
|
@ -4216,7 +4189,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case PT_SERVERCFG:
|
case PT_SERVERCFG:
|
||||||
break;
|
break;
|
||||||
case PT_FILEFRAGMENT:
|
case PT_FILEFRAGMENT:
|
||||||
|
@ -4730,7 +4702,6 @@ void TryRunTics(tic_t realtics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEWPING
|
|
||||||
static inline void PingUpdate(void)
|
static inline void PingUpdate(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
@ -4788,7 +4759,6 @@ static inline void PingUpdate(void)
|
||||||
|
|
||||||
pingmeasurecount = 1; //Reset count
|
pingmeasurecount = 1; //Reset count
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void NetUpdate(void)
|
void NetUpdate(void)
|
||||||
{
|
{
|
||||||
|
@ -4813,7 +4783,6 @@ void NetUpdate(void)
|
||||||
|
|
||||||
gametime = nowtime;
|
gametime = nowtime;
|
||||||
|
|
||||||
#ifdef NEWPING
|
|
||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
if (netgame && !(gametime % 255))
|
if (netgame && !(gametime % 255))
|
||||||
|
@ -4824,7 +4793,6 @@ void NetUpdate(void)
|
||||||
realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
|
realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
|
||||||
pingmeasurecount++;
|
pingmeasurecount++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
maketic = neededtic;
|
maketic = neededtic;
|
||||||
|
|
|
@ -73,9 +73,7 @@ typedef enum
|
||||||
|
|
||||||
PT_LOGIN, // Login attempt from the client.
|
PT_LOGIN, // Login attempt from the client.
|
||||||
|
|
||||||
#ifdef NEWPING
|
|
||||||
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
||||||
#endif
|
|
||||||
NUMPACKETTYPE
|
NUMPACKETTYPE
|
||||||
} packettype_t;
|
} packettype_t;
|
||||||
|
|
||||||
|
@ -425,9 +423,7 @@ typedef struct
|
||||||
msaskinfo_pak msaskinfo; // 22 bytes
|
msaskinfo_pak msaskinfo; // 22 bytes
|
||||||
plrinfo playerinfo[MAXPLAYERS]; // 1152 bytes (I'd say 36~38)
|
plrinfo playerinfo[MAXPLAYERS]; // 1152 bytes (I'd say 36~38)
|
||||||
plrconfig playerconfig[MAXPLAYERS]; // (up to) 896 bytes (welp they ARE)
|
plrconfig playerconfig[MAXPLAYERS]; // (up to) 896 bytes (welp they ARE)
|
||||||
#ifdef NEWPING
|
|
||||||
UINT32 pingtable[MAXPLAYERS]; // 128 bytes
|
UINT32 pingtable[MAXPLAYERS]; // 128 bytes
|
||||||
#endif
|
|
||||||
} u; // This is needed to pack diff packet types data together
|
} u; // This is needed to pack diff packet types data together
|
||||||
} ATTRPACK doomdata_t;
|
} ATTRPACK doomdata_t;
|
||||||
|
|
||||||
|
@ -461,9 +457,7 @@ extern consvar_t cv_playbackspeed;
|
||||||
#define KICK_MSG_PLAYER_QUIT 3
|
#define KICK_MSG_PLAYER_QUIT 3
|
||||||
#define KICK_MSG_TIMEOUT 4
|
#define KICK_MSG_TIMEOUT 4
|
||||||
#define KICK_MSG_BANNED 5
|
#define KICK_MSG_BANNED 5
|
||||||
#ifdef NEWPING
|
|
||||||
#define KICK_MSG_PING_HIGH 6
|
#define KICK_MSG_PING_HIGH 6
|
||||||
#endif
|
|
||||||
#define KICK_MSG_CUSTOM_KICK 7
|
#define KICK_MSG_CUSTOM_KICK 7
|
||||||
#define KICK_MSG_CUSTOM_BAN 8
|
#define KICK_MSG_CUSTOM_BAN 8
|
||||||
|
|
||||||
|
@ -488,11 +482,9 @@ extern SINT8 servernode;
|
||||||
void Command_Ping_f(void);
|
void Command_Ping_f(void);
|
||||||
extern tic_t connectiontimeout;
|
extern tic_t connectiontimeout;
|
||||||
extern tic_t jointimeout;
|
extern tic_t jointimeout;
|
||||||
#ifdef NEWPING
|
|
||||||
extern UINT16 pingmeasurecount;
|
extern UINT16 pingmeasurecount;
|
||||||
extern UINT32 realpingtable[MAXPLAYERS];
|
extern UINT32 realpingtable[MAXPLAYERS];
|
||||||
extern UINT32 playerpingtable[MAXPLAYERS];
|
extern UINT32 playerpingtable[MAXPLAYERS];
|
||||||
#endif
|
|
||||||
|
|
||||||
extern consvar_t cv_joinnextround, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
extern consvar_t cv_joinnextround, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||||
|
|
||||||
|
|
22
src/d_main.c
22
src/d_main.c
|
@ -1244,14 +1244,21 @@ void D_SRB2Main(void)
|
||||||
sound_disabled = true;
|
sound_disabled = true;
|
||||||
midi_disabled = digital_disabled = true;
|
midi_disabled = digital_disabled = true;
|
||||||
}
|
}
|
||||||
|
if (M_CheckParm("-noaudio")) // combines -nosound and -nomusic
|
||||||
|
{
|
||||||
|
sound_disabled = true;
|
||||||
|
digital_disabled = true;
|
||||||
|
midi_disabled = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
|
||||||
}
|
|
||||||
if (M_CheckParm("-nosound"))
|
if (M_CheckParm("-nosound"))
|
||||||
sound_disabled = true;
|
sound_disabled = true;
|
||||||
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
|
if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic
|
||||||
midi_disabled = digital_disabled = true;
|
{
|
||||||
|
digital_disabled = true;
|
||||||
|
midi_disabled = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (M_CheckParm("-nomidimusic"))
|
if (M_CheckParm("-nomidimusic"))
|
||||||
|
@ -1259,9 +1266,18 @@ void D_SRB2Main(void)
|
||||||
if (M_CheckParm("-nodigmusic"))
|
if (M_CheckParm("-nodigmusic"))
|
||||||
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
|
digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!( sound_disabled && digital_disabled
|
||||||
|
#ifndef NO_MIDI
|
||||||
|
&& midi_disabled
|
||||||
|
#endif
|
||||||
|
))
|
||||||
|
{
|
||||||
|
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
||||||
I_StartupSound();
|
I_StartupSound();
|
||||||
I_InitMusic();
|
I_InitMusic();
|
||||||
S_InitSfxChannels(cv_soundvolume.value);
|
S_InitSfxChannels(cv_soundvolume.value);
|
||||||
|
}
|
||||||
|
|
||||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||||
ST_Init();
|
ST_Init();
|
||||||
|
|
121
src/d_net.c
121
src/d_net.c
|
@ -185,22 +185,10 @@ typedef struct
|
||||||
UINT8 nextacknum;
|
UINT8 nextacknum;
|
||||||
|
|
||||||
UINT8 flags;
|
UINT8 flags;
|
||||||
#ifndef NEWPING
|
|
||||||
// jacobson tcp timeout evaluation algorithm (Karn variation)
|
|
||||||
fixed_t ping;
|
|
||||||
fixed_t varping;
|
|
||||||
INT32 timeout; // computed with ping and varping
|
|
||||||
#endif
|
|
||||||
} node_t;
|
} node_t;
|
||||||
|
|
||||||
static node_t nodes[MAXNETNODES];
|
static node_t nodes[MAXNETNODES];
|
||||||
#ifndef NEWPING
|
#define NODETIMEOUT 14
|
||||||
#define PINGDEFAULT ((200*TICRATE*FRACUNIT)/1000)
|
|
||||||
#define VARPINGDEFAULT ((50*TICRATE*FRACUNIT)/1000)
|
|
||||||
#define TIMEOUT(p,v) (p+4*v+FRACUNIT/2)>>FRACBITS;
|
|
||||||
#else
|
|
||||||
#define NODETIMEOUT 14 //What the above boiled down to...
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
// return <0 if a < b (mod 256)
|
// return <0 if a < b (mod 256)
|
||||||
|
@ -320,19 +308,7 @@ static UINT8 GetAcktosend(INT32 node)
|
||||||
static void RemoveAck(INT32 i)
|
static void RemoveAck(INT32 i)
|
||||||
{
|
{
|
||||||
INT32 node = ackpak[i].destinationnode;
|
INT32 node = ackpak[i].destinationnode;
|
||||||
#ifndef NEWPING
|
|
||||||
fixed_t trueping = (I_GetTime() - ackpak[i].senttime)<<FRACBITS;
|
|
||||||
if (ackpak[i].resentnum)
|
|
||||||
{
|
|
||||||
// +FRACUNIT/2 for round
|
|
||||||
nodes[node].ping = (nodes[node].ping*7 + trueping)/8;
|
|
||||||
nodes[node].varping = (nodes[node].varping*7 + abs(nodes[node].ping-trueping))/8;
|
|
||||||
nodes[node].timeout = TIMEOUT(nodes[node].ping,nodes[node].varping);
|
|
||||||
}
|
|
||||||
DEBFILE(va("Remove ack %d trueping %d ping %f var %f timeout %d\n",ackpak[i].acknum,trueping>>FRACBITS,(double)FIXED_TO_FLOAT(nodes[node].ping),(double)FIXED_TO_FLOAT(nodes[node].varping),nodes[node].timeout));
|
|
||||||
#else
|
|
||||||
DEBFILE(va("Remove ack %d\n",ackpak[i].acknum));
|
DEBFILE(va("Remove ack %d\n",ackpak[i].acknum));
|
||||||
#endif
|
|
||||||
ackpak[i].acknum = 0;
|
ackpak[i].acknum = 0;
|
||||||
if (nodes[node].flags & NF_CLOSE)
|
if (nodes[node].flags & NF_CLOSE)
|
||||||
Net_CloseConnection(node);
|
Net_CloseConnection(node);
|
||||||
|
@ -519,11 +495,7 @@ void Net_AckTicker(void)
|
||||||
{
|
{
|
||||||
const INT32 nodei = ackpak[i].destinationnode;
|
const INT32 nodei = ackpak[i].destinationnode;
|
||||||
node_t *node = &nodes[nodei];
|
node_t *node = &nodes[nodei];
|
||||||
#ifdef NEWPING
|
|
||||||
if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
|
if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
|
||||||
#else
|
|
||||||
if (ackpak[i].acknum && ackpak[i].senttime + node->timeout < I_GetTime())
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (ackpak[i].resentnum > 10 && (node->flags & NF_CLOSE))
|
if (ackpak[i].resentnum > 10 && (node->flags & NF_CLOSE))
|
||||||
{
|
{
|
||||||
|
@ -534,13 +506,8 @@ void Net_AckTicker(void)
|
||||||
ackpak[i].acknum = 0;
|
ackpak[i].acknum = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef NEWPING
|
|
||||||
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
|
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
|
||||||
NODETIMEOUT, I_GetTime()));
|
NODETIMEOUT, I_GetTime()));
|
||||||
#else
|
|
||||||
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
|
|
||||||
node->timeout, I_GetTime()));
|
|
||||||
#endif
|
|
||||||
M_Memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
|
M_Memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
|
||||||
ackpak[i].senttime = I_GetTime();
|
ackpak[i].senttime = I_GetTime();
|
||||||
ackpak[i].resentnum++;
|
ackpak[i].resentnum++;
|
||||||
|
@ -658,11 +625,6 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
||||||
static void InitNode(node_t *node)
|
static void InitNode(node_t *node)
|
||||||
{
|
{
|
||||||
node->acktosend_head = node->acktosend_tail = 0;
|
node->acktosend_head = node->acktosend_tail = 0;
|
||||||
#ifndef NEWPING
|
|
||||||
node->ping = PINGDEFAULT;
|
|
||||||
node->varping = VARPINGDEFAULT;
|
|
||||||
node->timeout = TIMEOUT(node->ping, node->varping);
|
|
||||||
#endif
|
|
||||||
node->firstacktosend = 0;
|
node->firstacktosend = 0;
|
||||||
node->nextacknum = 1;
|
node->nextacknum = 1;
|
||||||
node->remotefirstack = 0;
|
node->remotefirstack = 0;
|
||||||
|
@ -843,9 +805,7 @@ static const char *packettypename[NUMPACKETTYPE] =
|
||||||
"CLIENTJOIN",
|
"CLIENTJOIN",
|
||||||
"NODETIMEOUT",
|
"NODETIMEOUT",
|
||||||
"RESYNCHING",
|
"RESYNCHING",
|
||||||
#ifdef NEWPING
|
|
||||||
"PING"
|
"PING"
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void DebugPrintpacket(const char *header)
|
static void DebugPrintpacket(const char *header)
|
||||||
|
@ -1384,30 +1344,73 @@ boolean D_CheckNetGame(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct pingcell
|
||||||
|
{
|
||||||
|
INT32 num;
|
||||||
|
INT32 ms;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int pingcellcmp(const void *va, const void *vb)
|
||||||
|
{
|
||||||
|
const struct pingcell *a, *b;
|
||||||
|
a = va;
|
||||||
|
b = vb;
|
||||||
|
return ( a->ms - b->ms );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
New ping command formatted nicely to present ping in
|
||||||
|
ascending order. And with equally spaced columns.
|
||||||
|
The caller's ping is presented at the bottom too, for
|
||||||
|
convenience.
|
||||||
|
*/
|
||||||
|
|
||||||
void Command_Ping_f(void)
|
void Command_Ping_f(void)
|
||||||
{
|
{
|
||||||
#ifndef NEWPING
|
struct pingcell pingv[MAXPLAYERS];
|
||||||
if(server)
|
INT32 pingc;
|
||||||
{
|
|
||||||
#endif
|
int name_width = 0;
|
||||||
|
int ms_width = 0;
|
||||||
|
|
||||||
|
int n;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
for (i = 0; i < MAXPLAYERS;i++)
|
|
||||||
|
pingc = 0;
|
||||||
|
for (i = 1; i < MAXPLAYERS; ++i)
|
||||||
|
if (playeringame[i])
|
||||||
{
|
{
|
||||||
#ifndef NEWPING
|
n = strlen(player_names[i]);
|
||||||
const INT32 node = playernode[i];
|
if (n > name_width)
|
||||||
if (playeringame[i] && node != 0)
|
name_width = n;
|
||||||
CONS_Printf(M_GetText("%.2d : %s\n %d tics, %d ms.\n"), i, player_names[i],
|
|
||||||
GetLag(node), G_TicsToMilliseconds(GetLag(node)));
|
n = playerpingtable[i];
|
||||||
#else
|
if (n > ms_width)
|
||||||
if (playeringame[i] && i != 0)
|
ms_width = n;
|
||||||
CONS_Printf(M_GetText("%.2d : %s\n %d ms\n"), i, player_names[i], playerpingtable[i]);
|
|
||||||
#endif
|
pingv[pingc].num = i;
|
||||||
|
pingv[pingc].ms = playerpingtable[i];
|
||||||
|
pingc++;
|
||||||
}
|
}
|
||||||
#ifndef NEWPING
|
|
||||||
|
if (ms_width < 10) ms_width = 1;
|
||||||
|
else if (ms_width < 100) ms_width = 2;
|
||||||
|
else ms_width = 3;
|
||||||
|
|
||||||
|
qsort(pingv, pingc, sizeof (struct pingcell), &pingcellcmp);
|
||||||
|
|
||||||
|
for (i = 0; i < pingc; ++i)
|
||||||
|
{
|
||||||
|
CONS_Printf("%02d : %-*s %*d ms\n",
|
||||||
|
pingv[i].num,
|
||||||
|
name_width, player_names[pingv[i].num],
|
||||||
|
ms_width, pingv[i].ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!server && playeringame[consoleplayer])
|
||||||
|
{
|
||||||
|
CONS_Printf("\nYour ping is %d ms\n", playerpingtable[consoleplayer]);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
CONS_Printf(M_GetText("Only the server can use this.\n"));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void D_CloseConnection(void)
|
void D_CloseConnection(void)
|
||||||
|
|
|
@ -342,9 +342,7 @@ static CV_PossibleValue_t nettimeout_cons_t[] = {{TICRATE/7, "MIN"}, {60*TICRATE
|
||||||
consvar_t cv_nettimeout = {"nettimeout", "350", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_nettimeout = {"nettimeout", "350", CV_CALL|CV_SAVE, nettimeout_cons_t, NetTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t jointimeout_cons_t[] = {{5*TICRATE, "MIN"}, {60*TICRATE, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_jointimeout = {"jointimeout", "350", CV_CALL|CV_SAVE, jointimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_jointimeout = {"jointimeout", "350", CV_CALL|CV_SAVE, jointimeout_cons_t, JoinTimeout_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#ifdef NEWPING
|
|
||||||
consvar_t cv_maxping = {"maxping", "0", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_maxping = {"maxping", "0", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
|
||||||
// Intermission time Tails 04-19-2002
|
// Intermission time Tails 04-19-2002
|
||||||
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_inttime = {"inttime", "10", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_inttime = {"inttime", "10", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -575,9 +573,7 @@ void D_RegisterServerCommands(void)
|
||||||
|
|
||||||
CV_RegisterVar(&cv_skipmapcheck);
|
CV_RegisterVar(&cv_skipmapcheck);
|
||||||
CV_RegisterVar(&cv_sleep);
|
CV_RegisterVar(&cv_sleep);
|
||||||
#ifdef NEWPING
|
|
||||||
CV_RegisterVar(&cv_maxping);
|
CV_RegisterVar(&cv_maxping);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SEENAMES
|
#ifdef SEENAMES
|
||||||
CV_RegisterVar(&cv_allowseenames);
|
CV_RegisterVar(&cv_allowseenames);
|
||||||
|
@ -742,6 +738,8 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_chasefreelook);
|
CV_RegisterVar(&cv_chasefreelook);
|
||||||
CV_RegisterVar(&cv_chasefreelook2);
|
CV_RegisterVar(&cv_chasefreelook2);
|
||||||
CV_RegisterVar(&cv_tutorialprompt);
|
CV_RegisterVar(&cv_tutorialprompt);
|
||||||
|
CV_RegisterVar(&cv_showfocuslost);
|
||||||
|
CV_RegisterVar(&cv_pauseifunfocused);
|
||||||
|
|
||||||
// g_input.c
|
// g_input.c
|
||||||
CV_RegisterVar(&cv_sideaxis);
|
CV_RegisterVar(&cv_sideaxis);
|
||||||
|
|
|
@ -107,9 +107,7 @@ extern consvar_t cv_ringslinger, cv_soundtest;
|
||||||
|
|
||||||
extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes;
|
extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes;
|
||||||
|
|
||||||
#ifdef NEWPING
|
|
||||||
extern consvar_t cv_maxping;
|
extern consvar_t cv_maxping;
|
||||||
#endif
|
|
||||||
|
|
||||||
extern consvar_t cv_skipmapcheck;
|
extern consvar_t cv_skipmapcheck;
|
||||||
|
|
||||||
|
|
|
@ -509,13 +509,17 @@ INT32 I_GetKey(void);
|
||||||
// Max gamepad/joysticks that can be detected/used.
|
// Max gamepad/joysticks that can be detected/used.
|
||||||
#define MAX_JOYSTICKS 4
|
#define MAX_JOYSTICKS 4
|
||||||
|
|
||||||
|
#ifndef M_PIl
|
||||||
|
#define M_PIl 3.1415926535897932384626433832795029L
|
||||||
|
#endif
|
||||||
|
|
||||||
// Floating point comparison epsilons from float.h
|
// Floating point comparison epsilons from float.h
|
||||||
#ifndef FLT_EPSILON
|
#ifndef FLT_EPSILON
|
||||||
#define FLT_EPSILON 1.1920928955078125e-7f
|
#define FLT_EPSILON 1.1920928955078125e-7f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DBL_EPSILON
|
#ifndef DBL_EPSILON
|
||||||
#define DBL_EPSILON 2.2204460492503131e-16
|
#define DBL_EPSILON 2.2204460492503131e-16l
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// An assert-type mechanism.
|
// An assert-type mechanism.
|
||||||
|
@ -561,9 +565,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
/// Polyobject fake flat code
|
/// Polyobject fake flat code
|
||||||
#define POLYOBJECTS_PLANES
|
#define POLYOBJECTS_PLANES
|
||||||
|
|
||||||
/// Improved way of dealing with ping values and a ping limit.
|
|
||||||
#define NEWPING
|
|
||||||
|
|
||||||
/// See name of player in your crosshair
|
/// See name of player in your crosshair
|
||||||
#define SEENAMES
|
#define SEENAMES
|
||||||
|
|
||||||
|
|
120
src/g_game.c
120
src/g_game.c
|
@ -361,6 +361,8 @@ consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, N
|
||||||
static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}};
|
static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}};
|
||||||
consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
// Pause game upon window losing focus
|
||||||
|
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -1713,65 +1715,6 @@ static INT32 camtoggledelay, camtoggledelay2 = 0;
|
||||||
//
|
//
|
||||||
boolean G_Responder(event_t *ev)
|
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[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
|
|
||||||
{
|
|
||||||
if (splitscreen || !netgame)
|
|
||||||
displayplayer = consoleplayer;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// spy mode
|
|
||||||
do
|
|
||||||
{
|
|
||||||
displayplayer++;
|
|
||||||
if (displayplayer == MAXPLAYERS)
|
|
||||||
displayplayer = 0;
|
|
||||||
|
|
||||||
if (!playeringame[displayplayer])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (players[displayplayer].spectator)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (G_GametypeHasTeams())
|
|
||||||
{
|
|
||||||
if (players[consoleplayer].ctfteam
|
|
||||||
&& players[displayplayer].ctfteam != players[consoleplayer].ctfteam)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (gametype == GT_HIDEANDSEEK)
|
|
||||||
{
|
|
||||||
if (players[consoleplayer].pflags & PF_TAGIT)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Other Tag-based gametypes?
|
|
||||||
else if (G_TagGametype())
|
|
||||||
{
|
|
||||||
if (!players[consoleplayer].spectator
|
|
||||||
&& (players[consoleplayer].pflags & PF_TAGIT) != (players[displayplayer].pflags & PF_TAGIT))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (G_GametypeHasSpectators() && G_RingSlingerGametype())
|
|
||||||
{
|
|
||||||
if (!players[consoleplayer].spectator)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
} while (displayplayer != consoleplayer);
|
|
||||||
|
|
||||||
// change statusbar also if playing back demo
|
|
||||||
if (singledemo)
|
|
||||||
ST_changeDemoView();
|
|
||||||
|
|
||||||
// tell who's the view
|
|
||||||
CONS_Printf(M_GetText("Viewpoint: %s\n"), player_names[displayplayer]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// any other key pops up menu if in demos
|
// any other key pops up menu if in demos
|
||||||
if (gameaction == ga_nothing && !singledemo &&
|
if (gameaction == ga_nothing && !singledemo &&
|
||||||
((demoplayback && !modeattacking && !titledemo) || gamestate == GS_TITLESCREEN))
|
((demoplayback && !modeattacking && !titledemo) || gamestate == GS_TITLESCREEN))
|
||||||
|
@ -1848,6 +1791,65 @@ boolean G_Responder(event_t *ev)
|
||||||
if (HU_Responder(ev))
|
if (HU_Responder(ev))
|
||||||
return true; // chat ate the event
|
return true; // chat ate the event
|
||||||
|
|
||||||
|
// allow spy mode changes even during the demo
|
||||||
|
if (gamestate == GS_LEVEL && ev->type == ev_keydown
|
||||||
|
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
|
||||||
|
{
|
||||||
|
if (splitscreen || !netgame)
|
||||||
|
displayplayer = consoleplayer;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// spy mode
|
||||||
|
do
|
||||||
|
{
|
||||||
|
displayplayer++;
|
||||||
|
if (displayplayer == MAXPLAYERS)
|
||||||
|
displayplayer = 0;
|
||||||
|
|
||||||
|
if (!playeringame[displayplayer])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (players[displayplayer].spectator)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (G_GametypeHasTeams())
|
||||||
|
{
|
||||||
|
if (players[consoleplayer].ctfteam
|
||||||
|
&& players[displayplayer].ctfteam != players[consoleplayer].ctfteam)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (gametype == GT_HIDEANDSEEK)
|
||||||
|
{
|
||||||
|
if (players[consoleplayer].pflags & PF_TAGIT)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Other Tag-based gametypes?
|
||||||
|
else if (G_TagGametype())
|
||||||
|
{
|
||||||
|
if (!players[consoleplayer].spectator
|
||||||
|
&& (players[consoleplayer].pflags & PF_TAGIT) != (players[displayplayer].pflags & PF_TAGIT))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (G_GametypeHasSpectators() && G_RingSlingerGametype())
|
||||||
|
{
|
||||||
|
if (!players[consoleplayer].spectator)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
} while (displayplayer != consoleplayer);
|
||||||
|
|
||||||
|
// change statusbar also if playing back demo
|
||||||
|
if (singledemo)
|
||||||
|
ST_changeDemoView();
|
||||||
|
|
||||||
|
// tell who's the view
|
||||||
|
CONS_Printf(M_GetText("Viewpoint: %s\n"), player_names[displayplayer]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update keys current state
|
// update keys current state
|
||||||
G_MapEventsToControls(ev);
|
G_MapEventsToControls(ev);
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ extern boolean pausebreakkey;
|
||||||
|
|
||||||
extern boolean promptactive;
|
extern boolean promptactive;
|
||||||
|
|
||||||
|
extern consvar_t cv_pauseifunfocused;
|
||||||
|
|
||||||
// used in game menu
|
// used in game menu
|
||||||
extern consvar_t cv_tutorialprompt;
|
extern consvar_t cv_tutorialprompt;
|
||||||
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_compactscoreboard;
|
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_compactscoreboard;
|
||||||
|
|
|
@ -201,7 +201,7 @@ static polyvertex_t *fracdivline(fdivline_t *bsp, polyvertex_t *v1,
|
||||||
// (do not accept hit with the extensions)
|
// (do not accept hit with the extensions)
|
||||||
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
num = (v2x - v1x)*v2dy + (v1y - v2y)*v2dx;
|
||||||
frac = num / den;
|
frac = num / den;
|
||||||
if (frac < 0.0 || frac > 1.0)
|
if (frac < 0.0l || frac > 1.0l)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// now get the frac along the BSP line
|
// now get the frac along the BSP line
|
||||||
|
|
|
@ -61,9 +61,6 @@ typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
#ifndef M_PIl
|
|
||||||
#define M_PIl 3.1415926535897932384626433832795029L
|
|
||||||
#endif
|
|
||||||
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
||||||
|
|
||||||
void DBG_Printf(const char *lpFmt, ...) /*FUNCPRINTF*/;
|
void DBG_Printf(const char *lpFmt, ...) /*FUNCPRINTF*/;
|
||||||
|
|
|
@ -387,6 +387,8 @@ static void Dummymares_OnChange(void);
|
||||||
// CONSOLE VARIABLES AND THEIR POSSIBLE VALUES GO HERE.
|
// CONSOLE VARIABLES AND THEIR POSSIBLE VALUES GO HERE.
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
|
consvar_t cv_showfocuslost = {"showfocuslost", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||||
|
|
||||||
static CV_PossibleValue_t map_cons_t[] = {
|
static CV_PossibleValue_t map_cons_t[] = {
|
||||||
{1,"MIN"},
|
{1,"MIN"},
|
||||||
{NUMMAPS, "MAX"}
|
{NUMMAPS, "MAX"}
|
||||||
|
@ -407,7 +409,7 @@ static CV_PossibleValue_t serversort_cons_t[] = {
|
||||||
{1,"Modified State"},
|
{1,"Modified State"},
|
||||||
{2,"Most Players"},
|
{2,"Most Players"},
|
||||||
{3,"Least Players"},
|
{3,"Least Players"},
|
||||||
{4,"Max Players"},
|
{4,"Max Player Slots"},
|
||||||
{5,"Gametype"},
|
{5,"Gametype"},
|
||||||
{0,NULL}
|
{0,NULL}
|
||||||
};
|
};
|
||||||
|
@ -1231,6 +1233,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
||||||
{IT_HEADER, NULL, "Diagnostic", NULL, 180},
|
{IT_HEADER, NULL, "Diagnostic", NULL, 180},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 186},
|
{IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 186},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Clear Before Redraw", &cv_homremoval, 191},
|
{IT_STRING | IT_CVAR, NULL, "Clear Before Redraw", &cv_homremoval, 191},
|
||||||
|
{IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 196},
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_VideoModeMenu[] =
|
static menuitem_t OP_VideoModeMenu[] =
|
||||||
|
@ -3316,7 +3319,7 @@ void M_Drawer(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// focus lost notification goes on top of everything, even the former everything
|
// focus lost notification goes on top of everything, even the former everything
|
||||||
if (window_notinfocus)
|
if (window_notinfocus && cv_showfocuslost.value)
|
||||||
{
|
{
|
||||||
M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2);
|
M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2);
|
||||||
if (gamestate == GS_LEVEL && (P_AutoPause() || paused))
|
if (gamestate == GS_LEVEL && (P_AutoPause() || paused))
|
||||||
|
|
|
@ -374,6 +374,7 @@ typedef struct
|
||||||
|
|
||||||
extern description_t description[MAXSKINS];
|
extern description_t description[MAXSKINS];
|
||||||
|
|
||||||
|
extern consvar_t cv_showfocuslost;
|
||||||
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
|
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
|
||||||
extern CV_PossibleValue_t gametype_cons_t[];
|
extern CV_PossibleValue_t gametype_cons_t[];
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ boolean P_AutoPause(void)
|
||||||
if (netgame || modeattacking || gamestate == GS_TITLESCREEN)
|
if (netgame || modeattacking || gamestate == GS_TITLESCREEN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (menuactive || window_notinfocus);
|
return (menuactive || ( window_notinfocus && cv_pauseifunfocused.value ));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1113,7 +1113,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
|
||||||
zeroheight = FIXED_TO_FLOAT(temp);
|
zeroheight = FIXED_TO_FLOAT(temp);
|
||||||
|
|
||||||
#define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180)
|
#define ANG2RAD(angle) ((float)((angle)*M_PIl)/ANGLE_180)
|
||||||
|
|
||||||
// p is the texture origin in view space
|
// p is the texture origin in view space
|
||||||
// Don't add in the offsets at this stage, because doing so can result in
|
// Don't add in the offsets at this stage, because doing so can result in
|
||||||
|
|
|
@ -2202,7 +2202,7 @@ static void Command_RestartAudio_f(void)
|
||||||
|
|
||||||
void GameSounds_OnChange(void)
|
void GameSounds_OnChange(void)
|
||||||
{
|
{
|
||||||
if (M_CheckParm("-nosound"))
|
if (M_CheckParm("-nosound") || M_CheckParm("-noaudio"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sound_disabled)
|
if (sound_disabled)
|
||||||
|
@ -2220,7 +2220,7 @@ void GameSounds_OnChange(void)
|
||||||
|
|
||||||
void GameDigiMusic_OnChange(void)
|
void GameDigiMusic_OnChange(void)
|
||||||
{
|
{
|
||||||
if (M_CheckParm("-nomusic"))
|
if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio"))
|
||||||
return;
|
return;
|
||||||
else if (M_CheckParm("-nodigmusic"))
|
else if (M_CheckParm("-nodigmusic"))
|
||||||
return;
|
return;
|
||||||
|
@ -2262,7 +2262,7 @@ void GameDigiMusic_OnChange(void)
|
||||||
|
|
||||||
void GameMIDIMusic_OnChange(void)
|
void GameMIDIMusic_OnChange(void)
|
||||||
{
|
{
|
||||||
if (M_CheckParm("-nomusic"))
|
if (M_CheckParm("-nomusic") || M_CheckParm("-noaudio"))
|
||||||
return;
|
return;
|
||||||
else if (M_CheckParm("-nomidimusic"))
|
else if (M_CheckParm("-nomidimusic"))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -421,9 +421,9 @@ void SCR_DisplayTicRate(void)
|
||||||
else if (totaltics == TICRATE) ticcntcolor = V_GREENMAP;
|
else if (totaltics == TICRATE) ticcntcolor = V_GREENMAP;
|
||||||
|
|
||||||
V_DrawString(vid.width-(72*vid.dupx), h,
|
V_DrawString(vid.width-(72*vid.dupx), h,
|
||||||
V_YELLOWMAP|V_NOSCALESTART, "FPS:");
|
V_YELLOWMAP|V_NOSCALESTART|V_HUDTRANS, "FPS:");
|
||||||
V_DrawString(vid.width-(40*vid.dupx), h,
|
V_DrawString(vid.width-(40*vid.dupx), h,
|
||||||
ticcntcolor|V_NOSCALESTART, va("%02d/%02u", totaltics, TICRATE));
|
ticcntcolor|V_NOSCALESTART|V_HUDTRANS, va("%02d/%02u", totaltics, TICRATE));
|
||||||
|
|
||||||
lasttic = ontic;
|
lasttic = ontic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,6 +357,14 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SDLdoGrabMouse(void)
|
||||||
|
{
|
||||||
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||||
|
if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) // already warps mouse if successful
|
||||||
|
wrapmouseok = SDL_TRUE; // TODO: is wrapmouseok or HalfWarpMouse needed anymore?
|
||||||
|
}
|
||||||
|
|
||||||
static void SDLdoUngrabMouse(void)
|
static void SDLdoUngrabMouse(void)
|
||||||
{
|
{
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
@ -579,6 +587,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||||
if (cv_usemouse.value) I_StartupMouse();
|
if (cv_usemouse.value) I_StartupMouse();
|
||||||
}
|
}
|
||||||
//else firsttimeonmouse = SDL_FALSE;
|
//else firsttimeonmouse = SDL_FALSE;
|
||||||
|
|
||||||
|
if (USE_MOUSEINPUT)
|
||||||
|
SDLdoGrabMouse();
|
||||||
}
|
}
|
||||||
else if (!mousefocus && !kbfocus)
|
else if (!mousefocus && !kbfocus)
|
||||||
{
|
{
|
||||||
|
@ -655,9 +666,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
||||||
// -- Monster Iestyn
|
// -- Monster Iestyn
|
||||||
if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window)
|
if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window)
|
||||||
{
|
{
|
||||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
SDLdoGrabMouse();
|
||||||
if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) // already warps mouse if successful
|
|
||||||
wrapmouseok = SDL_TRUE; // TODO: is wrapmouseok or HalfWarpMouse needed anymore?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1065,7 @@ void I_StartupMouse(void)
|
||||||
else
|
else
|
||||||
firsttimeonmouse = SDL_FALSE;
|
firsttimeonmouse = SDL_FALSE;
|
||||||
if (cv_usemouse.value)
|
if (cv_usemouse.value)
|
||||||
return;
|
SDLdoGrabMouse();
|
||||||
else
|
else
|
||||||
SDLdoUngrabMouse();
|
SDLdoUngrabMouse();
|
||||||
}
|
}
|
||||||
|
@ -1164,8 +1173,11 @@ void I_FinishUpdate(void)
|
||||||
if (cv_closedcaptioning.value)
|
if (cv_closedcaptioning.value)
|
||||||
SCR_ClosedCaptions();
|
SCR_ClosedCaptions();
|
||||||
|
|
||||||
|
if (st_overlay)
|
||||||
|
{
|
||||||
if (cv_ticrate.value)
|
if (cv_ticrate.value)
|
||||||
SCR_DisplayTicRate();
|
SCR_DisplayTicRate();
|
||||||
|
}
|
||||||
|
|
||||||
if (rendermode == render_soft && screens[0])
|
if (rendermode == render_soft && screens[0])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue