From 174ba9f64bbef4138a50a574eb0a61564681e290 Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 16 Jun 2011 02:03:57 +0000 Subject: [PATCH] Trying to fix lingering d3d bugs. Added support for proquake's angles extension. Various other hacks and changes and tweeks. Mostly trying to fix D3D issues. Also added con_separatechat cvar. git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3818 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_input.c | 50 +- engine/client/cl_main.c | 77 +- engine/client/cl_master.h | 6 +- engine/client/cl_parse.c | 33 +- engine/client/cl_plugin.inc | 4 +- engine/client/cl_screen.c | 2 - engine/client/cl_ui.c | 3 +- engine/client/client.h | 7 +- engine/client/console.c | 155 +- engine/client/keys.c | 8 +- engine/client/m_master.c | 21 +- engine/client/m_mp3.c | 1 - engine/client/m_multi.c | 2 +- engine/client/menu.h | 2 +- engine/client/net_master.c | 90 +- engine/client/pr_csqc.c | 10 +- engine/client/pr_menu.c | 2 +- engine/client/r_2d.c | 4 +- engine/client/sbar.c | 5 + engine/client/screen.h | 1 + engine/common/bothdefs.h | 1 + engine/common/common.c | 2 +- engine/common/common.h | 3 + engine/common/console.h | 15 +- engine/common/net.h | 3 +- engine/common/net_chan.c | 79 +- engine/common/net_wins.c | 6 +- engine/common/protocol.h | 12 +- engine/d3d/d3d_backend.c | 257 ++- engine/d3d/vid_d3d.c | 52 +- engine/dotnet2005/ftequake.sln | 16 + engine/dotnet2005/ftequake.vcproj | 3230 +++++++++++++++++++++++++++++ engine/gl/gl_font.c | 8 + engine/gl/gl_screen.c | 2 +- engine/gl/gl_vidnt.c | 99 +- engine/gl/glquake.h | 2 + engine/server/sv_main.c | 27 +- engine/server/sv_send.c | 10 +- engine/server/sv_sys_unix.c | 1 + 39 files changed, 3898 insertions(+), 410 deletions(-) diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index fb5db86bc..712e4a167 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -791,7 +791,7 @@ void CLNQ_SendMove (usercmd_t *cmd, int pnum, sizebuf_t *buf) for (i=0 ; i<3 ; i++) { - if (cls.protocol_nq == CPNQ_FITZ666) + if (cls.protocol_nq == CPNQ_FITZ666 || cls.protocol_nq == CPNQ_PROQUAKE3_4) MSG_WriteAngle16 (buf, cl.viewangles[pnum][i]); else MSG_WriteAngle (buf, cl.viewangles[pnum][i]); @@ -842,7 +842,7 @@ void CLNQ_SendCmd(sizebuf_t *buf) { extern int cl_latestframenum; - if (cls.signon == 4) +// if (cls.signon == 4) { // send the unreliable message if (independantphysics[0].impulse && !cls.netchan.message.cursize) @@ -858,7 +858,6 @@ void CLNQ_SendCmd(sizebuf_t *buf) } memset(&independantphysics[0], 0, sizeof(independantphysics[0])); - cl.allowsendpacket = false; } #else void Name_Callback(struct cvar_s *var, char *oldvalue) @@ -1626,37 +1625,38 @@ void CL_SendCmd (double frametime, qboolean mainloop) // if (skipcmd) // return; -#ifdef NQPROT - if ((!cl.allowsendpacket || cls.state <= ca_connected) && cls.protocol == CP_NETQUAKE) - return; -#endif if (!fullsend && cls.state == ca_active) return; // when we're actually playing we try to match netfps exactly to avoid gameplay problems - CL_SendDownloadReq(&buf); - - while (clientcmdlist) +#ifdef NQPROT + if (cls.protocol != CP_NETQUAKE || cls.netchan.nqreliable_allowed) +#endif { - next = clientcmdlist->next; - if (clientcmdlist->reliable) + CL_SendDownloadReq(&buf); + + while (clientcmdlist) { - if (cls.netchan.message.cursize + 2+strlen(clientcmdlist->command) > cls.netchan.message.maxsize) - break; - MSG_WriteByte (&cls.netchan.message, clc_stringcmd); - MSG_WriteString (&cls.netchan.message, clientcmdlist->command); - } - else - { - if (buf.cursize + 2+strlen(clientcmdlist->command) <= buf.maxsize) + next = clientcmdlist->next; + if (clientcmdlist->reliable) { - MSG_WriteByte (&buf, clc_stringcmd); - MSG_WriteString (&buf, clientcmdlist->command); + if (cls.netchan.message.cursize + 2+strlen(clientcmdlist->command) > cls.netchan.message.maxsize) + break; + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); + MSG_WriteString (&cls.netchan.message, clientcmdlist->command); } + else + { + if (buf.cursize + 2+strlen(clientcmdlist->command) <= buf.maxsize) + { + MSG_WriteByte (&buf, clc_stringcmd); + MSG_WriteString (&buf, clientcmdlist->command); + } + } + Con_DPrintf("Sending stringcmd %s\n", clientcmdlist->command); + Z_Free(clientcmdlist); + clientcmdlist = next; } - Con_DPrintf("Sending stringcmd %s\n", clientcmdlist->command); - Z_Free(clientcmdlist); - clientcmdlist = next; } // if we're not doing clc_moves and etc, don't continue unless we wrote something previous diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index be07f3b8f..cea4c741a 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -54,6 +54,8 @@ cvar_t cl_nolerp = CVAR("cl_nolerp", "2"); cvar_t cl_nolerp_netquake = CVAR("cl_nolerp_netquake", "0"); cvar_t hud_tracking_show = CVAR("hud_tracking_show", "1"); +cvar_t cl_defaultport = CVARAF("cl_defaultport", STRINGIFY(PORT_QWSERVER), "port", 0); + cvar_t cfg_save_name = CVARF("cfg_save_name", "fte", CVAR_ARCHIVE); cvar_t cl_splitscreen = CVAR("cl_splitscreen", "0"); @@ -211,7 +213,7 @@ unsigned int cl_numstris; unsigned int cl_maxstris; double connect_time = -1; // for connection retransmits -int connect_type = 0; +int connect_defaultport = 0; int connect_tries = 0; //increased each try, every fourth trys nq connect packets. quakeparms_t host_parms; @@ -688,10 +690,12 @@ void CL_CheckForResend (void) if (adr.port == 0) { - if (connect_type) - adr.port = BigShort (26000); //assume a different port for nq - else - adr.port = BigShort (27500); + adr.port = BigShort (connect_defaultport); //assume a different port for nq + + if (!strchr(cls.servername, ':')) + { + Q_strncatz(cls.servername, va(":%u", connect_defaultport), sizeof(cls.servername)); + } } t2 = Sys_DoubleTime (); @@ -709,26 +713,41 @@ void CL_CheckForResend (void) if (connect_tries == 0) NET_EnsureRoute(cls.sockets, "conn", cls.servername, false); + Con_TPrintf (TLC_CONNECTINGTO, cls.servername); + #ifdef NQPROT - if (connect_type || ((connect_tries&3)==3)) + if (((connect_tries&3)==3) != (connect_defaultport==26000)) { sizebuf_t sb; memset(&sb, 0, sizeof(sb)); sb.data = data; sb.maxsize = sizeof(data); - Con_TPrintf (TLC_CONNECTINGTO, cls.servername); - MSG_WriteLong(&sb, LongSwap(NETFLAG_CTL | (strlen(NET_GAMENAME_NQ)+7))); MSG_WriteByte(&sb, CCREQ_CONNECT); MSG_WriteString(&sb, NET_GAMENAME_NQ); MSG_WriteByte(&sb, NET_PROTOCOL_VERSION); + + /*NQ engines have a few extra bits on the end*/ + /*proquake servers wait for us to send them a packet before anything happens, + which means it corrects for our public port if our nat uses different public ports for different remote ports + thus all nq engines claim to be proquake + */ + + MSG_WriteByte(&sb, 1); /*'mod'*/ + MSG_WriteByte(&sb, 34); /*'mod' version*/ + MSG_WriteByte(&sb, 0); /*flags*/ + MSG_WriteLong(&sb, strtoul(password.string, NULL, 0)); /*password*/ + + /*so dual-protocol servers can send a more useful reply*/ + MSG_WriteString(&sb, "getchallenge"); + + *(int*)sb.data = LongSwap(NETFLAG_CTL | sb.cursize); NET_SendPacket (NS_CLIENT, sb.cursize, sb.data, adr); } else #endif { - Con_TPrintf (TLC_CONNECTINGTO, cls.servername); sprintf (data, "%c%c%c%cgetchallenge\n", 255, 255, 255, 255); NET_SendPacket (NS_CLIENT, strlen(data), data, adr); } @@ -736,24 +755,17 @@ void CL_CheckForResend (void) connect_tries++; } -void CL_BeginServerConnect(void) +void CL_BeginServerConnect(int port) { + if (!port) + port = cl_defaultport.value; SCR_SetLoadingStage(LS_CONNECTION); connect_time = 0; - connect_type = 0; + connect_defaultport = port; connect_tries = 0; CL_CheckForResend(); } -#ifdef NQPROT -void CLNQ_BeginServerConnect(void) -{ - SCR_SetLoadingStage(LS_CONNECTION); - connect_time = 0; - connect_type = 1; - connect_tries = 0; - CL_CheckForResend(); -} -#endif + void CL_BeginServerReconnect(void) { #ifndef CLIENTONLY @@ -787,7 +799,7 @@ void CL_Connect_f (void) CL_Disconnect_f (); Q_strncpyz (cls.servername, server, sizeof(cls.servername)); - CL_BeginServerConnect(); + CL_BeginServerConnect(0); } void CL_Join_f (void) @@ -815,7 +827,7 @@ void CL_Join_f (void) Cvar_Set(&spectator, "0"); Q_strncpyz (cls.servername, server, sizeof(cls.servername)); - CL_BeginServerConnect(); + CL_BeginServerConnect(0); } void CL_Observe_f (void) @@ -843,7 +855,7 @@ void CL_Observe_f (void) Cvar_Set(&spectator, "1"); Q_strncpyz (cls.servername, server, sizeof(cls.servername)); - CL_BeginServerConnect(); + CL_BeginServerConnect(0); } #ifdef NQPROT @@ -862,7 +874,7 @@ void CLNQ_Connect_f (void) CL_Disconnect_f (); Q_strncpyz (cls.servername, server, sizeof(cls.servername)); - CLNQ_BeginServerConnect(); + CL_BeginServerConnect(26000); } #endif @@ -878,7 +890,7 @@ void CL_IRCConnect_f (void) strcpy(cls.servername, "irc://"); Q_strncpyz (cls.servername+6, server, sizeof(cls.servername)-6); - CL_BeginServerConnect(); + CL_BeginServerConnect(0); } } #endif @@ -1673,9 +1685,9 @@ void CL_SetInfo (int pnum, char *key, char *value) #endif { if (pnum) - CL_SendClientCommand(true, "%i setinfo %s %s", pnum+1, key, value); + CL_SendClientCommand(true, "%i setinfo %s \"%s\"", pnum+1, key, value); else - CL_SendClientCommand(true, "setinfo %s %s", key, value); + CL_SendClientCommand(true, "setinfo %s \"%s\"", key, value); } } } @@ -2300,6 +2312,7 @@ void CL_ConnectionlessPacket (void) cls.netchan.isnqprotocol = true; cls.protocol = CP_NETQUAKE; + cls.protocol_nq = CPNQ_ID; cls.demonum = -1; // not in the demo loop now cls.state = ca_connected; @@ -2458,15 +2471,18 @@ void CLNQ_ConnectionlessPacket(void) //this is the port that we're meant to respond to. net_from.port = htons((short)MSG_ReadLong()); + cls.protocol_nq = CPNQ_ID; if (MSG_ReadByte() == 1) //a proquake server adds a little extra info { int ver = MSG_ReadByte(); Con_Printf("ProQuake server %i.%i\n", ver/10, ver%10); + if (ver >= 34) + cls.protocol_nq = CPNQ_PROQUAKE3_4; if (MSG_ReadByte() == 1) { //its a 'pure' server. - Con_Printf("ProQuake sucks\nGo play on a decent server.\n"); + Con_Printf("pure ProQuake server\n"); return; } } @@ -2489,7 +2505,7 @@ void CLNQ_ConnectionlessPacket(void) //send a dummy packet. //this makes our local nat think we initialised the conversation. - NET_SendPacket(NS_CLIENT, 0, "", net_from); + Netchan_Transmit(&cls.netchan, 1, "\x01", 2500); return; case CCREP_REJECT: @@ -2968,6 +2984,7 @@ void CL_Init (void) Cvar_Register (&cfg_save_name, cl_controlgroup); + Cvar_Register (&cl_defaultport, cl_controlgroup); Cvar_Register (&cl_servername, cl_controlgroup); Cvar_Register (&cl_serveraddress, cl_controlgroup); Cvar_Register (&cl_demospeed, "Demo playback"); diff --git a/engine/client/cl_master.h b/engine/client/cl_master.h index 4e30480c5..09d288cc3 100644 --- a/engine/client/cl_master.h +++ b/engine/client/cl_master.h @@ -13,7 +13,7 @@ //despite not supporting nq or q2, we still load them. We just filter them. This is to make sure we properly write the listing files. enum { MT_BAD, //this would be an error - MT_MASTERHTTP, //an http/ftp based master server with NQ servers + MT_MASTERHTTPNQ, //an http/ftp based master server with NQ servers MT_MASTERHTTPQW,//an http/ftp based master server with QW servers MT_BCASTQW, //-1status MT_BCASTQ2, //-1status @@ -130,6 +130,7 @@ typedef struct master_s{ char *address; //text based address (http servers int type; int servertype; //filled in for http servers + int sends; /*needs to resend?*/ char name[1]; } master_t; @@ -164,7 +165,8 @@ int NET_CheckPollSockets(void); void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles); serverinfo_t *Master_InfoForServer (netadr_t addr); serverinfo_t *Master_InfoForNum (int num); -int Master_TotalCount(void); +unsigned int Master_TotalCount(void); +unsigned int Master_NumPolled(void); void Master_SetupSockets(void); void Master_QueryServer(serverinfo_t *server); void MasterInfo_WriteServers(void); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index bd377de2c..3c579e50d 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -2189,10 +2189,10 @@ void CL_ParseServerData (void) { int i; MSG_ReadFloat(); - cl.playernum[0] = MAX_CLIENTS - 1; - cl.playernum[1] = MAX_CLIENTS - 2; - cl.playernum[2] = MAX_CLIENTS - 3; - cl.playernum[3] = MAX_CLIENTS - 4; + cl.playernum[0] = MAX_CLIENTS; + cl.playernum[1] = MAX_CLIENTS+1; + cl.playernum[2] = MAX_CLIENTS+2; + cl.playernum[3] = MAX_CLIENTS+3; cl.spectator = true; for (i = 0; i < UPDATE_BACKUP; i++) cl.frames[i].playerstate[cl.playernum[0]].pm_type = PM_SPECTATOR; @@ -2444,7 +2444,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution. netprim.coordsize = 2; netprim.anglesize = 1; - cls.protocol_nq = 0; + cls.protocol_nq = (cls.protocol_nq==CPNQ_PROQUAKE3_4)?CPNQ_PROQUAKE3_4:CPNQ_ID; cls.z_ext = 0; if (protover == NEHD_PROTOCOL_VERSION) @@ -4430,6 +4430,7 @@ int CL_PlayerColor(player_info_t *plr, qboolean *name_coloured) // NOTE: text in rawmsg/msg is assumed destroyable and should not be used afterwards void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags) { + extern cvar_t con_separatechat; char *name = NULL; int c; qboolean name_coloured = false; @@ -4552,6 +4553,26 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags) if (CSQC_ParsePrint(fullchatmessage, PRINT_CHAT)) return; #endif + + + if (con_separatechat.ival) + { + if (!con_chat) + con_chat = Con_Create("chat", CONF_HIDDEN|CONF_NOTIFY|CONF_NOTIFY_BOTTOM); + if (con_chat) + { + Con_PrintCon(con_chat, fullchatmessage); + + if (con_separatechat.ival == 1) + { + con_main.flags |= CONF_NOTIMES; + Con_PrintCon(&con_main, fullchatmessage); + con_main.flags &= CONF_NOTIMES; + return; + } + } + } + Con_Printf("%s", fullchatmessage); } @@ -5648,7 +5669,7 @@ void CLNQ_ParseServerMessage (void) // cl.last_servermessage = realtime; CL_ClearProjectiles (); - cl.allowsendpacket = true; + cls.netchan.nqreliable_allowed = true; // // if recording demos, copy the message out diff --git a/engine/client/cl_plugin.inc b/engine/client/cl_plugin.inc index a1a8ac7ec..b7b2f78c5 100644 --- a/engine/client/cl_plugin.inc +++ b/engine/client/cl_plugin.inc @@ -405,7 +405,7 @@ qintptr_t VARGS Plug_Con_SubPrint(void *offset, quintptr_t mask, const qintptr_t con = Con_FindConsole(name); if (!con) { - con = Con_Create(name); + con = Con_Create(name, 0); Con_SetActive(con); if (currentplug->conexecutecommand) @@ -453,7 +453,7 @@ qintptr_t VARGS Plug_Con_SetActive(void *offset, quintptr_t mask, const qintptr_ return false; con = Con_FindConsole(name); if (!con) - con = Con_Create(name); + con = Con_Create(name, 0); Con_SetActive(con); return true; diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index c06df9876..dedd6deb5 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1682,8 +1682,6 @@ void SCR_SetUpToDrawConsole (void) else if (clearnotify++ < vid.numpages) { } - else - con_notifylines = 0; } /* diff --git a/engine/client/cl_ui.c b/engine/client/cl_ui.c index 109a4f4e8..658569dc9 100644 --- a/engine/client/cl_ui.c +++ b/engine/client/cl_ui.c @@ -806,11 +806,10 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con } else if (!strncmp(cmdtext, "localservers", 12)) { - MasterInfo_Begin(); + MasterInfo_Refresh(); } /* else if (!strncmp(cmdtext, "r_vidmode", 12)) { - MasterInfo_Begin(); } */ else Cbuf_AddText(cmdtext, RESTRICT_SERVER); diff --git a/engine/client/client.h b/engine/client/client.h index e14671009..926a318be 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -146,6 +146,7 @@ typedef struct player_info_s int userid; char userinfo[EXTENDED_INFO_STRING]; char teamstatus[128]; + float teamstatustime; // scoreboard information char name[MAX_SCOREBOARDNAME]; @@ -192,7 +193,7 @@ typedef struct // received from server double receivedtime; // time message was received, or -1 - player_state_t playerstate[MAX_CLIENTS]; // message received that reflects performing + player_state_t playerstate[MAX_CLIENTS+MAX_SPLITS]; // message received that reflects performing // the usercmd packet_entities_t packet_entities; qboolean invalid; // true if the packet_entities delta was invalid @@ -339,6 +340,7 @@ typedef struct enum { CPNQ_ID, + CPNQ_PROQUAKE3_4, CPNQ_FITZ666, CPNQ_DP5, CPNQ_DP6, @@ -783,8 +785,7 @@ qboolean CL_DemoBehind(void); void CL_SaveInfo(vfsfile_t *f); void CL_SetInfo (int pnum, char *key, char *value); -void CL_BeginServerConnect(void); -void CLNQ_BeginServerConnect(void); +void CL_BeginServerConnect(int port); char *CL_TryingToConnect(void); #define MAX_VISEDICTS 1024 diff --git a/engine/client/console.c b/engine/client/console.c index fc66248b7..ebc3eb167 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -22,7 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" console_t con_main; -console_t *con_current; // point to either con_main +console_t *con_current; // points to whatever is the visible console +console_t *con_chat; // points to a chat console #define Font_ScreenWidth() (vid.pixelwidth) @@ -59,13 +60,11 @@ cvar_t con_centernotify = SCVAR("con_centernotify", "0"); cvar_t con_displaypossibilities = SCVAR("con_displaypossibilities", "1"); cvar_t con_maxlines = SCVAR("con_maxlines", "1024"); cvar_t cl_chatmode = SCVAR("cl_chatmode", "2"); +cvar_t con_numnotifylines_chat = CVAR("con_numnotifylines_chat", "8"); +cvar_t con_notifytime_chat = CVAR("con_notifytime_chat", "8"); +cvar_t con_separatechat = CVAR("con_separatechat", "0"); #define NUM_CON_TIMES 24 -float con_times[NUM_CON_TIMES]; // realtime time the line was generated - // for transparent notify lines - -//int con_vislines; -int con_notifylines; // scan lines to clear for notify lines #define MAXCMDLINE 256 extern unsigned char key_lines[32][MAXCMDLINE]; @@ -114,7 +113,10 @@ void Con_Destroy (console_t *con) selendline = NULL; if (con == &con_main) + { + Con_Finit(con); return; + } for (prev = &con_main; prev->next; prev = prev->next) { @@ -142,12 +144,13 @@ console_t *Con_FindConsole(char *name) return NULL; } /*creates a potentially duplicate console_t - please use Con_FindConsole first, as its confusing otherwise*/ -console_t *Con_Create(char *name) +console_t *Con_Create(char *name, unsigned int flags) { console_t *con; con = Z_Malloc(sizeof(console_t)); Q_strncpyz(con->name, name, sizeof(con->name)); + con->flags = flags; Con_Finit(con); con->next = con_main.next; con_main.next = con; @@ -325,7 +328,7 @@ void QT_Create(char *command) qt->running = true; - qt->console = Con_Create("QTerm"); + qt->console = Con_Create("QTerm", 0); qt->console->redirect = QT_KeyPress; Con_PrintCon(qt->console, "Started Process\n"); Con_SetVisible(qt->console); @@ -371,8 +374,6 @@ void Con_ToggleConsole_f (void) } else key_dest = key_console; - - Con_ClearNotify (); } /* @@ -391,8 +392,6 @@ void Con_ToggleChat_f (void) } else key_dest = key_console; - - Con_ClearNotify (); } void Con_ClearCon(console_t *con) @@ -429,7 +428,7 @@ void Cmd_ConEcho_f(void) console_t *con; con = Con_FindConsole(Cmd_Argv(1)); if (!con) - con = Con_Create(Cmd_Argv(1)); + con = Con_Create(Cmd_Argv(1), 0); if (con) { Cmd_ShiftArgs(1, false); @@ -460,20 +459,6 @@ void Cmd_ConActivate_f(void) Con_SetActive(con); } -/* -================ -Con_ClearNotify -================ -*/ -void Con_ClearNotify (void) -{ - int i; - - for (i=0 ; ilinecount--; } con->linecount++; - if (con == &con_main) - con_times[con->linesprinted++%NUM_CON_TIMES] = realtime; + if (con->flags & CONF_NOTIMES) + con->current->time = 0; + else + con->current->time = realtime; con->current->newer = Z_Malloc(sizeof(conline_t)); con->current->newer->older = con->current; con->current = con->current->newer; @@ -652,9 +642,16 @@ void Con_Print (char *txt) void Con_CycleConsole(void) { - con_current = con_current->next; - if (!con_current) - con_current = &con_main; + while(1) + { + con_current = con_current->next; + if (!con_current) + con_current = &con_main; + + if (con_current->flags & CONF_HIDDEN) + continue; + break; + } } void Con_Log(char *s); @@ -915,43 +912,44 @@ Con_DrawNotify Draws the last few lines of output transparently over the game top ================ */ -void Con_DrawNotify (void) +void Con_DrawNotifyOne (console_t *con) { conchar_t *starts[NUM_CON_TIMES], *ends[NUM_CON_TIMES]; conchar_t *c; conline_t *l; - console_t *con = &con_main; - int lines=NUM_CON_TIMES; + int lines=con->notif_l; int line; - int x = 0, y = 0; - unsigned int cn = con->linesprinted+NUM_CON_TIMES; + int x = con->notif_x, y = con->notif_y; + int w = con->notif_w; int maxlines; float t; Font_BeginString(font_conchar, x, y, &x, &y); + Font_Transform(con->notif_w, 0, &w, NULL); - maxlines = con_numnotifylines.value; - if (maxlines < 0) - maxlines = 0; - if (maxlines > NUM_CON_TIMES) - maxlines = NUM_CON_TIMES; + if (con->notif_l < 0) + con->notif_l = 0; + if (con->notif_l > NUM_CON_TIMES) + con->notif_l = NUM_CON_TIMES; + lines = maxlines = con->notif_l; - y = Con_DrawProgress(0, Font_ScreenWidth(), 0); + if (x == 0 && y == 0 && con->notif_w == vid.width) + y = Con_DrawProgress(0, w, 0); l = con->current; if (!l->length) l = l->older; - for (; l && cn > con->linesprinted && lines > NUM_CON_TIMES-maxlines; l = l->older) + for (; l && lines > con->notif_l-maxlines; l = l->older) { - t = con_times[--cn % NUM_CON_TIMES]; + t = l->time; if (!t) - break; //cleared + continue; //hidden from notify t = realtime - t; - if (t > con_notifytime.value) + if (t > con->notif_t) break; - line = Font_LineBreaks((conchar_t*)(l+1), (conchar_t*)(l+1)+l->length, Font_ScreenWidth(), lines, starts, ends); + line = Font_LineBreaks((conchar_t*)(l+1), (conchar_t*)(l+1)+l->length, w, lines, starts, ends); if (!line && lines > 0) { lines--; @@ -967,10 +965,16 @@ void Con_DrawNotify (void) if (lines == 0) break; } + //clamp it properly - while (lines < NUM_CON_TIMES-maxlines) + while (lines < con->notif_l-maxlines) + { lines++; - while (lines < NUM_CON_TIMES) + } + if (con->flags & CONF_NOTIFY_BOTTOM) + y -= (con->notif_l - lines) * Font_CharHeight(); + + while (lines < con->notif_l) { x = 0; if (con_centernotify.value) @@ -979,7 +983,7 @@ void Con_DrawNotify (void) { x += Font_CharWidth(*c); } - x = (vid.width - x) / 2; + x = (w - x) / 2; } Font_LineDraw(x, y, starts[lines], ends[lines]); @@ -988,14 +992,43 @@ void Con_DrawNotify (void) lines++; } + Font_EndString(font_conchar); +} + +void Con_DrawNotify (void) +{ + console_t *con; + + con_main.flags = CONF_NOTIFY; + /*keep the main console up to date*/ + con_main.notif_l = con_numnotifylines.ival; + con_main.notif_w = vid.width; + con_main.notif_t = con_notifytime.value; + + if (con_chat) + { + con_chat->notif_l = con_numnotifylines_chat.ival; + con_chat->notif_w = vid.width - 64; + con_chat->notif_y = vid.height - sb_lines - 8*4; + con_chat->notif_t = con_notifytime_chat.value; + } + + for (con = &con_main; con; con = con->next) + { + if (con->flags & CONF_NOTIFY) + Con_DrawNotifyOne(con); + } if (key_dest == key_message) { + int x, y; conchar_t *starts[8]; conchar_t *ends[8]; conchar_t markup[MAXCMDLINE+64]; conchar_t *c; int lines, i; + Font_BeginString(font_conchar, 0, 0, &x, &y); + y = con_main.notif_l * Font_CharHeight(); c = COM_ParseFunString(CON_WHITEMASK, va(chat_team?"say_team: %s":"say: %s", chat_buffer), markup, sizeof(markup), true); *c++ = (0xe00a+((int)(realtime*con_cursorspeed)&1))|CON_WHITEMASK; lines = Font_LineBreaks(markup, c, Font_ScreenWidth(), 8, starts, ends); @@ -1005,12 +1038,8 @@ void Con_DrawNotify (void) Font_LineDraw(x, y, starts[i], ends[i]); y += Font_CharHeight(); } + Font_EndString(font_conchar); } - - if (y > con_notifylines) - con_notifylines = y; - - Font_EndString(font_conchar); } //send all the stuff that was con_printed to sys_print. @@ -1179,11 +1208,21 @@ int Con_DrawAlternateConsoles(int lines) { char *txt; int x, y = 0; - if (lines == scr_conlines && con_main.next) + int consshown = 0; + console_t *con = &con_main; + + for (con = &con_main; con; con = con->next) + { + if (!(con->flags & CONF_HIDDEN)) + consshown++; + } + + if (lines == scr_conlines && consshown > 1) { - console_t *con = con_current; for (x = 0, con = &con_main; con; con = con->next) { + if (con->flags & CONF_HIDDEN) + continue; if (con == &con_main) txt = "MAIN"; else diff --git a/engine/client/keys.c b/engine/client/keys.c index 6ec75218a..e0e8edc1a 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -464,8 +464,8 @@ void Key_Console (unsigned int unicode, int key) extern cvar_t vid_conwidth, vid_conheight; extern int mousecursor_x, mousecursor_y; int xpos, ypos; - xpos = (int)((mousecursor_x*vid_conwidth.value)/(vid.width*8)); - ypos = (int)((mousecursor_y*vid_conheight.value)/(vid.height*8)); + xpos = (int)((mousecursor_x*vid.width)/(vid.pixelwidth*8)); + ypos = (int)((mousecursor_y*vid.height)/(vid.pixelheight*8)); con_mousedown[0] = mousecursor_x; con_mousedown[1] = mousecursor_y; if (ypos == 0 && con_main.next) @@ -638,6 +638,8 @@ void Key_Console (unsigned int unicode, int key) int i = 2; if (keydown[K_CTRL]) i = 8; + if (!con_current->display) + return; if (con_current->display == con_current->current) i+=2; //skip over the blank input line, and extra so we actually move despite the addition of the ^^^^^ line while (i-->0) @@ -653,6 +655,8 @@ void Key_Console (unsigned int unicode, int key) int i = 2; if (keydown[K_CTRL]) i = 8; + if (!con_current->display) + return; while (i-->0) { if (con_current->display->newer == NULL) diff --git a/engine/client/m_master.c b/engine/client/m_master.c index 9d68a7fb3..5c9e834c9 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -505,7 +505,7 @@ void M_DrawSources (void) switch (mast->type) { - case MT_MASTERHTTP: + case MT_MASTERHTTPNQ: case MT_MASTERHTTPQW: clr = COLOR_YELLOW; break; @@ -808,7 +808,7 @@ void M_SListKey(int key) SListOptionChanged(M_FindCurrentServer()); //go for these early. } else if (key == 'r') - MasterInfo_Begin(); + MasterInfo_Refresh(); else if (key == K_SPACE) { if (slist_type == SLISTTYPE_SERVERS || slist_type == SLISTTYPE_FAVORITES) @@ -902,6 +902,8 @@ typedef struct { qboolean stillpolling; qbyte filter[8]; + char refreshtext[64]; + qboolean sliderpressed; menupicture_t *mappic; @@ -1180,6 +1182,7 @@ void SL_PreDraw (menu_t *menu) CL_QueryServers(); + snprintf(info->refreshtext, sizeof(info->refreshtext), "Refresh - %u of %u\n", Master_NumPolled(), Master_TotalCount()); info->numslots = Master_NumSorted(); } qboolean SL_Key (int key, menu_t *menu) @@ -1419,7 +1422,7 @@ void SL_Remove (menu_t *menu) qboolean SL_DoRefresh (menuoption_t *opt, menu_t *menu, int key) { - MasterInfo_Begin(); + MasterInfo_Refresh(); return true; } @@ -1439,8 +1442,6 @@ void M_Menu_ServerList2_f(void) key_dest = key_menu; m_state = m_complex; - MasterInfo_Begin(); - menu = M_CreateMenu(sizeof(serverlist_t)); menu->event = SL_PreDraw; menu->key = SL_Key; @@ -1488,6 +1489,8 @@ void M_Menu_ServerList2_f(void) } } + strcpy(info->refreshtext, "Refresh"); + MC_AddCheckBox(menu, 0, vid.height - 64+8*1, "Ping ", &sb_showping, 1); MC_AddCheckBox(menu, 0, vid.height - 64+8*2, "Address ", &sb_showaddress, 1); MC_AddCheckBox(menu, 0, vid.height - 64+8*3, "Map ", &sb_showmap, 1); @@ -1504,7 +1507,7 @@ void M_Menu_ServerList2_f(void) MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*6, "Hide Empty", SL_ReFilter, 6); MC_AddCheckBoxFunc(menu, 128, vid.height - 64+8*7, "Hide Full ", SL_ReFilter, 7); - MC_AddCommand(menu, 64, 0, "Refresh", SL_DoRefresh); + MC_AddCommand(menu, 64, 0, info->refreshtext, SL_DoRefresh); info->filter[1] = !sb_hidenetquake.value; info->filter[2] = !sb_hidequakeworld.value; @@ -1518,6 +1521,8 @@ void M_Menu_ServerList2_f(void) CalcFilters(menu); Master_SetSortField(SLKEY_PING, true); + + MasterInfo_Refresh(); } float quickconnecttimeout; @@ -1567,7 +1572,7 @@ void M_QuickConnect_PreDraw(menu_t *menu) } //retry - MasterInfo_Begin(); + MasterInfo_Refresh(); quickconnecttimeout = Sys_DoubleTime() + 5; } @@ -1600,7 +1605,7 @@ void M_QuickConnect_f(void) key_dest = key_menu; m_state = m_complex; - MasterInfo_Begin(); + MasterInfo_Refresh(); quickconnecttimeout = Sys_DoubleTime() + 5; diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index af3dcef72..6b6770ffe 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -1721,7 +1721,6 @@ qboolean Media_PlayFilm(char *name) CDAudio_Stop(); SCR_EndLoadingPlaque(); - Con_ClearNotify(); if (key_dest == key_menu) { key_dest = key_game; diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index 5100731c9..ce6e27464 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -450,7 +450,7 @@ void M_Menu_ServerList_f (void) key_dest = key_menu; m_state = m_slist; - MasterInfo_Begin(); + MasterInfo_Refresh(); } #endif diff --git a/engine/client/menu.h b/engine/client/menu.h index cd64b453d..61aacd039 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -415,7 +415,7 @@ void M_Search_Key (int key); void M_ServerList_Key (int key); void M_Media_Key (int key); -void MasterInfo_Begin(void); +void MasterInfo_Refresh(void); void M_DrawServers(void); void M_SListKey(int key); diff --git a/engine/client/net_master.c b/engine/client/net_master.c index b6b7247b1..1085293fe 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -423,7 +423,8 @@ void Master_SortServers(void) Master_ResortServer(server); } - nextsort = Sys_DoubleTime() + 8; + if (nextsort < Sys_DoubleTime()) + nextsort = Sys_DoubleTime() + 8; } serverinfo_t *Master_SortedServer(int idx) @@ -446,7 +447,6 @@ int Master_NumSorted(void) } - float Master_ReadKeyFloat(serverinfo_t *server, int keynum) { if (!server) @@ -714,8 +714,8 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth) servertype = MT_MASTERQ2; else if (!strcmp(com_token, "master:q3")) servertype = MT_MASTERQ3; - else if (!strcmp(com_token, "master:http")) - servertype = MT_MASTERHTTP; + else if (!strcmp(com_token, "master:httpnq")) + servertype = MT_MASTERHTTPNQ; else if (!strcmp(com_token, "master:httpqw")) servertype = MT_MASTERHTTPQW; else if (!strcmp(com_token, "master")) //any other sort of master, assume it's a qw master. @@ -776,7 +776,7 @@ qboolean Master_LoadMasterList (char *filename, int defaulttype, int depth) { switch (servertype) { - case MT_MASTERHTTP: + case MT_MASTERHTTPNQ: case MT_MASTERHTTPQW: Master_AddMasterHTTP(line, servertype, name); break; @@ -1020,7 +1020,8 @@ int NET_CheckPollSockets(void) if (MSG_ReadByte() != CCREP_SERVER_INFO) continue; - NET_StringToAdr(MSG_ReadString(), &net_from); + /*this is an address string sent from the server. its not usable. if its replying to serverinfos, its possible to send it connect requests, while the address that it claims is 50% bugged*/ + MSG_ReadString(); Q_strncpyz(name, MSG_ReadString(), sizeof(name)); Q_strncpyz(map, MSG_ReadString(), sizeof(map)); @@ -1166,6 +1167,10 @@ void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles) //static int mastersequence; // warning: unused variable âmastersequenceâ if (!mast) return; + + if (mast->sends) + mast->sends--; + switch(mast->type) { #ifdef Q3CLIENT @@ -1229,7 +1234,7 @@ void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles) break; #endif #ifdef WEBCLIENT - case MT_MASTERHTTP: + case MT_MASTERHTTPNQ: HTTP_CL_Get(mast->address, NULL, MasterInfo_ProcessHTTPNQ); break; case MT_MASTERHTTPQW: @@ -1271,8 +1276,8 @@ void MasterInfo_WriteServers(void) case MT_MASTERDP: typename = "master:dp"; break; - case MT_MASTERHTTP: - typename = "master:http"; + case MT_MASTERHTTPNQ: + typename = "master:httpnq"; break; case MT_MASTERHTTPQW: typename = "master:httpqw"; @@ -1345,7 +1350,7 @@ void MasterInfo_WriteServers(void) } //poll master servers for server lists. -void MasterInfo_Begin(void) +void MasterInfo_Refresh(void) { master_t *mast; if (!Master_LoadMasterList("masters.txt", MT_MASTERQW, 5)) @@ -1378,7 +1383,7 @@ void MasterInfo_Begin(void) // if (q1servers) //nq master servers { - Master_AddMasterHTTP("http://www.gameaholic.com/servers/qspy-quake", MT_MASTERHTTP, "gameaholic's NQ master"); + Master_AddMasterHTTP("http://www.gameaholic.com/servers/qspy-quake", MT_MASTERHTTPNQ, "gameaholic's NQ master"); Master_AddMaster("255.255.255.255:26000", MT_BCASTNQ, "Nearby Quake1 servers"); Master_AddMaster("ghdigital.com:27950", MT_MASTERDP, "DarkPlaces Master 1"); @@ -1407,8 +1412,11 @@ void MasterInfo_Begin(void) for (mast = master; mast; mast=mast->next) { - MasterInfo_Request(mast, false); + mast->sends = 1; } + + Master_SortServers(); + nextsort = Sys_DoubleTime() + 2; } void Master_QueryServer(serverinfo_t *server) @@ -1446,6 +1454,7 @@ void CL_QueryServers(void) static int poll; int op; serverinfo_t *server; + master_t *mast; extern cvar_t sb_hidequake2; extern cvar_t sb_hidequake3; @@ -1454,6 +1463,46 @@ void CL_QueryServers(void) op = poll; + for (mast = master; mast; mast=mast->next) + { + switch (mast->type) + { + case MT_BAD: + continue; + case MT_MASTERHTTPNQ: + case MT_BCASTNQ: + case MT_SINGLENQ: + case MT_BCASTDP: + case MT_SINGLEDP: + case MT_MASTERDP: + if (sb_hidenetquake.value) + continue; + break; + case MT_MASTERHTTPQW: + case MT_BCASTQW: + case MT_SINGLEQW: + case MT_MASTERQW: + if (sb_hidequakeworld.value) + continue; + break; + case MT_BCASTQ2: + case MT_SINGLEQ2: + case MT_MASTERQ2: + if (sb_hidequake2.value) + continue; + break; + case MT_BCASTQ3: + case MT_MASTERQ3: + case MT_SINGLEQ3: + if (sb_hidequake3.value) + continue; + break; + } + + if (mast->sends > 0) + MasterInfo_Request(mast, false); + } + for (server = firstserver; op>0 && server; server=server->next, op--); @@ -1510,9 +1559,9 @@ void CL_QueryServers(void) poll = 0; } -int Master_TotalCount(void) +unsigned int Master_TotalCount(void) { - int count=0; + unsigned int count=0; serverinfo_t *info; for (info = firstserver; info; info = info->next) @@ -1522,6 +1571,19 @@ int Master_TotalCount(void) return count; } +unsigned int Master_NumPolled(void) +{ + unsigned int count=0; + serverinfo_t *info; + + for (info = firstserver; info; info = info->next) + { + if (info->maxplayers) + count++; + } + return count; +} + //true if server is on a different master's list. serverinfo_t *Master_InfoForServer (netadr_t addr) { diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 4b3188234..badfaa45d 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -16,9 +16,7 @@ #ifdef CSQC_DAT -#ifdef GLQUAKE #include "glquake.h" //evil to include this -#endif #include "shader.h" //#define CHEAT_PARANOID @@ -1368,6 +1366,12 @@ static void QCBUILTIN PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s GL_Set2D (); } #endif +#ifdef D3DQUAKE + if (qrenderer == QR_DIRECT3D) + { + D3D9_Set2D (); + } +#endif vid.recalc_refdef = 1; @@ -3798,7 +3802,7 @@ static void QCBUILTIN PF_skel_set_bone (progfuncs_t *prinst, struct globalvars_s bonemat_fromqcvectors(skelobj->bonematrix+12*boneidx, matrix[0], matrix[1], matrix[2], G_VECTOR(OFS_PARM2)); } -//void(float skel, float bonenum, vector org) skel_mul_bone (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc) +//void(float skel, float bonenum, vector org [, vector fwd, vector right, vector up]) skel_mul_bone (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc) static void QCBUILTIN PF_skel_mul_bone (progfuncs_t *prinst, struct globalvars_s *pr_globals) { int skelidx = G_FLOAT(OFS_PARM0); diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index c07d47bbc..21f655213 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -1150,7 +1150,7 @@ void QCBUILTIN PF_M_sethostcachesort(progfuncs_t *prinst, struct globalvars_s *p //void refreshhostcache(void) = #620; void QCBUILTIN PF_M_refreshhostcache(progfuncs_t *prinst, struct globalvars_s *pr_globals) { - MasterInfo_Begin(); + MasterInfo_Refresh(); } //float gethostcachenumber(float fld, float hostnr) = #621; void QCBUILTIN PF_M_gethostcachenumber(progfuncs_t *prinst, struct globalvars_s *pr_globals) diff --git a/engine/client/r_2d.c b/engine/client/r_2d.c index b45e5d680..c348787d5 100644 --- a/engine/client/r_2d.c +++ b/engine/client/r_2d.c @@ -529,10 +529,10 @@ void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue) if (*var->string) conback = R_RegisterPic(var->string); - if (!conback || !conback->width) + if (!conback || conback->flags & SHADER_NOIMAGE) { conback = R_RegisterCustom("console", NULL, NULL); - if (!conback) + if (!conback || conback->flags & SHADER_NOIMAGE) { if (M_GameType() == MGT_HEXEN2) conback = R_RegisterPic("gfx/menu/conback.lmp"); diff --git a/engine/client/sbar.c b/engine/client/sbar.c index 3f9246d5b..04ddf6f9c 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -2201,6 +2201,9 @@ void Sbar_DrawTeamStatus(void) if (track == p) //nor is the person you are tracking continue; + if (cl.players[p].teamstatustime < realtime) + continue; + if (!*cl.players[p].teamstatus) //only show them if they have something. no blank lines thanks continue; if (strcmp(cl.players[p].team, cl.players[track].team)) @@ -2286,6 +2289,8 @@ qboolean Sbar_UpdateTeamStatus(player_info_t *player, char *status) outlen--; } + player->teamstatustime = realtime + 10; + *outb = '\0'; if (sbar_teamstatus.value == 2) diff --git a/engine/client/screen.h b/engine/client/screen.h index 55921a428..373e69a7e 100644 --- a/engine/client/screen.h +++ b/engine/client/screen.h @@ -103,6 +103,7 @@ struct font_s *Font_LoadFont(int height, char *fontfilename); void Font_Free(struct font_s *f); void Font_BeginString(struct font_s *font, int vx, int vy, int *px, int *py); void Font_BeginScaledString(struct font_s *font, float vx, float vy, float *px, float *py); /*avoid using*/ +void Font_Transform(int vx, int vy, int *px, int *py); int Font_CharHeight(void); int Font_CharWidth(unsigned int charcode); int Font_CharEndCoord(int x, unsigned int charcode); diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 7460f3939..9a7a223db 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -156,6 +156,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DPMMODELS //darkplaces model format (which I've never seen anyone use) #define PSKMODELS //PSK model format (ActorX stuff from UT, though not the format the game itself uses) #define HALFLIFEMODELS //halflife model support (experimental) +// #define INTERQUAKEMODELS #define HUFFNETWORK //huffman network compression //#define DOOMWADS //doom wad/sprite support diff --git a/engine/common/common.c b/engine/common/common.c index d20f08eaa..4c508ed35 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -3310,7 +3310,7 @@ void COM_Init (void) Cmd_AddCommand ("flocate", COM_Locate_f); //prints the pak or whatever where this file can be found. Cmd_AddCommand ("version", COM_Version_f); //prints the pak or whatever where this file can be found. - Cmd_AddCommand ("crashme", (void*)0); //debugging feature, makes it jump to an invalid address + Cmd_AddCommand ("crashme", (void*)1); //debugging feature, makes it jump to an invalid address COM_InitFilesystem (); diff --git a/engine/common/common.h b/engine/common/common.h index 1be3f62de..2ec41b2e8 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -33,6 +33,9 @@ typedef enum {qfalse, qtrue} qboolean;//false and true are forcivly defined. typedef enum {false, true} qboolean; #endif +#define STRINGIFY2(s) #s +#define STRINGIFY(s) STRINGIFY2(s) + #define MAX_INFO_STRING 196 //regular quakeworld. Sickening isn't it. #define EXTENDED_INFO_STRING 1024 #define MAX_SERVERINFO_STRING 1024 //standard quake has 512 here. diff --git a/engine/common/console.h b/engine/common/console.h index 972ea4251..203b3f89e 100644 --- a/engine/common/console.h +++ b/engine/common/console.h @@ -92,12 +92,23 @@ typedef struct conline_s { struct conline_s *newer; unsigned short length; unsigned short lines; + float time; } conline_t; +#define CONF_HIDDEN 1 +#define CONF_NOTIFY 2 +#define CONF_NOTIFY_BOTTOM 4 /*align the bottom*/ +#define CONF_NOTIMES 8 typedef struct console_s { char name[64]; int linecount; + unsigned int flags; + int notif_x; + int notif_y; + int notif_w; + int notif_l; + float notif_t; conline_t *oldest; conline_t *current; // line where next message will be printed int x; // offset in current line for next print @@ -115,13 +126,13 @@ typedef struct console_s extern console_t con_main; extern console_t *con_current; // point to either con_main or con_chat +extern console_t *con_chat; extern int scr_chatmode; //extern int con_totallines; extern qboolean con_initialized; extern qbyte *con_chars; -extern int con_notifylines; // scan lines to clear for notify lines void Con_DrawCharacter (int cx, int line, int num); @@ -150,7 +161,7 @@ void Con_Destroy (console_t *con); void Con_SetActive (console_t *con); qboolean Con_NameForNum(int num, char *buffer, int buffersize); console_t *Con_FindConsole(char *name); -console_t *Con_Create(char *name); +console_t *Con_Create(char *name, unsigned int flags); void Con_SetVisible (console_t *con); void Con_PrintCon (console_t *con, char *txt); diff --git a/engine/common/net.h b/engine/common/net.h index 9c4b04f35..be8f8cffb 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -116,7 +116,8 @@ typedef struct qboolean fatal_error; #ifdef NQPROT - qboolean isnqprotocol; + int isnqprotocol; + qboolean nqreliable_allowed; #endif struct netprim_s netprim; diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index cb3a8fa89..a7ea5ba82 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -367,41 +367,53 @@ int Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) send.maxsize = MAX_NQMSGLEN + PACKET_HEADER; send.cursize = 0; - if (!chan->reliable_length && chan->message.cursize) + /*unreliables flood out, but reliables are tied to server sequences*/ + if (chan->nqreliable_allowed) { - memcpy (chan->reliable_buf, chan->message_buf, chan->message.cursize); - chan->reliable_length = chan->message.cursize; - chan->reliable_start = 0; - chan->message.cursize = 0; - } - - i = chan->reliable_length - chan->reliable_start; - if (i>0) - { - MSG_WriteLong(&send, 0); - MSG_WriteLong(&send, LongSwap(chan->reliable_sequence)); - if (i > MAX_NQDATAGRAM) - i = MAX_NQDATAGRAM; - - SZ_Write (&send, chan->reliable_buf+chan->reliable_start, i); - - if (chan->reliable_start+i == chan->reliable_length) + if (!chan->reliable_length && chan->message.cursize) { - if (send.cursize + length < send.maxsize) - { //throw the unreliable packet into the same one as the reliable (but not sent reliably) - SZ_Write (&send, data, length); - length = 0; - } - - *(int*)send_buf = BigLong(NETFLAG_DATA | NETFLAG_EOM | send.cursize); + memcpy (chan->reliable_buf, chan->message_buf, chan->message.cursize); + chan->reliable_length = chan->message.cursize; + chan->reliable_start = 0; + chan->message.cursize = 0; } - else - *(int*)send_buf = BigLong(NETFLAG_DATA | send.cursize); - NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address); - Netchan_Block(chan, send.cursize, rate); - sentsize += send.cursize; - send.cursize = 0; + i = chan->reliable_length - chan->reliable_start; + if (i>0) + { + MSG_WriteLong(&send, 0); + MSG_WriteLong(&send, LongSwap(chan->reliable_sequence)); + if (i > MAX_NQDATAGRAM) + i = MAX_NQDATAGRAM; + + SZ_Write (&send, chan->reliable_buf+chan->reliable_start, i); + + if (chan->reliable_start+i == chan->reliable_length) + { + if (send.cursize + length < send.maxsize) + { //throw the unreliable packet into the same one as the reliable (but not sent reliably) + SZ_Write (&send, data, length); + length = 0; + } + + *(int*)send_buf = BigLong(NETFLAG_DATA | NETFLAG_EOM | send.cursize); + } + else + *(int*)send_buf = BigLong(NETFLAG_DATA | send.cursize); + NET_SendPacket (chan->sock, send.cursize, send.data, chan->remote_address); + + Netchan_Block(chan, send.cursize, rate); + sentsize += send.cursize; + + if (showpackets.value) + Con_Printf ("--> r s=%i a=%i(%i) %i\n" + , chan->outgoing_sequence + , chan->incoming_sequence + , chan->incoming_reliable_sequence + , send.cursize); + send.cursize = 0; + } + chan->nqreliable_allowed = false; } //send out the unreliable (if still unsent) @@ -418,6 +430,11 @@ int Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) Netchan_Block(chan, send.cursize, rate); sentsize += send.cursize; + + if (showpackets.value) + Con_Printf ("--> u s=%i %i\n" + , chan->outgoing_unreliable + , send.cursize); send.cursize = 0; } return sentsize; diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 286022678..c54c559e5 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -3278,14 +3278,12 @@ void NET_Init (void) Sys_Error ("Winsock initialization failed."); #endif } -#define STRINGIFY2(s) #s -#define STRINGIFY(s) STRINGIFY2(s) #ifndef SERVERONLY void NET_InitClient(void) { const char *port; int p; - port = STRINGIFY(PORT_CLIENT); + port = STRINGIFY(PORT_QWCLIENT); p = COM_CheckParm ("-port"); if (p && p < com_argc) @@ -3369,7 +3367,7 @@ void NET_CloseServer(void) void NET_InitServer(void) { char *port; - port = STRINGIFY(PORT_SERVER); + port = STRINGIFY(PORT_QWSERVER); if (sv_listen_nq.value || sv_listen_dp.value || sv_listen_qw.value || sv_listen_q3.value) { diff --git a/engine/common/protocol.h b/engine/common/protocol.h index e9d459bdd..8f90e289f 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -105,11 +105,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //========================================= -#define PORT_CLIENT 27001 -#define PORT_MASTER 27000 -#define PORT_SERVER 27500 -#define Q2PORT_CLIENT 27901 -#define Q2PORT_SERVER 27910 +#define PORT_NQSERVER 26000 +#define PORT_QWCLIENT 27001 +#define PORT_QWMASTER 27000 +#define PORT_QWSERVER 27500 +#define PORT_Q2CLIENT 27901 +#define PORT_Q2SERVER 27910 //========================================= @@ -131,6 +132,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define A2C_CLIENT_COMMAND 'B' // + command line #define S2M_SHUTDOWN 'C' +#define C2M_MASTER_REQUEST 'c' #define M2C_MASTER_REPLY 'd' // + \n + qw server port list //================== // note that there are some defs.qc that mirror to these numbers diff --git a/engine/d3d/d3d_backend.c b/engine/d3d/d3d_backend.c index 370b2c302..39a7044d0 100644 --- a/engine/d3d/d3d_backend.c +++ b/engine/d3d/d3d_backend.c @@ -214,128 +214,6 @@ static void BE_ApplyTMUState(unsigned int tu, unsigned int flags) } } -void D3DBE_Reset(qboolean before) -{ - int i, tmu; - if (before) - { - IDirect3DDevice9_SetVertexDeclaration(pD3DDev9, NULL); - shaderstate.curvertdecl = 0; - for (i = 0; i < 5+MAX_TMUS; i++) - IDirect3DDevice9_SetStreamSource(pD3DDev9, i, NULL, 0, 0); - IDirect3DDevice9_SetIndices(pD3DDev9, NULL); - - if (shaderstate.dynxyz_buff) - IDirect3DVertexBuffer9_Release(shaderstate.dynxyz_buff); - shaderstate.dynxyz_buff = NULL; - for (tmu = 0; tmu < MAX_TMUS; tmu++) - { - if (shaderstate.dynst_buff[tmu]) - IDirect3DVertexBuffer9_Release(shaderstate.dynst_buff[tmu]); - shaderstate.dynst_buff[tmu] = NULL; - } - if (shaderstate.dyncol_buff) - IDirect3DVertexBuffer9_Release(shaderstate.dyncol_buff); - shaderstate.dyncol_buff = NULL; - if (shaderstate.dynidx_buff) - IDirect3DIndexBuffer9_Release(shaderstate.dynidx_buff); - shaderstate.dynidx_buff = NULL; - - for (i = 0; i < D3D_VDEC_MAX; i++) - { - if (vertexdecls[i]) - IDirect3DVertexDeclaration9_Release(vertexdecls[i]); - vertexdecls[i] = NULL; - } - } - else - { - D3DVERTEXELEMENT9 decl[8], declend=D3DDECL_END(); - int elements; - - for (i = 0; i < D3D_VDEC_MAX; i++) - { - elements = 0; - decl[elements].Stream = 0; - decl[elements].Offset = 0; - decl[elements].Type = D3DDECLTYPE_FLOAT3; - decl[elements].Method = D3DDECLMETHOD_DEFAULT; - decl[elements].Usage = D3DDECLUSAGE_POSITION; - decl[elements].UsageIndex = 0; - elements++; - - if (i & D3D_VDEC_COL4B) - { - decl[elements].Stream = 1; - decl[elements].Offset = 0; - decl[elements].Type = D3DDECLTYPE_D3DCOLOR; - decl[elements].Method = D3DDECLMETHOD_DEFAULT; - decl[elements].Usage = D3DDECLUSAGE_COLOR; - decl[elements].UsageIndex = 0; - elements++; - } - -/* if (i & D3D_VDEC_NORMS) - { - decl[elements].Stream = 2; - decl[elements].Offset = 0; - decl[elements].Type = D3DDECLTYPE_FLOAT2; - decl[elements].Method = D3DDECLMETHOD_DEFAULT; - decl[elements].Usage = D3DDECLUSAGE_TEXCOORD; - decl[elements].UsageIndex = 1; - elements++; - - decl[elements].Stream = 3; - decl[elements].Offset = 0; - decl[elements].Type = D3DDECLTYPE_FLOAT2; - decl[elements].Method = D3DDECLMETHOD_DEFAULT; - decl[elements].Usage = D3DDECLUSAGE_TEXCOORD; - decl[elements].UsageIndex = 1; - elements++; - - decl[elements].Stream = 4; - decl[elements].Offset = 0; - decl[elements].Type = D3DDECLTYPE_FLOAT2; - decl[elements].Method = D3DDECLMETHOD_DEFAULT; - decl[elements].Usage = D3DDECLUSAGE_TEXCOORD; - decl[elements].UsageIndex = 1; - elements++; - } -*/ - for (tmu = 0; tmu < MAX_TMUS; tmu++) - { - if (i & (D3D_VDEC_ST0<passes; - extern cvar_t r_polygonoffset_submodel_offset; // r_polygonoffset_submodel_factor // unused variable + extern cvar_t r_polygonoffset_submodel_factor; float pushdepth; // float pushfactor; BE_Cull(shaderstate.curshader->flags & (SHADER_CULL_FRONT | SHADER_CULL_BACK)); - pushdepth = (shaderstate.curshader->polyoffset.factor + ((shaderstate.flags & BEF_PUSHDEPTH)?r_polygonoffset_submodel_offset.value:0))/0xffff; + pushdepth = (shaderstate.curshader->polyoffset.factor + ((shaderstate.flags & BEF_PUSHDEPTH)?r_polygonoffset_submodel_factor.value:0))/0xffff; if (pushdepth != shaderstate.depthbias) { shaderstate.depthbias = pushdepth; diff --git a/engine/d3d/vid_d3d.c b/engine/d3d/vid_d3d.c index 356f3097e..078dfa7d5 100644 --- a/engine/d3d/vid_d3d.c +++ b/engine/d3d/vid_d3d.c @@ -64,6 +64,7 @@ static qboolean vid_initializing; extern qboolean scr_initialized; // ready to draw extern qboolean scr_drawloading; extern qboolean scr_con_forcedraw; +static qboolean d3d_resized; cvar_t vid_hardwaregamma; @@ -361,26 +362,10 @@ static LRESULT WINAPI D3D9_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } return 0; case WM_SIZE: - if (!vid_initializing) - { - extern cvar_t vid_conautoscale, vid_conwidth; - // force width/height to be updated - //vid.pixelwidth = window_rect.right - window_rect.left; - //vid.pixelheight = window_rect.bottom - window_rect.top; - D3DVID_UpdateWindowStatus(hWnd); - - D3DBE_Reset(true); - vid.pixelwidth = d3dpp.BackBufferWidth = window_rect.right - window_rect.left; - vid.pixelheight = d3dpp.BackBufferHeight = window_rect.bottom - window_rect.top; - resetD3D9(); - D3DBE_Reset(false); - - Cvar_ForceCallback(&vid_conautoscale); - Cvar_ForceCallback(&vid_conwidth); - } + d3d_resized = true; break; - case WM_CLOSE: + case WM_CLOSE: if (!vid_initializing) if (MessageBox (mainwindow, "Are you sure you want to quit?", "Confirm Exit", MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION) == IDYES) @@ -429,7 +414,10 @@ static void resetD3D9(void) HRESULT res; res = IDirect3DDevice9_Reset(pD3DDev9, &d3dpp); if (FAILED(res)) + { + Con_Printf("IDirect3DDevice9_Reset failed (%u)\n", res&0xffff); return; + } /*clear the screen to black as soon as we start up, so there's no lingering framebuffer state*/ @@ -829,7 +817,7 @@ static char *(D3D9_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevi c = prepad+desc.Width*desc.Height*3; p = (qbyte *)rect.pBits; - for (i=c-(3*desc.Height); i>=prepad; i-=(3*desc.Height)) + for (i=c-(3*desc.Width); i>=prepad; i-=(3*desc.Width)) { for (j=0; j + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2061,6 +2267,26 @@ PrecompiledHeaderThrough="qwsvdef.h" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -15163,6 +16753,24 @@ PreprocessorDefinitions="" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pextknown) + { + ClientReliableCheckBlock(client, sv.nqreliable_datagram.cursize); + ClientReliableWrite_SZ(client, sv.nqreliable_datagram.data, sv.nqreliable_datagram.cursize); + } if (client->state != cs_spawned) continue; // datagrams only go to spawned SZ_Write (&client->datagram @@ -2268,7 +2270,7 @@ void SV_SendClientMessages (void) c->send_message = false; if (c->nextservertimeupdate != pt && c->state != cs_zombie) { - c->send_message = true; + c->send_message = c->netchan.nqreliable_allowed = true; if (c->state == cs_connected && !c->datagram.cursize && !c->netchan.message.cursize) { diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index b819f99c5..fe829cc35 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -690,6 +690,7 @@ int main(int argc, char *argv[]) if (COM_CheckParm("-dumpstack")) { signal(SIGILL, Friendly_Crash_Handler); + signal(SIGFPE, Friendly_Crash_Handler); signal(SIGSEGV, Friendly_Crash_Handler); signal(SIGBUS, Friendly_Crash_Handler); }