From 2adb420a6d8b427e0cfc458945d00479b7f6d8ec Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 6 Apr 2009 00:34:32 +0000 Subject: [PATCH] Reworked the console/loading screen a little. The console is no longer directly shown at startup. MSVC2005 project files update for npqtv. Added vid_wndalpha to make the window transparent (only supported in GL-win32). Multiple issues with SW rendering, which I'll fix eventually. It does at least run, even if it looks ugly. Plugins are now able to read the console input. Bigfoot, feel free to tweek. Fixed up a few mismatched prototypes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3153 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_cg.c | 12 +- engine/client/cl_demo.c | 3 + engine/client/cl_ents.c | 10 +- engine/client/cl_main.c | 57 +++++-- engine/client/cl_parse.c | 168 +++++++++++-------- engine/client/cl_screen.c | 150 +++++++++++------ engine/client/cl_tent.c | 3 + engine/client/client.h | 5 + engine/client/console.c | 52 +++--- engine/client/keys.c | 8 +- engine/client/m_mp3.c | 2 +- engine/client/menu.c | 27 +-- engine/client/menu.h | 1 + engine/client/merged.h | 4 +- engine/client/pr_csqc.c | 8 +- engine/client/quakedef.h | 3 + engine/client/renderer.c | 8 +- engine/client/screen.h | 10 ++ engine/client/skin.c | 7 +- engine/client/snd_dma.c | 2 +- engine/client/sound.h | 7 +- engine/client/sys_npqtv.c | 113 ++++++++----- engine/client/sys_win.c | 4 +- engine/client/winquake.h | 4 +- engine/common/bothdefs.h | 6 + engine/common/common.h | 3 +- engine/common/fs.c | 2 +- engine/common/fs_zip.c | 4 - engine/common/plugin.c | 47 +++++- engine/common/pr_bgcmd.c | 19 ++- engine/dotnet2005/ftequake.sln | 44 +++++ engine/dotnet2005/ftequake.vcproj | 267 +++++++++++++++++++++++++++++- engine/ftequake/ftequake.dsp | 206 ++--------------------- engine/ftequake/ftequake.dsw | 17 +- engine/ftequake/npplug.rc | 2 +- engine/gl/gl_draw.c | 19 ++- engine/gl/gl_draw.h | 2 +- engine/gl/gl_screen.c | 34 +++- engine/gl/gl_vidnt.c | 166 +++++++++++++++---- engine/qclib/initlib.c | 33 ++++ engine/server/savegame.c | 2 +- engine/server/server.h | 5 +- engine/server/sv_init.c | 2 +- engine/server/sv_user.c | 74 +++++---- engine/server/world.c | 2 +- 45 files changed, 1091 insertions(+), 533 deletions(-) diff --git a/engine/client/cl_cg.c b/engine/client/cl_cg.c index 7c7007eca..01b27ff22 100644 --- a/engine/client/cl_cg.c +++ b/engine/client/cl_cg.c @@ -856,17 +856,7 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int * case CG_S_RESPATIALIZE://void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater ); { float *org = VM_POINTER(arg[1]); - float *axis = VM_POINTER(arg[2]); -/* -vec3_t listener_origin; -vec3_t listener_forward; -vec3_t listener_right; -vec3_t listener_up; -*/ - VectorCopy(org, listener_origin); - VectorCopy(axis+0, listener_forward); - VectorCopy(axis+3, listener_right); - VectorCopy(axis+6, listener_up); + vec3_t *axis = VM_POINTER(arg[2]); S_UpdateListener(org, axis[0], axis[1], axis[2], false); } diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 1aa2b4087..a5763eab7 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -1925,6 +1925,8 @@ void CL_QTVPlay_f (void) return; } + SCR_SetLoadingStage(LS_CONNECTION); + host = connrequest; connrequest = strchrrev(connrequest, '@'); @@ -1935,6 +1937,7 @@ void CL_QTVPlay_f (void) if (!newf) { + SCR_SetLoadingStage(LS_NONE); Con_Printf("Couldn't connect to proxy\n"); return; } diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index ab817c464..57f457255 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1596,7 +1596,7 @@ void CL_LinkPacketEntities (void) autorotate = anglemod(100*servertime); #ifdef CSQC_DAT - CLCSQC_DeltaStart(); + CSQC_DeltaStart(servertime); #endif for (newpnum=0 ; newpnumnum_entities ; newpnum++) @@ -1612,7 +1612,7 @@ void CL_LinkPacketEntities (void) } #ifdef CSQC_DAT - if (CLCSQC_DeltaUpdate(state)) + if (CSQC_DeltaUpdate(state)) continue; #endif @@ -1879,7 +1879,7 @@ void CL_LinkPacketEntities (void) } } #ifdef CSQC_DAT - CLCSQC_DeltaEnd(); + CSQC_DeltaEnd(); #endif } #else @@ -2780,13 +2780,13 @@ void CL_LinkPlayers (void) if (state->messagenum != cl.validsequence) { #ifdef CSQC_DAT - CLCSQC_DeltaPlayer(j, NULL); + CSQC_DeltaPlayer(j, NULL); #endif continue; // not present this frame } #ifdef CSQC_DAT - if (CLCSQC_DeltaPlayer(j, state)) + if (CSQC_DeltaPlayer(j, state)) continue; #endif diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index c608e3c0b..6e912655b 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -542,6 +542,16 @@ void CL_SendConnectPacket ( CL_RegisterSplitCommands(); } +char *CL_TryingToConnect(void) +{ + if (connect_time == -1) + return NULL; + if (cls.state != ca_disconnected) + return NULL; + + return cls.servername; +} + /* ================= CL_CheckForResend @@ -699,6 +709,7 @@ void CL_CheckForResend (void) void CL_BeginServerConnect(void) { + SCR_SetLoadingStage(LS_CONNECTION); connect_time = 0; connect_type = 0; connect_tries = 0; @@ -707,6 +718,7 @@ void CL_BeginServerConnect(void) #ifdef NQPROT void CLNQ_BeginServerConnect(void) { + SCR_SetLoadingStage(LS_CONNECTION); connect_time = 0; connect_type = 1; connect_tries = 0; @@ -963,7 +975,8 @@ void CL_ClearState (void) Cvar_ApplyLatches(CVAR_LATCH); } - CL_ClearTEnts (); + CL_ClearParseState(); + CL_ClearTEnts(); CL_ClearCustomTEnts(); SCR_ShowPic_Clear(); @@ -1056,6 +1069,8 @@ void CL_Disconnect (void) connect_time = -1; connect_tries = 0; + SCR_SetLoadingStage(0); + Cvar_ApplyLatches(CVAR_SERVEROVERRIDE); if (VID_SetWindowCaption) @@ -1169,6 +1184,7 @@ void CL_Disconnect (void) r_worldentity.model = NULL; cl.spectator = 0; cl.sendprespawn = false; + cl.intermission = 0; #ifdef NQPROT cls.signon=0; @@ -2256,7 +2272,7 @@ client_connect: //fixme: make function total_loading_size = 100; current_loading_size = 0; - loading_stage = 2; + SCR_SetLoadingStage(LS_CLIENT); Validation_Apply_Ruleset(); @@ -2390,7 +2406,7 @@ void CLNQ_ConnectionlessPacket(void) total_loading_size = 100; current_loading_size = 0; - loading_stage = 2; + SCR_SetLoadingStage(LS_CLIENT); allowremotecmd = false; // localid required now for remote cmds @@ -3376,19 +3392,19 @@ void Host_Frame (double time) // update audio #ifdef CSQC_DAT - if (CSQC_SettingListener()) - S_ExtraUpdate(); - else + if (!CSQC_SettingListener()) #endif - if (cls.state == ca_active) { - if (cls.protocol == CP_QUAKE3) - S_ExtraUpdate(); + if (cls.state == ca_active) + { + if (cls.protocol != CP_QUAKE3) + S_UpdateListener (r_origin, vpn, vright, vup, false); + } else - S_UpdateListener (r_origin, vpn, vright, vup, false); + S_UpdateListener (vec3_origin, vec3_origin, vec3_origin, vec3_origin, false); } - else - S_UpdateListener (vec3_origin, vec3_origin, vec3_origin, vec3_origin, false); + + S_ExtraUpdate (); CDAudio_Update(); @@ -3590,10 +3606,6 @@ void Host_Init (quakeparms_t *parms) Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to - Cmd_StuffCmds(); - - Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to - //assuming they didn't use any waits in their config (fools) //the configs should be fully loaded. @@ -3626,6 +3638,11 @@ void Host_Init (quakeparms_t *parms) if (COM_CheckParm ("-current")) Cvar_Set(Cvar_FindVar("vid_desktopsettings"), "1"); + //now exec their commandline + Cmd_StuffCmds(); + Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to + + Cvar_ApplyLatches(CVAR_RENDERERLATCH); #ifndef NPQTV @@ -3686,6 +3703,14 @@ Con_TPrintf (TL_NL); "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " "\n" "See the GNU General Public License for more details.\n"); + + if (!*cls.servername) + if (!sv.state) + { + if (qrenderer > QR_NONE) + M_ToggleMenu_f(); + //Con_ForceActiveNow(); + } } diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index bdf8c19f9..1aebf292a 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -370,7 +370,7 @@ void CL_GetDownloadSizes(unsigned int *filecount, unsigned int *totalsize, qbool *somesizesunknown = false; for(dl = cl.downloadlist; dl; dl = dl->next) { - *filecount++; + *filecount += 1; if (dl->flags & DLLF_SIZEUNKNOWN) *somesizesunknown = true; else @@ -399,7 +399,7 @@ void CL_DisenqueDownload(char *filename) } else { - for (dl = cl.downloadlist->next; dl->next; dl = dl->next) + for (dl = cl.downloadlist; dl->next; dl = dl->next) { if (!strcmp(dl->next->name, filename)) { @@ -733,8 +733,7 @@ static qboolean CL_CheckModelResources (char *name) Model_NextDownload ================= */ -void Sound_NextDownload (void); -void Model_NextDownload (void) +void Model_CheckDownloads (void) { // char *twf; char *s; @@ -743,14 +742,6 @@ void Model_NextDownload (void) // Con_TPrintf (TLC_CHECKINGMODELS); -/* if (cls.downloadnumber == 0) - { - Con_TPrintf (TLC_CHECKINGMODELS); - cls.downloadnumber = 1; - - cl.worldmodel = NULL; - } -*/ #ifdef Q2CLIENT if (cls.protocol == CP_QUAKE2) { @@ -785,22 +776,16 @@ void Model_NextDownload (void) CL_CheckOrEnqueDownloadFile(s, s, (i==1)?DLLF_REQUIRED:0); //world is required to be loaded. CL_CheckModelResources(s); } - - CL_AllowIndependantSendCmd(false); //stop it now, the indep stuff *could* require model tracing. - - Hunk_Check (); // make sure nothing is hurt - - cl.sendprespawn = true; } -int CL_LoadModels(int stage) +int CL_LoadModels(int stage, qboolean dontactuallyload) { extern model_t *loadmodel; int i; float giveuptime = Sys_DoubleTime()+0.1; //small things get padded into a single frame -#define atstage() ((cl.contentstage == stage++)?++cl.contentstage:false) +#define atstage() ((cl.contentstage == stage++ && !dontactuallyload)?++cl.contentstage:false) #define endstage() if (giveuptimenext) { if (dl->flags & DLLF_REQUIRED) @@ -1167,11 +1123,24 @@ void CL_RequestNextDownload (void) if (cl.sendprespawn) { // get next signon phase + extern int total_loading_size, current_loading_size; + + if (!cl.contentstage) + { + stage = 0; + stage = CL_LoadModels(stage, true); + stage = CL_LoadSounds(stage, true); + total_loading_size = stage; + cl.contentstage = 0; + } + stage = 0; - stage = CL_LoadModels(stage); + stage = CL_LoadModels(stage, false); + current_loading_size = cl.contentstage; if (stage < 0) return; //not yet - stage = CL_LoadSounds(stage); + stage = CL_LoadSounds(stage, false); + current_loading_size = cl.contentstage; if (stage < 0) return; @@ -1182,27 +1151,29 @@ void CL_RequestNextDownload (void) #warning timedemo timer should start here #endif + if (!cl.worldmodel || cl.worldmodel->needload) + { + Con_Printf("\n\n-------------\nCouldn't download %s - cannot fully connect\n", cl.worldmodel->name); + SCR_SetLoadingStage(LS_NONE); + return; + } #ifdef Q2CLIENT if (cls.protocol == CP_QUAKE2) { Skin_NextDownload(); + SCR_SetLoadingStage(LS_NONE); CL_SendClientCommand(true, "begin %i\n", cl.servercount); } else #endif { - if (!cl.worldmodel || cl.worldmodel->needload) - { - Con_Printf("\n\n-------------\nCouldn't download %s - cannot fully connect\n", cl.worldmodel->name); - return; - } - if (cls.demoplayback == DPB_EZTV) { if (CL_RemoveClientCommands("qtvspawn")) Con_Printf("Multiple prespawns\n"); CL_SendClientCommand(true, "qtvspawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2); + SCR_SetLoadingStage(LS_NONE); } else { @@ -1943,6 +1914,21 @@ qboolean CL_StartUploadFile(char *filename) float nextdemotime; #endif +void CL_ClearParseState(void) +{ + // done with sounds, request models now + memset (cl.model_precache, 0, sizeof(cl.model_precache)); + cl_playerindex = -1; + cl_h_playerindex = -1; + cl_spikeindex = -1; + cl_flagindex = -1; + cl_rocketindex = -1; + cl_grenadeindex = -1; + cl_gib1index = -1; + cl_gib2index = -1; + cl_gib3index = -1; +} + /* ================== CL_ParseServerData @@ -1962,6 +1948,7 @@ void CL_ParseServerData (void) // wipe the client_state_t struct // + SCR_SetLoadingStage(LS_CLIENT); SCR_BeginLoadingPlaque(); // parse protocol version number @@ -2164,6 +2151,7 @@ void CLQ2_ParseServerData (void) // // wipe the client_state_t struct // + SCR_SetLoadingStage(LS_CLIENT); SCR_BeginLoadingPlaque(); // CL_ClearState (); cls.state = ca_onserver; @@ -2264,6 +2252,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution. int protover; if (developer.value) Con_TPrintf (TLC_GOTSVDATAPACKET); + SCR_SetLoadingStage(LS_CLIENT); CL_ClearState (); Stats_NewMap(); Cvar_ForceCallback(Cvar_FindVar("r_particlesdesc")); @@ -2661,7 +2650,32 @@ void CL_ParseSoundlist (qboolean lots) return; } - Sound_NextDownload (); +#ifdef Q2CLIENT + if (cls.protocol == CP_QUAKE2) + { + CL_AllowIndependantSendCmd(false); //stop it now, the indep stuff *could* require model tracing. + + Hunk_Check (); // make sure nothing is hurt + + cl.sendprespawn = true; + } + else +#endif + { + if (cls.demoplayback == DPB_EZTV) + { + if (CL_RemoveClientCommands("qtvmodellist")) + Con_Printf("Multiple modellists\n"); + CL_SendClientCommand (true, "qtvmodellist %i 0", cl.servercount); + } + else + { + if (CL_RemoveClientCommands("modellist")) + Con_Printf("Multiple modellists\n"); +// CL_SendClientCommand ("modellist %i 0", cl.servercount); + CL_SendClientCommand (true, modellist_name, cl.servercount, 0); + } + } } /* @@ -2731,7 +2745,14 @@ void CL_ParseModellist (qboolean lots) return; } - Model_NextDownload (); + Model_CheckDownloads(); + + CL_AllowIndependantSendCmd(false); //stop it now, the indep stuff *could* require model tracing. + + Hunk_Check (); // make sure nothing is hurt + + //set the flag to load models and send prespawn + cl.sendprespawn = true; } void CL_ProcessUserInfo (int slot, player_info_t *player); @@ -2950,8 +2971,12 @@ void CL_ParseBaseline2 (void) void CLQ2_Precache_f (void) { + Model_CheckDownloads(); + Sound_CheckDownloads(); + + cl.contentstage = 0; cl.sendprespawn = true; - Sound_NextDownload(); + #ifdef VM_CG CG_Start(); #endif @@ -4424,7 +4449,8 @@ void CL_ParsePrecache(void) if (i >= 1 && i < MAX_SOUNDS) { sfx_t *sfx; - CL_CheckOrEnqueDownloadFile(va("sound/%s", s), NULL, 0); + if (S_HaveOutput()) + CL_CheckOrEnqueDownloadFile(va("sound/%s", s), NULL, 0); sfx = S_PrecacheSound (s); if (!sfx) Con_Printf("svc_precache: S_PrecacheSound(\"%s\") failed\n", s); diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 1edae68f9..6febdd899 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -25,7 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "glquake.h"//would prefer not to have this #endif - +//name of the current backdrop for the loading screen +char levelshotname[MAX_QPATH]; void RSpeedShow(void) @@ -1442,28 +1443,32 @@ SCR_DrawLoading */ int total_loading_size, current_loading_size, loading_stage; +int CL_DownloadRate(void); + +int SCR_GetLoadingStage(void) +{ + return loading_stage; +} +void SCR_SetLoadingStage(int stage) +{ + loading_stage = stage; +} -char levelshotname[MAX_QPATH]; void SCR_DrawLoading (void) { + int sizex, x, y; mpic_t *pic; + char *s; + int qdepth; + int h2depth; + int mtype = M_GameType(); + y = vid.height/2; - if (!scr_drawloading) - return; + qdepth = COM_FDepthFile("gfx/loading.lmp", true); + h2depth = COM_FDepthFile("gfx/menu/loading.lmp", true); - if (*levelshotname) - { - if(Draw_ScalePic) - Draw_ScalePic(0, 0, vid.width, vid.height, Draw_SafeCachePic (levelshotname)); - else - Draw_ConsoleBackground(vid.height); - } - else - Draw_ConsoleBackground(vid.height); - - if (COM_FDepthFile("gfx/loading.lmp", true) < COM_FDepthFile("gfx/menu/loading.lmp", true)) + if (qdepth < h2depth || h2depth > 0xffffff) { //quake files - int sizex, x, y; pic = Draw_SafeCachePic ("gfx/loading.lmp"); if (pic) @@ -1478,12 +1483,14 @@ void SCR_DrawLoading (void) { x = (vid.width/2) - 96; y = (vid.height/2) - 8; + + Draw_String((vid.width-7*8)/2, y-16, "Loading"); } - if (loading_stage) + if (loading_stage > LS_CONNECTION) { sizex = current_loading_size * 192 / total_loading_size; - if (loading_stage == 1) + if (loading_stage == LS_SERVER) { Draw_FillRGB(x, y, sizex, 16, 1.0, 0.0, 0.0); Draw_FillRGB(x+sizex, y, 192-sizex, 16, 0.0, 0.0, 0.0); @@ -1495,8 +1502,10 @@ void SCR_DrawLoading (void) } Draw_String(x+8, y+4, va("Loading %s... %i%%", - (loading_stage == 1) ? "server" : "client", + (loading_stage == LS_SERVER) ? "server" : "client", current_loading_size * 100 / total_loading_size)); + + y += 16; } } else @@ -1512,7 +1521,7 @@ void SCR_DrawLoading (void) offset = (vid.width - pic->width)/2; Draw_TransPic (offset , 0, pic); - if (loading_stage == 0) + if (loading_stage == LS_NONE) return; if (total_loading_size) @@ -1520,7 +1529,7 @@ void SCR_DrawLoading (void) else size = 0; - if (loading_stage == 1) + if (loading_stage == LS_CLIENT) count = size; else count = 106; @@ -1529,7 +1538,7 @@ void SCR_DrawLoading (void) Draw_Fill (offset+42, 87+1, count, 4, 138); Draw_Fill (offset+42, 87+5, count, 1, 136); - if (loading_stage == 2) + if (loading_stage == LS_SERVER) count = size; else count = 0; @@ -1537,11 +1546,57 @@ void SCR_DrawLoading (void) Draw_Fill (offset+42, 97, count, 1, 168); Draw_Fill (offset+42, 97+1, count, 4, 170); Draw_Fill (offset+42, 97+5, count, 1, 168); + + y = 104; } } - SCR_SetUpToDrawConsole(); - SCR_DrawConsole(!!*levelshotname); + if (cl.downloadlist || cls.downloadmethod) + { + unsigned int fcount; + unsigned int tsize; + qboolean sizeextra; + + x = vid.conwidth/2 - 160; + + CL_GetDownloadSizes(&fcount, &tsize, &sizeextra); + //downloading files? + if (cls.downloadmethod) + Draw_String(x+8, y+4, va("Downloading %s... %i%%", + cls.downloadname, + cls.downloadpercent)); + + if (tsize > 1024*1024*16) + { + Draw_String(x+8, y+8+4, va("%5ukbps %8umb%s remaining (%i files)", + (unsigned int)(CL_DownloadRate()/1000.0f), + tsize/(1024*1024), + sizeextra?"+":"", + fcount)); + } + else + { + Draw_String(x+8, y+8+4, va("%5ukbps %8ukb%s remaining (%i files)", + (unsigned int)(CL_DownloadRate()/1000.0f), + tsize/1024, + sizeextra?"+":"", + fcount)); + } + + y+= 16+8; + } + else if (CL_TryingToConnect()) + { + char dots[4]; + + s = CL_TryingToConnect(); + x = (vid.width - (strlen(s)+15)*8) / 2; + dots[0] = '.'; + dots[1] = '.'; + dots[2] = '.'; + dots[(int)realtime & 3] = 0; + Draw_String(x, y+4, va("Connecting to: %s%s", s, dots)); + } } void SCR_BeginLoadingPlaque (void) @@ -1636,7 +1691,7 @@ void SCR_SetUpToDrawConsole (void) // decide on the height of the console if (!scr_disabled_for_loading) { - if (cls.state != ca_active && !Media_PlayingFullScreen() + /*if (cls.state != ca_active && !Media_PlayingFullScreen() #ifdef TEXTEDITOR && !editoractive #endif @@ -1649,6 +1704,10 @@ void SCR_SetUpToDrawConsole (void) scr_con_current = scr_conlines; scr_con_forcedraw = true; } + else */ + scr_con_forcedraw = false; + if ((key_dest == key_console || key_dest == key_game) && !cl.sendprespawn && cl.worldmodel && cl.worldmodel->needload) + Con_ForceActiveNow(); else if (key_dest == key_console || scr_chatmode) { scr_conlines = vid.height*scr_consize.value; // half screen @@ -1662,14 +1721,14 @@ void SCR_SetUpToDrawConsole (void) if (scr_conlines < scr_con_current) { - scr_con_current -= scr_conspeed.value*host_frametime; + scr_con_current -= scr_conspeed.value*host_frametime * (vid.height/320.0f); if (scr_conlines > scr_con_current) scr_con_current = scr_conlines; } else if (scr_conlines > scr_con_current) { - scr_con_current += scr_conspeed.value*host_frametime; + scr_con_current += scr_conspeed.value*host_frametime * (vid.height/320.0f); if (scr_conlines < scr_con_current) scr_con_current = scr_conlines; } @@ -1707,8 +1766,6 @@ SCR_DrawConsole */ void SCR_DrawConsole (qboolean noback) { - if (key_dest == key_menu) - return; if (scr_con_current) { scr_copyeverything = 1; @@ -2295,9 +2352,9 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) SCR_DrawNotifyString (); scr_copyeverything = true; } - else if (scr_drawloading) + else if (scr_drawloading || loading_stage) { - SCR_DrawLoading (); + SCR_DrawLoading(); if (!nohud) { @@ -2313,20 +2370,16 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) } SCR_ShowPics_Draw(); } - else if (cl.intermission == 1 && key_dest == key_game) + else if (cl.intermission == 1) { Sbar_IntermissionOverlay (); - M_Draw (uimenu); -#ifdef MENU_DAT - MP_Draw(); -#endif } - else if (cl.intermission == 2 && key_dest == key_game) + else if (cl.intermission == 2) { Sbar_FinaleOverlay (); SCR_CheckDrawCenterString (); } - else if (cl.intermission == 3 && key_dest == key_game) + else if (cl.intermission == 3) { } else @@ -2363,16 +2416,19 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) if (qrenderer == QR_OPENGL) qglTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); #endif -#ifdef TEXTEDITOR - if (editoractive) - Editor_Draw(); -#endif - M_Draw (uimenu); -#ifdef MENU_DAT - MP_Draw(); -#endif - SCR_DrawConsole (false); } +#ifdef TEXTEDITOR + if (editoractive) + Editor_Draw(); +#endif + + SCR_DrawConsole (false); + + M_Draw (uimenu); +#ifdef MENU_DAT + MP_Draw(); +#endif + RSpeedEnd(RSPEED_2D); } diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 2ba1801d6..36463b468 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -530,6 +530,9 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n #endif } + if (!m || m->needload) + CL_CheckOrEnqueDownloadFile(m->name, NULL, 0); + // save end position for truelightning if (ent) { diff --git a/engine/client/client.h b/engine/client/client.h index 915961ffb..576204d69 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -950,6 +950,11 @@ qboolean CSQC_KeyPress(int key, qboolean down); int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation); void CSQC_ParseEntities(void); qboolean CSQC_SettingListener(void); + +qboolean CSQC_DeltaPlayer(int playernum, player_state_t *state); +void CSQC_DeltaStart(float time); +qboolean CSQC_DeltaUpdate(entity_state_t *src); +void CSQC_DeltaEnd(void); #endif // diff --git a/engine/client/console.c b/engine/client/console.c index 843eb7258..00fba48b8 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -329,11 +329,7 @@ void Con_ToggleConsole_f (void) { if (m_state) key_dest = key_menu; - else if (cls.state == ca_active || Media_PlayingFullScreen() -#ifdef VM_UI - || UI_MenuState() -#endif - ) + else key_dest = key_game; } else @@ -495,6 +491,11 @@ void Con_CheckResize (void) Con_ResizeCon (c); } +void Con_ForceActiveNow(void) +{ + key_dest = key_console; + scr_conlines = scr_con_current = vid.height; +} /* ================ @@ -910,7 +911,7 @@ void Con_DrawInput (void) int si, x; - if (key_dest != key_console && cls.state == ca_active) + if (key_dest != key_console && con_current->vislines != vid.height) return; // don't draw anything (always draw if not active) if (!con_current->linebuffered) @@ -980,7 +981,16 @@ void Con_DrawInput (void) } //that's the default compleation applied maskedtext[i] = '\0'; - maskedtext[i+1] = '\0'; //just in case + maskedtext[i+1] = '\0'; //just in case i==key_linepos + + x = 8; + y = con_current->vislines-22; + + if (i >= con_current->linewidth) //work out the start point + si = i - con_current->linewidth; + else + si = 0; + if (con_current->commandcompletion) { @@ -989,18 +999,24 @@ void Con_DrawInput (void) for (p = 1; (maskedtext[p]&255)>' '; p++) maskedtext[p] = (maskedtext[p]&255) | (COLOR_YELLOW<' '; p++) - maskedtext[p+x] = (unsigned char)fname[p] | (COLOR_GREEN<' '; p++) + maskedtext[p+cmdstart] = (unsigned char)fname[p] | (COLOR_GREEN<linewidth); #ifdef _WIN32 if (ActiveApp) @@ -1010,14 +1026,7 @@ void Con_DrawInput (void) maskedtext[key_linepos] = 11|CON_WHITEMASK; //make it blink } - if (i >= con_current->linewidth) //work out the start point - si = i - con_current->linewidth; - else - si = 0; - - y = con_current->vislines-22; - - for (i=0,p=0,x=8; x<=con_current->linewidth*8 ; p++) //draw it + for (i=0,p=0; x<=con_current->linewidth*8 ; p++) //draw it { if (!maskedtext[p]) break; @@ -1302,6 +1311,7 @@ void Con_DrawConsole (int lines, qboolean noback) unsigned char progresspercenttext[128]; char *progresstext; int progresspercent; + extern qboolean scr_con_forcedraw; #ifdef RUNTIMELIGHTING extern model_t *lightmodel; @@ -1320,7 +1330,7 @@ void Con_DrawConsole (int lines, qboolean noback) // draw the background if (!noback) - Draw_ConsoleBackground (lines); + Draw_ConsoleBackground (0, lines, scr_con_forcedraw); con_current->unseentext = false; diff --git a/engine/client/keys.c b/engine/client/keys.c index fa9afd89d..09b01e18f 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -210,6 +210,10 @@ keyname_t keynames[] = {"SEMICOLON", ';'}, // because a raw semicolon seperates commands + {"TILDE", '~'}, + {"BACKQUOTE", '`'}, + {"BACKSLASH", '\\'}, + {NULL,0} }; @@ -1378,8 +1382,6 @@ qboolean Key_MouseShouldBeFree(void) } if (key_dest == key_console) return true; - if (key_dest == key_game && cls.state < ca_connected) - return true; #ifdef VM_UI if (UI_MenuState()) @@ -1715,6 +1717,8 @@ void Key_Event (int key, qboolean down) #endif case key_game: case key_console: + if ((key >= ' ' && key <= 127) || key == K_ENTER || key == K_TAB) + key_dest = key_console; Key_Console (key); break; default: diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index b19b7dfd9..ee2b90457 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -921,7 +921,7 @@ qboolean Media_WinAvi_DecodeFrame(cin_t *cin, qboolean nosound) #ifdef SWQUAKE D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly #endif - Draw_ConsoleBackground(vid.height); + Draw_ConsoleBackground(0, vid.height, true); Draw_String(0, 0, "Video stream is corrupt\n"); } else diff --git a/engine/client/menu.c b/engine/client/menu.c index 69d323a86..8ff747c4f 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -1010,7 +1010,6 @@ void M_Draw (int uimenu) #ifdef VM_UI UI_DrawMenu(); #endif - S_ExtraUpdate (); } if (m_state != m_complex) @@ -1029,15 +1028,7 @@ void M_Draw (int uimenu) if ((!menu_script || scr_con_current) && !m_recursiveDraw) { scr_copyeverything = 1; - - if (scr_con_current) - { - Draw_ConsoleBackground (vid.height); - S_ExtraUpdate (); - } - else - Draw_FadeScreen (); - + Draw_FadeScreen (); scr_fullupdate = 0; } else @@ -1080,8 +1071,6 @@ void M_Draw (int uimenu) return; #endif } - - S_ExtraUpdate (); } @@ -1148,6 +1137,7 @@ void M_Keyup (int key) // Generic function to choose which game menu to draw int M_GameType (void) { + int cached; int q1, h2, q2; q1 = COM_FDepthFile("gfx/sp_menu.lmp", true); @@ -1155,16 +1145,13 @@ int M_GameType (void) q2 = COM_FDepthFile("pics/m_banner_game.pcx", true); if (q2 < h2 && q2 < q1) - { //AND QUAKE 2 WINS!!! - return MGT_QUAKE2; - } + cached = MGT_QUAKE2; else if (h2 < q1) - { //AND THE WINNER IS HEXEN 2!!! - return MGT_HEXEN2; - } + cached = MGT_HEXEN2; + else + cached = MGT_QUAKE1; - //QUAKE 1 WINS BY DEFAULT! - return MGT_QUAKE1; + return cached; } diff --git a/engine/client/menu.h b/engine/client/menu.h index f290d0d80..155f17960 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -393,6 +393,7 @@ void MP_RegisterCvarsAndCmds(void); void MP_Keydown(int key); void MP_Keyup(int key); +#define MGT_BAD ~0 #define MGT_QUAKE1 0 #define MGT_HEXEN2 1 #define MGT_QUAKE2 2 diff --git a/engine/client/merged.h b/engine/client/merged.h index b493bbaf2..783457ebf 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -63,7 +63,7 @@ extern void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t * extern void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); extern void (*Draw_TransPic) (int x, int y, mpic_t *pic); extern void (*Draw_TransPicTranslate) (int x, int y, int width, int height, qbyte *image, qbyte *translation); -extern void (*Draw_ConsoleBackground) (int lines); +extern void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque); extern void (*Draw_EditorBackground) (int lines); extern void (*Draw_TileClear) (int x, int y, int w, int h); extern void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c); @@ -178,7 +178,7 @@ typedef struct { void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); void (*Draw_TransPic) (int x, int y, mpic_t *pic); void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation); - void (*Draw_ConsoleBackground) (int lines); + void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque); void (*Draw_EditorBackground) (int lines); void (*Draw_TileClear) (int x, int y, int w, int h); void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c); diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 7939ebdcb..68f38f34b 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -4252,7 +4252,7 @@ float csqcdelta_time; static csqcedict_t *csqcdelta_playerents[MAX_CLIENTS]; -qboolean CLCSQC_DeltaPlayer(int playernum, player_state_t *state) +qboolean CSQC_DeltaPlayer(int playernum, player_state_t *state) { func_t func; @@ -4298,7 +4298,7 @@ qboolean CLCSQC_DeltaPlayer(int playernum, player_state_t *state) return false; } -void CLCSQC_DeltaStart(float time) +void CSQC_DeltaStart(float time) { csqcdelta_pack_t tmp; csqcdelta_time = time; @@ -4312,7 +4312,7 @@ void CLCSQC_DeltaStart(float time) csqcdelta_pack_new.readpos = 0; csqcdelta_pack_old.readpos = 0; } -qboolean CLCSQC_DeltaUpdate(entity_state_t *src) +qboolean CSQC_DeltaUpdate(entity_state_t *src) { //FTE ensures that this function is called with increasing ent numbers each time func_t func; @@ -4392,7 +4392,7 @@ qboolean CLCSQC_DeltaUpdate(entity_state_t *src) return false; } -void CLCSQC_DeltaEnd(void) +void CSQC_DeltaEnd(void) { //remove any unreferenced ents stuck on the end while (csqcdelta_pack_old.readpos < csqcdelta_pack_old.numents) diff --git a/engine/client/quakedef.h b/engine/client/quakedef.h index a9825748b..8fa1a5cd9 100644 --- a/engine/client/quakedef.h +++ b/engine/client/quakedef.h @@ -80,6 +80,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning( 4 : 4267) //truncation from const double to float + + +//#pragma warning(error:4013) #endif diff --git a/engine/client/renderer.c b/engine/client/renderer.c index f4cf3e4dd..0d3868eca 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -188,7 +188,7 @@ static cvar_t vid_fullscreen = SCVARF ("vid_fullscreen_embedded", "0", static cvar_t vid_fullscreen = SCVARF ("vid_fullscreen", "1", CVAR_ARCHIVE | CVAR_RENDERERLATCH); #endif -static cvar_t vid_height = SCVARF ("vid_height", "480", +cvar_t vid_height = SCVARF ("vid_height", "480", CVAR_ARCHIVE | CVAR_RENDERERLATCH); static cvar_t vid_multisample = SCVARF ("vid_multisample", "0", CVAR_ARCHIVE | CVAR_RENDERERLATCH); @@ -196,8 +196,9 @@ static cvar_t vid_refreshrate = SCVARF ("vid_displayfrequency", "0", CVAR_ARCHIVE | CVAR_RENDERERLATCH); static cvar_t vid_stretch = SCVARF ("vid_stretch", "1", CVAR_ARCHIVE | CVAR_RENDERERLATCH); +cvar_t vid_wndalpha = SCVAR ("vid_wndalpha", "1"); //more readable defaults to match conwidth/conheight. -static cvar_t vid_width = SCVARF ("vid_width", "640", +cvar_t vid_width = SCVARF ("vid_width", "640", CVAR_ARCHIVE | CVAR_RENDERERLATCH); extern cvar_t bul_backcol; @@ -600,6 +601,7 @@ void Renderer_Init(void) Cvar_Register (&vid_stretch, VIDCOMMANDGROUP); Cvar_Register (&_windowed_mouse, VIDCOMMANDGROUP); Cvar_Register (&vid_renderer, VIDCOMMANDGROUP); + Cvar_Register (&vid_wndalpha, VIDCOMMANDGROUP); #ifdef NPQTV Cvar_Register (&vid_fullscreen_npqtv, VIDCOMMANDGROUP); @@ -739,7 +741,7 @@ void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic); void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height); void (*Draw_TransPic) (int x, int y, mpic_t *pic); void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *image, qbyte *translation); -void (*Draw_ConsoleBackground) (int lines); +void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque); void (*Draw_EditorBackground) (int lines); void (*Draw_TileClear) (int x, int y, int w, int h); void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c); diff --git a/engine/client/screen.h b/engine/client/screen.h index 31fe4a941..04f765066 100644 --- a/engine/client/screen.h +++ b/engine/client/screen.h @@ -96,3 +96,13 @@ void Draw_TextBox (int x, int y, int width, int lines); qboolean SCR_ScreenShot (char *filename); void SCR_DrawTwoDimensional(int uimenu, qboolean nohud); + +enum +{ + LS_NONE, + LS_CONNECTION, + LS_SERVER, + LS_CLIENT, +}; +int SCR_GetLoadingStage(void); +void SCR_SetLoadingStage(int stage); \ No newline at end of file diff --git a/engine/client/skin.c b/engine/client/skin.c index bcc38d4f0..97d289968 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -cvar_t baseskin = SCVAR("baseskin", "base"); +cvar_t baseskin = SCVAR("baseskin", ""); cvar_t noskins = SCVAR("noskins", "0"); extern cvar_t cl_teamskin; @@ -537,6 +537,9 @@ void Skin_NextDownload (void) if (strchr(sc->skin->name, ' ')) //skip over skins using a space continue; + if (!*sc->skin->name) + continue; + CL_CheckOrEnqueDownloadFile(va("skins/%s.pcx", sc->skin->name), NULL, 0); } @@ -595,6 +598,8 @@ void Skin_Skins_f (void) Skin_NextDownload (); + SCR_SetLoadingStage(LS_NONE); + CL_SendClientCommand(true, "begin %i", cl.servercount); Cache_Report (); // print remaining memory } diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 6c427668c..0b3630570 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -1271,7 +1271,7 @@ void S_UpdateListener(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up, qb VectorCopy(right, listener_right); VectorCopy(up, listener_up); - if (dontmix) + if (!dontmix) { S_RunCapture(); diff --git a/engine/client/sound.h b/engine/client/sound.h index 814e5f796..04b26895c 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -114,9 +114,14 @@ void S_StartSoundDelayed(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); void S_StopSound (int entnum, int entchannel); void S_StopAllSounds(qboolean clear); -void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); +void S_UpdateListener(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up, qboolean dontmix); void S_ExtraUpdate (void); +qboolean S_HaveOutput(void); + +void S_Music_Clear(sfx_t *onlyifsample); +void S_Music_Seek(float time); + sfx_t *S_PrecacheSound (char *sample); void S_TouchSound (char *sample); void S_ClearPrecache (void); diff --git a/engine/client/sys_npqtv.c b/engine/client/sys_npqtv.c index 90f3536a7..d03a6f923 100644 --- a/engine/client/sys_npqtv.c +++ b/engine/client/sys_npqtv.c @@ -33,7 +33,9 @@ NPNetscapeFuncs *browserfuncs; #endif -extern HWND sys_hijackwindow; +extern HWND sys_parentwindow; +extern unsigned int sys_parentwidth; +extern unsigned int sys_parentheight; HINSTANCE global_hInstance; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) @@ -310,6 +312,8 @@ void LoadSplashImage(struct context *ctx, vfsfile_t *f, const char *name) free(buffer); if (image) { + if (ctx->splashdata) + free(ctx->splashdata); ctx->splashdata = malloc(width*height*4); for (y = 0; y < height; y++) { @@ -449,9 +453,9 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar free(str); } - if (sys_hijackwindow != ctx->window.window) + if (sys_parentwindow != ctx->window.window) { - if (!sys_hijackwindow) + if (!sys_parentwindow) { switch(ctx->qtvf.connectiontype) { @@ -472,13 +476,14 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar } } - sys_hijackwindow = ctx->window.window; - if (sys_hijackwindow) + sys_parentwindow = ctx->window.window; + if (sys_parentwindow) { - Cvar_SetValue(Cvar_FindVar("vid_width"), ctx->window.width); - Cvar_SetValue(Cvar_FindVar("vid_height"), ctx->window.height); + sys_parentwidth = ctx->window.width; + sys_parentheight = ctx->window.height; Cmd_ExecuteString("vid_restart", RESTRICT_LOCAL); } + } else { @@ -502,7 +507,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar { int argc; char *argv[16]; - sys_hijackwindow = NULL; + sys_parentwindow = NULL; GetModuleFileName(global_hInstance, binaryname, sizeof(binaryname)); argv[0] = binaryname; @@ -527,14 +532,14 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar argv[argc++] = "-basegame"; argv[argc++] = ctx->gamename; } + + sys_parentwidth = ctx->window.width; + sys_parentheight = ctx->window.height; ctx->contextrunning = NPQTV_Sys_Startup(argc, argv); - Cvar_SetValue(Cvar_FindVar("vid_width"), ctx->window.width); - Cvar_SetValue(Cvar_FindVar("vid_height"), ctx->window.height); - if (*ctx->datadownload) { - if (!FS_FLocateFile("default.cfg", FSLFRT_IFFOUND, NULL) || !FS_FLocateFile("gfx.wad", FSLFRT_IFFOUND, NULL)) + if (!FS_FLocateFile("default.cfg", FSLFRT_IFFOUND, NULL) && !FS_FLocateFile("gfx.wad", FSLFRT_IFFOUND, NULL)) { browserfuncs->geturlnotify(ctx->nppinstance, ctx->datadownload, NULL, &UnpackAndExtractPakFiles); ctx->waitingfordatafiles++; @@ -576,7 +581,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar EndPaint(hWnd, &paint); return TRUE; } - else if (!ctx->contextrunning) + else { HDC hdc; PAINTSTRUCT paint; @@ -585,17 +590,20 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar hdc = BeginPaint(hWnd, &paint); DrawWndBack(ctx, hWnd, hdc, &paint); SetBkMode(hdc, TRANSPARENT); - if (!activecontext) + if (!ctx->contextrunning) { - s = "Click to activate"; - TextOutA(hdc, 0, 0, s, strlen(s)); - } - if (ctx->availver) - { - s = va("Your plugin is out of date"); - TextOutA(hdc, 0, 16, s, strlen(s)); - s = va("Version %3.1f is available", ctx->availver); - TextOutA(hdc, 0, 32, s, strlen(s)); + if (!activecontext) + { + s = "Click to activate"; + TextOutA(hdc, 0, 0, s, strlen(s)); + } + if (ctx->availver) + { + s = va("Your plugin is out of date"); + TextOutA(hdc, 0, 16, s, strlen(s)); + s = va("Version %3.1f is available", ctx->availver); + TextOutA(hdc, 0, 32, s, strlen(s)); + } } EndPaint(hWnd, &paint); return TRUE; @@ -608,7 +616,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar activecontext = ctx; InvalidateRgn(hWnd, NULL, FALSE); } - else + else if (activecontext != ctx) Cbuf_AddText("quit\n", RESTRICT_LOCAL); break; default: @@ -654,7 +662,7 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, //parse out the properties for (i = 0; i < argc; i++) { - if (!stricmp(argn[i], "datadownload")) + if (!stricmp(argn[i], "dataDownload")) { Q_strncpyz(ctx->datadownload, argv[i], sizeof(ctx->datadownload)); } @@ -666,19 +674,41 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, if (!strstr(argn[i], ":")) Q_strncpyz(ctx->gamename, argv[i], sizeof(ctx->gamename)); } - else if (!stricmp(argn[i], "onstart")) + else if (!stricmp(argn[i], "connType")) + { + if (!stricmp(argn[i], "join")) + ctx->qtvf.connectiontype = QTVCT_JOIN; + else if (!stricmp(argn[i], "qtv")) + ctx->qtvf.connectiontype = QTVCT_STREAM; + else if (!stricmp(argn[i], "connect")) + ctx->qtvf.connectiontype = QTVCT_CONNECT; + else if (!stricmp(argn[i], "join")) + ctx->qtvf.connectiontype = QTVCT_JOIN; + else if (!stricmp(argn[i], "observe")) + ctx->qtvf.connectiontype = QTVCT_OBSERVE; + else + ctx->qtvf.connectiontype = QTVCT_NONE; + } + else if (!stricmp(argn[i], "server") || !stricmp(argn[i], "stream")) + Q_strncpyz(ctx->qtvf.server, argv[i], sizeof(ctx->qtvf.server)); + else if (!stricmp(argn[i], "splash")) + { + Q_strncpyz(ctx->qtvf.splashscreen, argv[i], sizeof(ctx->qtvf.splashscreen)); + browserfuncs->geturlnotify(ctx->nppinstance, ctx->qtvf.splashscreen, NULL, &SplashscreenImageDescriptor); + } + else if (!stricmp(argn[i], "onStart")) { ctx->onstart = strdup(argv[i]); } - else if (!stricmp(argn[i], "onend")) + else if (!stricmp(argn[i], "onEnd")) { ctx->onend = strdup(argv[i]); } - else if (!stricmp(argn[i], "ondemoend")) + else if (!stricmp(argn[i], "onDemoEnd")) { ctx->ondemoend = strdup(argv[i]); } - else if (!stricmp(argn[i], "availver")) + else if (!stricmp(argn[i], "availVer")) { ctx->availver = atof(argv[i]); if (ctx->availver <= NPQTV_VERSION) @@ -689,9 +719,13 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, if (atoi(argv[i]) && !activecontext) activecontext = ctx; } - } + if (!*ctx->qtvf.server) + ctx->qtvf.connectiontype = QTVCT_NONE; + else if (ctx->qtvf.connectiontype == QTVCT_NONE) + ctx->qtvf.connectiontype = QTVCT_STREAM; + //add it to the linked list ctx->next = contextlist; contextlist = ctx; @@ -738,7 +772,7 @@ NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save) if (ctx == activecontext) { activecontext = NULL; - sys_hijackwindow = NULL; + sys_parentwindow = NULL; } free(ctx); @@ -748,6 +782,7 @@ NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save) } NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window) { + extern cvar_t vid_width; struct context *ctx = instance->pdata; #ifdef _WIN32 @@ -778,17 +813,21 @@ NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window) SetWindowLongPtr(ctx->window.window, GWL_WNDPROC, (LONG_PTR)MyPluginWndProc); SetWindowLongPtr(ctx->window.window, GWL_USERDATA, (LONG_PTR)ctx); - if (ctx->contextrunning && mainwindow && oldwindow == sys_hijackwindow) + if (ctx->contextrunning && mainwindow && oldwindow == sys_parentwindow) { - sys_hijackwindow = ctx->window.window; + sys_parentwindow = ctx->window.window; SetParent(mainwindow, ctx->window.window); - oldwindow = sys_hijackwindow; + oldwindow = sys_parentwindow; } } - if (ctx->contextrunning && mainwindow && oldwindow == sys_hijackwindow) - MoveWindow(mainwindow, 0, 0, ctx->window.width, ctx->window.height, FALSE); + if (ctx->contextrunning) + { + sys_parentwidth = ctx->window.width; + sys_parentheight = ctx->window.height; + Cvar_ForceCallback(&vid_width); + } InvalidateRgn(ctx->window.window, NULL, FALSE); #endif @@ -865,8 +904,6 @@ NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, ctx->donestreams = qstr; } - //CL_QTVPlay(pipe, false); - return NPERR_NO_ERROR; } int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream) diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 98317da5a..4d5e4371b 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -41,7 +41,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. qboolean isDedicated = false; #endif -HWND sys_hijackwindow; +HWND sys_parentwindow; +unsigned int sys_parentwidth; //valid if sys_parentwindow is set +unsigned int sys_parentheight; void Sys_CloseLibrary(dllhandle_t *lib) { diff --git a/engine/client/winquake.h b/engine/client/winquake.h index a394f3712..75f0cfe7a 100644 --- a/engine/client/winquake.h +++ b/engine/client/winquake.h @@ -62,7 +62,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HINSTANCE global_hInstance; extern int global_nCmdShow; -extern HWND sys_hijackwindow; +extern HWND sys_parentwindow; +extern unsigned int sys_parentwidth; +extern unsigned int sys_parentheight; #ifndef SERVERONLY diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 30f33a84d..00b9d6bf7 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -342,6 +342,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define VARGS #endif +#ifdef _WIN32 +#define ZEXPORT VARGS +#define ZEXPORTVA VARGS +#endif + + // !!! if this is changed, it must be changed in d_ifacea.h too !!! #define CACHE_SIZE 32 // used to align key data structures diff --git a/engine/common/common.h b/engine/common/common.h index ccef722c9..b4a5d1b98 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -336,7 +336,7 @@ typedef struct vfsfile_s { #define VFS_FLUSH(vf) do{if(vf->Flush)vf->Flush(vf);}while(0) #define VFS_PUTS(vf,s) do{const char *t=s;vf->WriteBytes(vf,t,strlen(t));}while(0) char *VFS_GETS(vfsfile_t *vf, char *buffer, int buflen); -void VFS_PRINTF(vfsfile_t *vf, char *fmt, ...); +void VARGS VFS_PRINTF(vfsfile_t *vf, char *fmt, ...); enum fs_relative{ FS_GAME, //standard search (not generally valid for save/rename/delete/etc) @@ -351,6 +351,7 @@ void FS_CreatePath(const char *pname, enum fs_relative relativeto); int FS_Rename(const char *oldf, const char *newf, enum fs_relative relativeto); //0 on success, non-0 on error int FS_Rename2(const char *oldf, const char *newf, enum fs_relative oldrelativeto, enum fs_relative newrelativeto); int FS_Remove(const char *fname, enum fs_relative relativeto); //0 on success, non-0 on error +qboolean FS_Copy(const char *source, const char *dest, enum fs_relative relativesource, enum fs_relative relativedest); qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, char *out, int outlen); //if you really need to fopen yourself qboolean FS_WriteFile (const char *filename, const void *data, int len, enum fs_relative relativeto); vfsfile_t *FS_OpenVFS(const char *filename, const char *mode, enum fs_relative relativeto); diff --git a/engine/common/fs.c b/engine/common/fs.c index 3b437752d..b0eb58ec6 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -83,7 +83,7 @@ char *VFS_GETS(vfsfile_t *vf, char *buffer, int buflen) return buffer; } -void VFS_PRINTF(vfsfile_t *vf, char *format, ...) +void VARGS VFS_PRINTF(vfsfile_t *vf, char *format, ...) { va_list argptr; char string[1024]; diff --git a/engine/common/fs_zip.c b/engine/common/fs_zip.c index 9969b05d3..f6d0c9ed5 100644 --- a/engine/common/fs_zip.c +++ b/engine/common/fs_zip.c @@ -3,10 +3,6 @@ #ifdef AVAIL_ZLIB -#ifndef ZEXPORT -#define ZEXPORT VARGS -#endif - #include #include "unzip.c" diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 00b35a637..0841377bf 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -117,6 +117,9 @@ typedef struct plugin_s { int blockcloses; + void *inputptr; + unsigned int inputbytes; + int tick; int executestring; #ifndef SERVERONLY @@ -127,6 +130,9 @@ typedef struct plugin_s { //protocol-in-a-plugin int connectionlessclientpacket; + + //called to discolour console input text if they spelt it wrongly + int spellcheckmaskedtext; #endif int svmsgfunction; int chatmsgfunction; @@ -386,6 +392,8 @@ int VARGS Plug_ExportToEngine(void *offset, unsigned int mask, const int *arg) currentplug->chatmsgfunction = functionid; else if (!strcmp(name, "CenterPrintMessage")) currentplug->centerprintfunction = functionid; + else if (!strcmp(name, "SpellCheckMaskedText")) + currentplug->spellcheckmaskedtext = functionid; #endif else return 0; @@ -1330,6 +1338,25 @@ int VARGS Plug_Net_Close(void *offset, unsigned int mask, const int *arg) return 0; } +int VARGS Plug_ReadInputBuffer(void *offset, unsigned int mask, const int *arg) +{ + void *buffer = VM_POINTER(arg[0]); + int bufferlen = VM_LONG(arg[1]); + if (bufferlen > currentplug->inputbytes) + bufferlen = currentplug->inputbytes; + memcpy(buffer, currentplug->inputptr, currentplug->inputbytes); + return bufferlen; +} +int VARGS Plug_UpdateInputBuffer(void *offset, unsigned int mask, const int *arg) +{ + void *buffer = VM_POINTER(arg[0]); + int bufferlen = VM_LONG(arg[1]); + if (bufferlen > currentplug->inputbytes) + bufferlen = currentplug->inputbytes; + memcpy(currentplug->inputptr, buffer, currentplug->inputbytes); + return bufferlen; +} + void Plug_CloseAll_f(void); void Plug_List_f(void); void Plug_Close_f(void); @@ -1437,7 +1464,8 @@ void Plug_Init(void) Plug_RegisterBuiltin("cos", Plug_cos, 0); Plug_RegisterBuiltin("atan2", Plug_atan2, 0); - Plug_RegisterBuiltin("GetPluginName", Plug_GetPluginName, 0); + Plug_RegisterBuiltin("ReadInputBuffer", Plug_ReadInputBuffer, 0); + Plug_RegisterBuiltin("UpdateInputBuffer", Plug_UpdateInputBuffer, 0); Plug_Client_Init(); @@ -1511,6 +1539,23 @@ void Plug_SubConsoleCommand(console_t *con, char *line) VM_Call(currentplug->vm, currentplug->conexecutecommand, 0); currentplug = oldplug; } + +void Plug_SpellCheckMaskedText(unsigned int *maskedstring, int maskedchars, int x, int y, int cs, int firstc, int charlimit) +{ + plugin_t *oldplug = currentplug; + for (currentplug = plugs; currentplug; currentplug = currentplug->next) + { + if (currentplug->spellcheckmaskedtext) + { + currentplug->inputptr = maskedstring; + currentplug->inputbytes = sizeof(*maskedstring)*maskedchars; + VM_Call(currentplug->vm, currentplug->spellcheckmaskedtext, x, y, cs, firstc, charlimit); + currentplug->inputptr = NULL; + currentplug->inputbytes = 0; + } + } + currentplug = oldplug; +} #endif #ifndef SERVERONLY diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index c6afa9ca8..d4b8ea367 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -1393,21 +1393,28 @@ void PF_vtos (progfuncs_t *prinst, struct globalvars_s *pr_globals) RETURN_TSTRING(pr_string_temp); } -#pragma message("this should use something more... less hacky") void PF_forgetstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) { - char *s=PR_GetStringOfs(prinst, OFS_PARM0); - s-=8; - if (((int *)s)[0] != PRSTR) + char *s=PR_RemoveProgsString(prinst, G_INT(OFS_PARM0)); + if (!s) { - Con_Printf("QC tried to free a non allocated string: "); - Con_Printf("%s\n", s+8); //two prints, so that logged prints ensure the first is written. + Con_Printf("string was not strzoned\n"); + (*prinst->pr_trace) = 1; + return; + } +// char *s=PR_GetStringOfs(prinst, OFS_PARM0); + s-=8; + if (!((int *)s)[0] != PRSTR) + { + Con_Printf("QC tried to free a non dynamic string: "); + Con_Printf("%s\n", s); //two prints, so that logged prints ensure the first is written. (*prinst->pr_trace) = 1; PR_StackTrace(prinst); return; } ((int *)s)[0] = 0xabcd1234; Z_TagFree(s); + } void PF_dupstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) //frik_file diff --git a/engine/dotnet2005/ftequake.sln b/engine/dotnet2005/ftequake.sln index 33f334808..f5fb047d0 100644 --- a/engine/dotnet2005/ftequake.sln +++ b/engine/dotnet2005/ftequake.sln @@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftequake", "ftequake.vcproj EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gas2masm", "gas2masm.vcproj", "{382E6790-D1CA-48F5-8E53-D114635EB61D}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "npqtv", "npqtv.vcproj", "{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution D3DDebug|Win32 = D3DDebug|Win32 @@ -128,6 +130,48 @@ Global {382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|Win32.Build.0 = Debug|Win32 {382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|x64.ActiveCfg = Debug|x64 {382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|x64.Build.0 = Debug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|Win32.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.Build.0 = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|Win32.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.Build.0 = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.ActiveCfg = SWDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.Build.0 = SWDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.ActiveCfg = SWDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.Build.0 = SWDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.ActiveCfg = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.Build.0 = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.ActiveCfg = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.Build.0 = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.Build.0 = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|Win32.ActiveCfg = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.Build.0 = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.ActiveCfg = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.Build.0 = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.ActiveCfg = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.Build.0 = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.Build.0 = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinSW|Win32.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinSW|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinSW|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.Build.0 = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|Win32.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|x64.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|x64.Build.0 = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.ActiveCfg = SWRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.Build.0 = SWRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.ActiveCfg = SWRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.Build.0 = SWRelease|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/engine/dotnet2005/ftequake.vcproj b/engine/dotnet2005/ftequake.vcproj index 91ace3676..e389808bc 100644 --- a/engine/dotnet2005/ftequake.vcproj +++ b/engine/dotnet2005/ftequake.vcproj @@ -6637,6 +6637,46 @@ + + + + + + + + + + + + + + + @@ -6645,10 +6685,98 @@ PrecompiledHeaderThrough="qwsvdef.h" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6657,10 +6785,98 @@ PrecompiledHeaderThrough="qwsvdef.h" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6669,6 +6885,54 @@ PrecompiledHeaderThrough="qwsvdef.h" /> + + + + + + + + + + + + + + + + + + Begin Project Dependency Project_Dep_Name gas2masm End Project Dependency + Begin Project Dependency + Project_Dep_Name spellcheck + End Project Dependency }}} ############################################################################### @@ -60,7 +63,7 @@ Package=<4> ############################################################################### -Project: "q3asm2"=..\..\Q3ASM2\q3asm2.dsp - Package Owner=<4> +Project: "q3asm2"=..\..\..\Q3ASM2\q3asm2.dsp - Package Owner=<4> Package=<5> {{{ @@ -96,6 +99,18 @@ Package=<4> ############################################################################### +Project: "spellcheck"=..\..\plugins\spellcheck\spellcheck.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Global: Package=<5> diff --git a/engine/ftequake/npplug.rc b/engine/ftequake/npplug.rc index cc98f1968..b1077aad7 100644 --- a/engine/ftequake/npplug.rc +++ b/engine/ftequake/npplug.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "windows.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index 6f1b65855..b2d97b255 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -793,6 +793,14 @@ void GLDraw_ReInit (void) lightmap_textures=NULL; filmtexture=0; glmenu_numcachepics=0; + + draw_mesh.numvertexes = 4; + draw_mesh.numindexes = 6; + draw_mesh.xyz_array = draw_mesh_xyz; + draw_mesh.st_array = draw_mesh_st; + draw_mesh.colors_array = NULL; + draw_mesh.indexes = r_quad_indexes; + #ifdef Q3SHADERS r_fogtexture=0; #endif @@ -1911,17 +1919,16 @@ Draw_ConsoleBackground ================ */ -void GLDraw_ConsoleBackground (int lines) +void GLDraw_ConsoleBackground (int firstline, int lastline, qboolean forceopaque) { // char ver[80]; // int x, i; float a; - extern qboolean scr_con_forcedraw; conback->width = vid.conwidth; conback->height = vid.conheight; - if (scr_con_forcedraw) + if (forceopaque) { a = 1; // console background is necessary } @@ -1943,7 +1950,7 @@ void GLDraw_ConsoleBackground (int lines) if (shader_console) { currententity = &r_worldentity; - GLDraw_ShaderPic(0, lines - conback->height, vid.width, vid.height, shader_console, 1, 1, 1, a); + GLDraw_ShaderPic(0, lastline - conback->height, vid.width, vid.height, shader_console, 1, 1, 1, a); qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); return; } @@ -1952,11 +1959,11 @@ void GLDraw_ConsoleBackground (int lines) if (a >= 1) { qglColor3f (1,1,1); - GLDraw_Pic(0, lines-conback->height, conback); + GLDraw_Pic(0, lastline-conback->height, conback); } else { - GLDraw_AlphaPic (0, lines - conback->height, conback, a); + GLDraw_AlphaPic (0, lastline - conback->height, conback, a); } } diff --git a/engine/gl/gl_draw.h b/engine/gl/gl_draw.h index f0f573e15..d623a1846 100644 --- a/engine/gl/gl_draw.h +++ b/engine/gl/gl_draw.h @@ -34,7 +34,7 @@ void GLDraw_Pic (int x, int y, mpic_t *pic); void GLDraw_ScalePic (int x, int y, int width, int height, mpic_t *pic); void GLDraw_TransPic (int x, int y, mpic_t *pic); void GLDraw_TransPicTranslate (int x, int y, int w, int h, qbyte *pic, qbyte *translation); -void GLDraw_ConsoleBackground (int lines); +void GLDraw_ConsoleBackground (int firstline, int lastline, qboolean forceopaque); void GLDraw_EditorBackground (int lines); void GLDraw_BeginDisc (void); void GLDraw_EndDisc (void); diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 6941948b3..e14340789 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -159,6 +159,7 @@ void GLSCR_UpdateScreen (void) extern qboolean editormodal; #endif qboolean nohud; + qboolean noworld; RSpeedMark(); if (block_drawing) @@ -249,6 +250,7 @@ void GLSCR_UpdateScreen (void) // SCR_SetUpToDrawConsole (); + noworld = false; nohud = false; #ifdef VM_CG @@ -261,10 +263,14 @@ void GLSCR_UpdateScreen (void) nohud = true; else #endif - if (r_worldentity.model && uimenu != 1) + if (uimenu != 1) { - V_RenderView (); -// Q1BSP_TestClipDecal(); + if (r_worldentity.model && cls.state == ca_active) + V_RenderView (); + else + { + noworld = true; + } } else GL_DoSwap(); @@ -273,7 +279,27 @@ void GLSCR_UpdateScreen (void) GLR_BrightenScreen(); - if (!nohud) + if (noworld) + { + extern char levelshotname[]; + + if ((key_dest == key_console || key_dest == key_game) && SCR_GetLoadingStage() == LS_NONE) + scr_con_current = vid.height; + + //draw the levelshot or the conback fullscreen + if (*levelshotname) + { + if(Draw_ScalePic) + Draw_ScalePic(0, 0, vid.width, vid.height, Draw_SafeCachePic (levelshotname)); + else + Draw_ConsoleBackground(0, vid.height, true); + } + else + Draw_ConsoleBackground(0, vid.height, true); + + nohud = true; + } + else if (!nohud) SCR_TileClear (); SCR_DrawTwoDimensional(uimenu, nohud); diff --git a/engine/gl/gl_vidnt.c b/engine/gl/gl_vidnt.c index e5407db8e..cdc2233f4 100644 --- a/engine/gl/gl_vidnt.c +++ b/engine/gl/gl_vidnt.c @@ -65,6 +65,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WM_INPUT 255 #endif +#ifndef WS_EX_LAYERED + #define WS_EX_LAYERED 0x00080000 + #define LWA_ALPHA 0x00000002 +#endif +typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); + extern cvar_t vid_conwidth, vid_conautoscale; @@ -79,6 +85,10 @@ extern cvar_t vid_conwidth, vid_conautoscale; #define BASEWIDTH 320 #define BASEHEIGHT 200 +extern cvar_t vid_width; +extern cvar_t vid_height; +extern cvar_t vid_wndalpha; + typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t; #ifdef USE_D3D @@ -143,7 +153,7 @@ LONG WINAPI GLMainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); qboolean GLAppActivate(BOOL fActive, BOOL minimize); char *VID_GetModeDescription (int mode); void ClearAllStates (void); -void VID_UpdateWindowStatus (void); +void VID_UpdateWindowStatus (HWND hWnd); void GL_Init(void *(*getglfunction) (char *name)); typedef void (APIENTRY *lp3DFXFUNC) (int, int, int, int, int, const void*); @@ -349,14 +359,26 @@ qboolean VID_SetWindowedMode (rendererstate_t *info) WindowRect.right = info->width; WindowRect.bottom = info->height; - DIBWidth = info->width; - DIBHeight = info->height; - if (sys_hijackwindow) + if (sys_parentwindow) { - SetWindowLong(sys_hijackwindow, GWL_STYLE, GetWindowLong(sys_hijackwindow, GWL_STYLE)|WS_OVERLAPPED); + SetWindowLong(sys_parentwindow, GWL_STYLE, GetWindowLong(sys_parentwindow, GWL_STYLE)|WS_OVERLAPPED); WindowStyle = WS_CHILDWINDOW|WS_OVERLAPPED; ExWindowStyle = 0; + + if (info->width > sys_parentwidth) + WindowRect.right = sys_parentwidth; + else if (info->width < sys_parentwidth) + WindowRect.left = (sys_parentwidth - info->width)/2; + + if (info->height > sys_parentheight) + WindowRect.bottom = sys_parentheight; + else if (info->height < sys_parentheight) + WindowRect.top = (sys_parentheight - info->height)/2; + + + WindowRect.right += WindowRect.left; + WindowRect.bottom += WindowRect.top; } else { @@ -367,6 +389,9 @@ qboolean VID_SetWindowedMode (rendererstate_t *info) WindowStyle |= WS_SIZEBOX | WS_MAXIMIZEBOX; } + DIBWidth = WindowRect.right - WindowRect.left; + DIBHeight = WindowRect.bottom - WindowRect.top; + rect = WindowRect; AdjustWindowRectEx(&rect, WindowStyle, FALSE, 0); @@ -382,7 +407,7 @@ qboolean VID_SetWindowedMode (rendererstate_t *info) rect.left, rect.top, wwidth, wheight, - sys_hijackwindow, + sys_parentwindow, NULL, global_hInstance, NULL); @@ -393,8 +418,30 @@ qboolean VID_SetWindowedMode (rendererstate_t *info) return false; } - if (!sys_hijackwindow) + if (!sys_parentwindow) { +#ifdef WS_EX_LAYERED + int av; + av = 255*vid_wndalpha.value; + if (av < 70) + av = 70; + if (av < 255) + { + HMODULE hm = GetModuleHandle("user32.dll"); + lpfnSetLayeredWindowAttributes pSetLayeredWindowAttributes; + pSetLayeredWindowAttributes = (void*)GetProcAddress(hm, "SetLayeredWindowAttributes"); + + if (pSetLayeredWindowAttributes) + { + // Set WS_EX_LAYERED on this window + SetWindowLong(dibwindow, GWL_EXSTYLE, GetWindowLong(dibwindow, GWL_EXSTYLE) | WS_EX_LAYERED); + + // Make this window 70% alpha + pSetLayeredWindowAttributes(dibwindow, 0, av, LWA_ALPHA); + } + } +#endif + // Center and show the DIB window CenterWindow(dibwindow, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top, false); @@ -675,7 +722,7 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette) window_width = DIBWidth; window_height = DIBHeight; - VID_UpdateWindowStatus (); + VID_UpdateWindowStatus (mainwindow); CDAudio_Resume (); scr_disabled_for_loading = temp; @@ -783,8 +830,28 @@ void VID_UnSetMode (void) VID_UpdateWindowStatus ================ */ -void VID_UpdateWindowStatus (void) +void VID_UpdateWindowStatus (HWND hWnd) { + POINT p; + RECT nr; + GetClientRect(hWnd, &nr); + + //if its bad then we're probably minimised + if (nr.right <= nr.left) + return; + if (nr.bottom <= nr.top) + return; + + WindowRect = nr; + p.x = 0; + p.y = 0; + ClientToScreen(hWnd, &p); + window_x = p.x; + window_y = p.y; + window_width = WindowRect.right - WindowRect.left; + window_height = WindowRect.bottom - WindowRect.top; + glwidth = window_width; + glheight = window_height; window_rect.left = window_x; window_rect.top = window_y; @@ -919,6 +986,62 @@ void VID_Wait_Override_Callback(struct cvar_s *var, char *oldvalue) qwglSwapIntervalEXT(_vid_wait_override.value); } +void VID_Size_Override_Callback(struct cvar_s *var, char *oldvalue) +{ + int nw = vid_width.value; + int nh = vid_height.value; + int nx = 0; + int ny = 0; + + if (sys_parentwindow && modestate==MS_WINDOWED) + { + if (nw > sys_parentwidth) + nw = sys_parentwidth; + else + nx = (sys_parentwidth - nw)/2; + if (nh > sys_parentheight) + nh = sys_parentheight; + else + ny = (sys_parentheight - nh)/2; + + MoveWindow(mainwindow, nx, ny, nw, nh, FALSE); + } +} + +void VID_WndAlpha_Override_Callback(struct cvar_s *var, char *oldvalue) +{ +#ifdef GWL_EXSTYLE + if (modestate==MS_WINDOWED) + { + int av; + HMODULE hm = GetModuleHandle("user32.dll"); + lpfnSetLayeredWindowAttributes pSetLayeredWindowAttributes; + pSetLayeredWindowAttributes = (void*)GetProcAddress(hm, "SetLayeredWindowAttributes"); + + av = 255 * var->value; + if (av < 70) + av = 70; + if (av > 255) + av = 255; + + if (pSetLayeredWindowAttributes) + { + // Set WS_EX_LAYERED on this window + + if (av < 255) + { + SetWindowLong(mainwindow, GWL_EXSTYLE, GetWindowLong(mainwindow, GWL_EXSTYLE) | WS_EX_LAYERED); + + // Make this window 70% alpha + pSetLayeredWindowAttributes(mainwindow, 0, av, LWA_ALPHA); + } + else + SetWindowLong(mainwindow, GWL_EXSTYLE, GetWindowLong(mainwindow, GWL_EXSTYLE) & ~WS_EX_LAYERED); + } + } +#endif +} + qboolean screenflush; void GL_DoSwap (void) { @@ -1358,7 +1481,6 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize) return true; } - /* main window procedure */ LONG WINAPI GLMainWndProc ( HWND hWnd, @@ -1391,19 +1513,7 @@ LONG WINAPI GLMainWndProc ( break; case WM_MOVE: - { - RECT r; -// window_x = (int) LOWORD(lParam); -// window_y = (int) HIWORD(lParam); - GetWindowRect(hWnd, &r); - window_x = r.left; - window_y = r.top; - window_width = r.right - r.left; - window_height = r.bottom - r.top; - glwidth = window_width; - glheight = window_height; - } - VID_UpdateWindowStatus (); + VID_UpdateWindowStatus (hWnd); break; case WM_KEYDOWN: @@ -1502,13 +1612,9 @@ LONG WINAPI GLMainWndProc ( case WM_SIZE: if (!vid_initializing) { - WindowRect.right = ((short*)&lParam)[0] - WindowRect.left; - WindowRect.bottom = ((short*)&lParam)[1] - WindowRect.top; - // force width/height to be updated - glwidth = WindowRect.right - WindowRect.left; - glheight = WindowRect.bottom - WindowRect.top; Cvar_ForceCallback(&vid_conautoscale); Cvar_ForceCallback(&vid_conwidth); + VID_UpdateWindowStatus (hWnd); } break; @@ -1602,6 +1708,7 @@ void GLVID_DeInit (void) ActiveApp = false; Cvar_Unhook(&_vid_wait_override); + Cvar_Unhook(&vid_wndalpha); UnregisterClass(WINDOW_CLASS_NAME, global_hInstance); } @@ -1661,6 +1768,9 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) S_Restart_f(); Cvar_Hook(&_vid_wait_override, VID_Wait_Override_Callback); + Cvar_Hook(&vid_width, VID_Size_Override_Callback); + Cvar_Hook(&vid_height, VID_Size_Override_Callback); + Cvar_Hook(&vid_wndalpha, VID_WndAlpha_Override_Callback); vid_initialized = true; vid_initializing = false; diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index b12fdeede..7ea34f8a1 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -423,6 +423,39 @@ string_t PR_StringToProgs (progfuncs_t *progfuncs, char *str) return 0; } +char *PR_RemoveProgsString (progfuncs_t *progfuncs, string_t str) +{ + char *ret; + + //input string is expected to be an allocated string + //if its a temp, or a constant, just return NULL. + if ((unsigned int)str & 0xc0000000) + { + if ((unsigned int)str & 0x80000000) + { + int i = str & ~0x80000000; + if (i >= prinst->numallocedstrings) + { + pr_trace = 1; + return NULL; + } + if (prinst->allocedstrings[i]) + { + ret = prinst->allocedstrings[i]; + prinst->allocedstrings[i] = NULL; //remove it + return ret; + } + else + { + pr_trace = 1; + return NULL; //urm, was freed... + } + } + } + pr_trace = 1; + return NULL; +} + char *PR_StringToNative (progfuncs_t *progfuncs, string_t str) { if ((unsigned int)str & 0xc0000000) diff --git a/engine/server/savegame.c b/engine/server/savegame.c index cb58433d5..b9319e015 100644 --- a/engine/server/savegame.c +++ b/engine/server/savegame.c @@ -988,7 +988,7 @@ void SV_Savegame_f (void) { VFS_PRINTF(f, "%s\n", cache->mapname); - FS_Copy(va("saves/%s.lvc", cache->mapname), va("saves/%s/%s.lvc", savename, cache->mapname), FS_GAME); + FS_Copy(va("saves/%s.lvc", cache->mapname), va("saves/%s/%s.lvc", savename, cache->mapname), FS_GAME, FS_GAME); cache = cache->next; } diff --git a/engine/server/server.h b/engine/server/server.h index f69086692..0d4b4dc1c 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -426,8 +426,8 @@ typedef struct client_s char downloadfn[MAX_QPATH]; vfsfile_t *download; // file being downloaded - int downloadsize; // total bytes - int downloadcount; // bytes sent + unsigned int downloadsize; // total bytes + unsigned int downloadcount; // bytes sent int downloadacked; //DP-specific int downloadstarted; //DP-specific @@ -1041,6 +1041,7 @@ void SV_UserInit (void); qboolean SV_TogglePause (client_t *cl); void SV_ClientThink (void); +void SV_Begin_Core(client_t *split); void VoteFlushAll(void); void SV_SetUpClientEdict (client_t *cl, edict_t *ent); diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index 641c887fd..0994a43ea 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -603,7 +603,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us #ifndef SERVERONLY total_loading_size = 100; current_loading_size = 0; - loading_stage = 1; + SCR_SetLoadingStage(LS_SERVER); // SCR_BeginLoadingPlaque(); SCR_ImageName(server); #endif diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 1eb7caa36..45249f70b 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -1742,7 +1742,7 @@ void SV_DarkPlacesDownloadAck(client_t *cl) } } -void SV_NextChunkedDownload(int chunknum, int ezpercent, int ezfilenum) +void SV_NextChunkedDownload(unsigned int chunknum, int ezpercent, int ezfilenum) { #define CHUNKSIZE 1024 char buffer[CHUNKSIZE]; @@ -1753,9 +1753,9 @@ void SV_NextChunkedDownload(int chunknum, int ezpercent, int ezfilenum) msg = &host_client->datagram; - if (chunknum < 0 || (chunknum*CHUNKSIZE > host_client->downloadsize)) + if (chunknum*CHUNKSIZE > host_client->downloadsize) { - Con_Printf ("Invalid file chunk requested %i to %i of .\n", chunknum*CHUNKSIZE, (chunknum+1)*CHUNKSIZE, host_client->downloadsize); + SV_ClientPrintf (host_client, PRINT_HIGH, "Invalid file chunk requested %u to %u of %u.\n", chunknum*CHUNKSIZE, (chunknum+1)*CHUNKSIZE, host_client->downloadsize); error = true; } @@ -1786,7 +1786,7 @@ void SV_NextChunkedDownload(int chunknum, int ezpercent, int ezfilenum) if (i > 0) { - if (msg == &msg_oob)//host_client->datagram.cursize + CHUNKSIZE+5+50 > host_client->datagram.maxsize) + if (msg == &msg_oob) { msg = &msg_oob; msg->cursize = 0; @@ -1798,7 +1798,7 @@ void SV_NextChunkedDownload(int chunknum, int ezpercent, int ezfilenum) msg->data = oobdata; MSG_WriteByte(msg, A2C_PRINT); SZ_Write(msg, "\\chunk", 6); - MSG_WriteLong(msg, ezfilenum); + MSG_WriteLong(msg, ezfilenum); //echoing the file num is used so the packets don't go out of sync. } if (i != CHUNKSIZE) @@ -1850,7 +1850,10 @@ void SV_NextDownload_f (void) #ifdef PEXT_CHUNKEDDOWNLOADS if (host_client->fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS) { - SV_NextChunkedDownload(atoi(Cmd_Argv(1)), atoi(Cmd_Argv(2)), atoi(Cmd_Argv(3))); + if (Cmd_Argc() < 2) + SV_NextChunkedDownload(atoi(Cmd_Argv(1)), atoi(Cmd_Argv(2)), atoi(Cmd_Argv(3))); + else + SV_NextChunkedDownload(atoi(Cmd_Argv(1)), atoi(Cmd_Argv(2)), atoi(Cmd_Argv(3))); return; } #endif @@ -2378,7 +2381,7 @@ void SV_StopDownload_f(void) host_client->download = NULL; } else - Con_Printf ("But you're not downloading anything\n"); + SV_ClientPrintf(host_client, PRINT_HIGH, "But you're not downloading anything\n"); host_client->downloadstarted = false; } @@ -3015,14 +3018,14 @@ void SV_SetInfo_f (void) if (Cmd_Argc() == 1) { - Con_Printf ("User info settings:\n"); + SV_ClientPrintf(host_client, PRINT_HIGH, "User info settings:\n"); Info_Print (host_client->userinfo); return; } if (Cmd_Argc() != 3) { - Con_Printf ("usage: setinfo [ ]\n"); + SV_ClientPrintf(host_client, PRINT_HIGH, "usage: setinfo [ ]\n"); return; } @@ -3114,7 +3117,9 @@ Dumps the serverinfo info string */ void SV_ShowServerinfo_f (void) { + SV_BeginRedirect(RD_CLIENT, host_client->language); Info_Print (svs.info); + SV_EndRedirect(); } void SV_NoSnap_f(void) @@ -3228,12 +3233,12 @@ void SV_Vote_f (void) if (!votelevel.value) { - Con_TPrintf(STL_NOVOTING); + SV_ClientTPrintf(host_client, PRINT_HIGH, STL_NOVOTING); return; } if (host_client->ismuted) { - Con_TPrintf(STL_MUTEDVOTE); + SV_ClientTPrintf(host_client, PRINT_HIGH, STL_MUTEDVOTE); return; } @@ -3247,7 +3252,7 @@ void SV_Vote_f (void) base = NULL; if (strchr(command, ';') || !strcmp(command, "if")) { - Con_TPrintf(STL_BADVOTE); + SV_ClientTPrintf(host_client, PRINT_HIGH, STL_BADVOTE); return; } num = Cmd_Level(command); @@ -3255,7 +3260,7 @@ void SV_Vote_f (void) *base = ' '; if (num != Cmd_ExecLevel) { - Con_TPrintf(STL_BADVOTE); + SV_ClientTPrintf(host_client, PRINT_HIGH, STL_BADVOTE); return; } @@ -3269,13 +3274,13 @@ void SV_Vote_f (void) if (VoteCount(command, id)) { VoteRemoveCommands(command, id); - Con_TPrintf(STL_OLDVOTEREMOVED); + SV_ClientTPrintf(host_client, PRINT_HIGH, STL_OLDVOTEREMOVED); return; } if (VoteCount(NULL, id)>=3) { VoteRemoveCommands(NULL, id); - Con_TPrintf(STL_VOTESREMOVED); + SV_ClientTPrintf(host_client, PRINT_HIGH, STL_VOTESREMOVED); } num = VoteCount(command, -1)+1; @@ -3312,7 +3317,7 @@ void Cmd_Notarget_f (void) { if (!sv_allow_cheats) { - Con_Printf ("Cheats are not allowed on this server\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Cheats are not allowed on this server\n"); return; } @@ -3328,7 +3333,7 @@ void Cmd_God_f (void) { if (!sv_allow_cheats) { - Con_Printf ("Cheats are not allowed on this server\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Cheats are not allowed on this server\n"); return; } @@ -3355,7 +3360,7 @@ void Cmd_Give_f (void) if (!sv_allow_cheats) { - Con_Printf ("Cheats are not allowed on this server\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Cheats are not allowed on this server\n"); return; } @@ -3410,7 +3415,7 @@ void Cmd_Noclip_f (void) { if (!sv_allow_cheats) { - Con_Printf ("Cheats are not allowed on this server\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Cheats are not allowed on this server\n"); return; } @@ -3436,7 +3441,7 @@ void Cmd_Fly_f (void) { if (!sv_allow_cheats) { - Con_Printf ("Cheats are not allowed on this server\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Cheats are not allowed on this server\n"); return; } @@ -3467,20 +3472,20 @@ void Cmd_SetPos_f(void) { if (!sv_allow_cheats) { - Con_Printf ("Cheats are not allowed on this server\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Cheats are not allowed on this server\n"); return; } if (Cmd_Argc() != 4) { - Con_Printf ("setpos %i %i %i\n", (int)sv_player->v->origin[0], (int)sv_player->v->origin[1], (int)sv_player->v->origin[2]); + SV_ClientPrintf(host_client, PRINT_HIGH, "setpos %f %f %f\n", sv_player->v->origin[0], sv_player->v->origin[1], sv_player->v->origin[2]); return; } SV_LogPlayer(host_client, "setpos cheat"); if (sv_player->v->movetype != MOVETYPE_NOCLIP) { sv_player->v->movetype = MOVETYPE_NOCLIP; - Con_Printf("noclip on\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "noclip on\n"); } sv_player->v->origin[0] = atof(Cmd_Argv(1)); @@ -3499,7 +3504,6 @@ void SV_SetUpClientEdict (client_t *cl, edict_t *ent) string_t preserve; preserve = ent->v->netname; Q1QVMED_ClearEdict(ent, true); - Con_Printf("client netname: %x\n", preserve); ent->v->netname = preserve; } else @@ -3553,19 +3557,19 @@ void Cmd_Join_f (void) if (svs.gametype != GT_PROGS) { - Con_Printf ("Sorry, not implemented in this gamecode type. Try moaning at the dev team\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Sorry, not implemented in this gamecode type. Try moaning at the dev team\n"); return; } if (!(host_client->zquake_extensions & Z_EXT_JOIN_OBSERVE)) { - Con_Printf ("Your QW client doesn't support this command\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Your QW client doesn't support this command\n"); return; } if (password.string[0] && stricmp(password.string, "none")) { - Con_Printf ("This server requires a %s password. Please disconnect, set the password and reconnect as %s.\n", "player", "player"); + SV_ClientPrintf(host_client, PRINT_HIGH, "This server requires a %s password. Please disconnect, set the password and reconnect as %s.\n", "player", "player"); return; } @@ -3578,7 +3582,7 @@ void Cmd_Join_f (void) } if (numclients >= maxclients.value) { - Con_Printf ("Can't join, all player slots full\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Can't join, all player slots full\n"); return; } @@ -3646,19 +3650,19 @@ void Cmd_Observe_f (void) if (svs.gametype != GT_PROGS) { - Con_Printf ("Sorry, not implemented in this gamecode type. Try moaning at the dev team\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Sorry, not implemented in this gamecode type. Try moaning at the dev team\n"); return; } if (!(host_client->zquake_extensions & Z_EXT_JOIN_OBSERVE)) { - Con_Printf ("Your QW client doesn't support this command\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Your QW client doesn't support this command\n"); return; } if (spectator_password.string[0] && stricmp(spectator_password.string, "none")) { - Con_Printf ("This server requires a %s password. Please disconnect, set the password and reconnect as %s.\n", "spectator", "spectator"); + SV_ClientPrintf(host_client, PRINT_HIGH, "This server requires a %s password. Please disconnect, set the password and reconnect as %s.\n", "spectator", "spectator"); return; } @@ -3670,7 +3674,7 @@ void Cmd_Observe_f (void) } if (numspectators >= maxspectators.value) { - Con_Printf ("Can't join, all spectator slots full\n"); + SV_PrintToClient(host_client, PRINT_HIGH, "Can't join, all spectator slots full\n"); return; } @@ -3754,9 +3758,9 @@ void Cmd_FPSList_f(void) } if (frames) - Con_Printf("%s: %ffps (min%f max %f\n", cl->name, ftime/frames, minf, maxf); + SV_ClientPrintf(host_client, PRINT_HIGH, "%s: %ffps (min%f max %f\n", cl->name, ftime/frames, minf, maxf); else - Con_Printf("%s: no information available\n", cl->name); + SV_ClientPrintf(host_client, PRINT_HIGH, "%s: no information available\n", cl->name); } } @@ -3766,7 +3770,7 @@ void SV_EnableClientsCSQC(void) if (host_client->fteprotocolextensions & PEXT_CSQC || atoi(Cmd_Argv(1))) host_client->csqcactive = true; else - Con_Printf("CSQC entities not enabled - no support from network protocol\n"); + SV_ClientPrintf(host_client, PRINT_HIGH, "CSQC entities not enabled - no support from network protocol\n"); #endif } void SV_DisableClientsCSQC(void) diff --git a/engine/server/world.c b/engine/server/world.c index 57ca463d8..a5944bfbd 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -1755,7 +1755,7 @@ void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip ) if (touch == clip->passedict) continue; if (touch->v->solid == SOLID_TRIGGER || touch->v->solid == SOLID_LADDER) - SV_Error ("Trigger (%s) in clipping list", PR_StringToNative(svprogfuncs, touch->v->classname)); + SV_Error ("Trigger (%s) in clipping list", PR_GetString(svprogfuncs, touch->v->classname)); if (clip->type & MOVE_NOMONSTERS && touch->v->solid != SOLID_BSP) continue;