diff --git a/engine/client/cl_cg.c b/engine/client/cl_cg.c index 47e511b62..944bde735 100644 --- a/engine/client/cl_cg.c +++ b/engine/client/cl_cg.c @@ -104,7 +104,7 @@ typedef enum { CG_SNAPVECTOR, CG_REMOVECOMMAND, CG_R_LIGHTFORPOINT, //73 - CG_CIN_PLAYCINEMATIC, //64 + CG_CIN_PLAYCINEMATIC, //74 CG_CIN_STOPCINEMATIC, //75 CG_CIN_RUNCINEMATIC, //76 CG_CIN_DRAWCINEMATIC, //77 @@ -1035,6 +1035,15 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con VM_FLOAT(ret)=(float)ceil(VM_FLOAT(arg[0])); break; + case CG_R_REMAP_SHADER: + { +// char *dst = VM_POINTER(arg[0]); +// char *src = VM_POINTER(arg[1]); +// float timeoffset = VM_FLOAT(arg[2]); + Con_DPrintf("CG_R_REMAP_SHADER: not implemented\n"); + } + break; + case CG_R_REGISTERFONT: VALIDATEPOINTER(arg[2], sizeof(fontInfo_t)); UI_RegisterFont(VM_POINTER(arg[0]), VM_LONG(arg[1]), VM_POINTER(arg[2])); diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 12c388e28..1a112c816 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -37,6 +37,7 @@ cvar_t cl_netfps = CVAR("cl_netfps", "150"); cvar_t cl_sparemsec = CVARC("cl_sparemsec", "10", CL_SpareMsec_Callback); cvar_t cl_queueimpulses = CVAR("cl_queueimpulses", "0"); cvar_t cl_smartjump = CVAR("cl_smartjump", "1"); +cvar_t cl_run = CVARD("cl_run", "1", "Enables autorun, doubling the effective value of cl_forwardspeed and friends."); cvar_t cl_prydoncursor = CVAR("cl_prydoncursor", ""); //for dp protocol cvar_t cl_instantrotate = CVARF("cl_instantrotate", "1", CVAR_SEMICHEAT); @@ -483,7 +484,7 @@ void CL_ProxyMenuHooks(void) cvar_t cl_upspeed = SCVARF("cl_upspeed","400", CVAR_ARCHIVE); cvar_t cl_forwardspeed = SCVARF("cl_forwardspeed","400", CVAR_ARCHIVE); -cvar_t cl_backspeed = SCVARF("cl_backspeed","400", CVAR_ARCHIVE); +cvar_t cl_backspeed = CVARFD("cl_backspeed","", CVAR_ARCHIVE, "The base speed that you move backwards at. If empty, uses the value of cl_forwardspeed instead."); cvar_t cl_sidespeed = SCVARF("cl_sidespeed","400", CVAR_ARCHIVE); cvar_t cl_movespeedkey = SCVAR("cl_movespeedkey","2.0"); @@ -570,7 +571,7 @@ void CL_BaseMove (usercmd_t *cmd, int pnum, float extra, float wantfps) // // adjust for speed key // - if (in_speed.state[pnum] & 1) + if ((in_speed.state[pnum] & 1) ^ cl_run.ival) scale *= cl_movespeedkey.value; if (in_strafe.state[pnum] & 1) @@ -590,19 +591,10 @@ void CL_BaseMove (usercmd_t *cmd, int pnum, float extra, float wantfps) if (! (in_klook.state[pnum] & 1) ) { cmd->forwardmove += scale*cl_forwardspeed.value * CL_KeyState (&in_forward, pnum); - cmd->forwardmove -= scale*cl_backspeed.value * CL_KeyState (&in_back, pnum); + cmd->forwardmove -= scale*(*cl_backspeed.string?cl_backspeed.value:cl_forwardspeed.value) * CL_KeyState (&in_back, pnum); } } -int MakeChar (int i) -{ - if (i < -127*4) - i = -127*4; - if (i > 127*4) - i = 127*4; - return i; -} - void CL_ClampPitch (int pnum) { float mat[16]; @@ -1360,7 +1352,7 @@ qboolean CLQ2_SendCmd (sizebuf_t *buf) qboolean dontdrop; usercmd_t *cmd; int checksumIndex, i; - qbyte lightlev; + int lightlev; seq_hash = cls.netchan.outgoing_sequence; @@ -1396,7 +1388,7 @@ qboolean CLQ2_SendCmd (sizebuf_t *buf) cmd = &cl.outframes[i].cmd[0]; *cmd = independantphysics[0]; - cmd->lightlevel = lightlev; + cmd->lightlevel = (lightlev>255)?255:lightlev; cl.outframes[i].senttime = realtime; cl.outframes[i].latency = -1; @@ -1931,6 +1923,7 @@ void CL_InitInput (void) Cvar_Register (&cl_queueimpulses, inputnetworkcvargroup); Cvar_Register (&cl_netfps, inputnetworkcvargroup); Cvar_Register (&cl_sparemsec, inputnetworkcvargroup); + Cvar_Register (&cl_run, inputnetworkcvargroup); Cvar_Register (&cl_smartjump, inputnetworkcvargroup); diff --git a/engine/client/cl_ui.c b/engine/client/cl_ui.c index 448beb210..db13410c6 100644 --- a/engine/client/cl_ui.c +++ b/engine/client/cl_ui.c @@ -396,9 +396,14 @@ void VQ3_AddEntity(const q3refEntity_t *q3) ent.framestate.g[FS_REG].frame[1] = q3->oldframe; memcpy(ent.axis, q3->axis, sizeof(q3->axis)); ent.framestate.g[FS_REG].lerpfrac = q3->backlerp; - ent.scale = q3->radius; + if (q3->reType == RT_SPRITE) + { + ent.scale = q3->radius; + ent.rotation = q3->rotation; + } + else + ent.scale = 1; ent.rtype = q3->reType; - ent.rotation = q3->rotation; if (q3->customSkin) ent.skinnum = Mod_SkinNumForName(ent.model, VM_FROMSTRCACHE(q3->customSkin)); diff --git a/engine/client/clq3_parse.c b/engine/client/clq3_parse.c index 92362047d..85c0bfb17 100644 --- a/engine/client/clq3_parse.c +++ b/engine/client/clq3_parse.c @@ -908,6 +908,18 @@ void CLQ3_SendCmd(usercmd_t *cmd) cmd->forwardmove *= 127/400.0f; cmd->sidemove *= 127/400.0f; cmd->upmove *= 127/400.0f; + if (cmd->forwardmove > 127) + cmd->forwardmove = 127; + if (cmd->forwardmove < -127) + cmd->forwardmove = -127; + if (cmd->sidemove > 127) + cmd->sidemove = 127; + if (cmd->sidemove < -127) + cmd->sidemove = -127; + if (cmd->upmove > 127) + cmd->upmove = 127; + if (cmd->upmove < -127) + cmd->upmove = -127; if (cmd->buttons & 2) //jump { diff --git a/engine/client/keys.c b/engine/client/keys.c index 03a15e34e..6ddef89e0 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -231,6 +231,22 @@ keyname_t keynames[] = {NULL,0} }; +#if defined(CSQC_DAT) || defined(MENU_DAT) +int MP_TranslateFTEtoQCCodes(int code); +void Key_PrintQCDefines(vfsfile_t *f) +{ + int i, j; + for (i = 0; keynames[i].name; i++) + { + for (j = 0; j < i; j++) + if (keynames[j].keynum == keynames[i].keynum) + break; + if (j == i) + VFS_PRINTF(f, "#define K_%s\t%i\n", keynames[i].name, MP_TranslateFTEtoQCCodes(keynames[j].keynum)); + } +} +#endif + /* ============================================================================== diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 31132e490..52e86bdb3 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -41,13 +41,15 @@ qboolean M_Options_AlwaysRun (menucheck_t *option, struct menu_s *menu, chk_set_ else if (cl_forwardspeed.value > 200) { Cvar_SetValue (&cl_forwardspeed, 200); - Cvar_SetValue (&cl_backspeed, 200); + if (*cl_backspeed.string) + Cvar_SetValue (&cl_backspeed, 200); return false; } else { Cvar_SetValue (&cl_forwardspeed, 400); - Cvar_SetValue (&cl_backspeed, 400); + if (*cl_backspeed.string) + Cvar_SetValue (&cl_backspeed, 400); return true; } } diff --git a/engine/client/pr_clcmd.c b/engine/client/pr_clcmd.c index 56ba57fa7..63223c9e3 100644 --- a/engine/client/pr_clcmd.c +++ b/engine/client/pr_clcmd.c @@ -9,6 +9,8 @@ //these two global qcinput variables are the current scan code being passed to qc, if valid. this protects against protected apis where the qc just passes stuff through. int qcinput_scan; int qcinput_unicode; + +//QC key codes are based upon DP's keycode constants. This is on account of menu.dat coming first. int MP_TranslateFTEtoQCCodes(int code) { switch(code) @@ -23,11 +25,11 @@ int MP_TranslateFTEtoQCCodes(int code) case K_LEFTARROW: return 130; case K_RIGHTARROW: return 131; case K_LALT: return 132; - case K_RALT: return 132; + case K_RALT: return -K_RALT; case K_LCTRL: return 133; - case K_RCTRL: return 133; + case K_RCTRL: return -K_RCTRL; case K_LSHIFT: return 134; - case K_RSHIFT: return 134; + case K_RSHIFT: return -K_RSHIFT; case K_F1: return 135; case K_F2: return 136; case K_F3: return 137; @@ -46,61 +48,34 @@ int MP_TranslateFTEtoQCCodes(int code) case K_PGUP: return 150; case K_HOME: return 151; case K_END: return 152; - case K_KP_HOME: return 160; - case K_KP_UPARROW: return 161; - case K_KP_PGUP: return 162; - case K_KP_LEFTARROW: return 163; - case K_KP_5: return 164; - case K_KP_RIGHTARROW: return 165; - case K_KP_END: return 166; - case K_KP_DOWNARROW: return 167; - case K_KP_PGDN: return 168; - case K_KP_ENTER: return 169; - case K_KP_INS: return 170; - case K_KP_DEL: return 171; - case K_KP_SLASH: return 172; - case K_KP_MINUS: return 173; - case K_KP_PLUS: return 174; - case K_PAUSE: return 255; - case K_JOY1: return 768; - case K_JOY2: return 769; - case K_JOY3: return 770; - case K_JOY4: return 771; - case K_AUX1: return 772; - case K_AUX2: return 773; - case K_AUX3: return 774; - case K_AUX4: return 775; - case K_AUX5: return 776; - case K_AUX6: return 777; - case K_AUX7: return 778; - case K_AUX8: return 779; - case K_AUX9: return 780; - case K_AUX10: return 781; - case K_AUX11: return 782; - case K_AUX12: return 783; - case K_AUX13: return 784; - case K_AUX14: return 785; - case K_AUX15: return 786; - case K_AUX16: return 787; - case K_AUX17: return 788; - case K_AUX18: return 789; - case K_AUX19: return 790; - case K_AUX20: return 791; - case K_AUX21: return 792; - case K_AUX22: return 793; - case K_AUX23: return 794; - case K_AUX24: return 795; - case K_AUX25: return 796; - case K_AUX26: return 797; - case K_AUX27: return 798; - case K_AUX28: return 799; - case K_AUX29: return 800; - case K_AUX30: return 801; - case K_AUX31: return 802; - case K_AUX32: return 803; + case K_PAUSE: return 153; + case K_KP_NUMLOCK: return 154; + case K_CAPSLOCK: return 155; + case K_SCRLCK: return 156; + case K_KP_INS: return 157; + case K_KP_END: return 158; + case K_KP_DOWNARROW: return 159; + case K_KP_PGDN: return 160; + case K_KP_LEFTARROW: return 161; + case K_KP_5: return 162; + case K_KP_RIGHTARROW: return 163; + case K_KP_HOME: return 164; + case K_KP_UPARROW: return 165; + case K_KP_PGUP: return 166; + case K_KP_DEL: return 167; + case K_KP_SLASH: return 168; + case K_KP_STAR: return 169; + case K_KP_MINUS: return 170; + case K_KP_PLUS: return 171; + case K_KP_ENTER: return 172; + case K_KP_EQUALS: return 173; + case K_PRINTSCREEN: return 174; + case K_MOUSE1: return 512; case K_MOUSE2: return 513; case K_MOUSE3: return 514; + case K_MWHEELUP: return 515; + case K_MWHEELDOWN: return 516; case K_MOUSE4: return 517; case K_MOUSE5: return 518; case K_MOUSE6: return 519; @@ -108,8 +83,68 @@ int MP_TranslateFTEtoQCCodes(int code) case K_MOUSE8: return 521; case K_MOUSE9: return 522; case K_MOUSE10: return 523; - case K_MWHEELDOWN: return 515;//K_MOUSE4; - case K_MWHEELUP: return 516;//K_MOUSE5; +// case K_MOUSE11: return 524; +// case K_MOUSE12: return 525; +// case K_MOUSE13: return 526; +// case K_MOUSE14: return 527; +// case K_MOUSE15: return 528; +// case K_MOUSE16: return 529; + + case K_JOY1: return 768; + case K_JOY2: return 769; + case K_JOY3: return 770; + case K_JOY4: return 771; +// case K_JOY5: return 772; +// case K_JOY6: return 773; +// case K_JOY7: return 774; +// case K_JOY8: return 775; +// case K_JOY9: return 776; +// case K_JOY10: return 777; +// case K_JOY11: return 778; +// case K_JOY12: return 779; +// case K_JOY13: return 780; +// case K_JOY14: return 781; +// case K_JOY15: return 782; +// case K_JOY16: return 783; + + case K_AUX1: return 784; + case K_AUX2: return 785; + case K_AUX3: return 786; + case K_AUX4: return 787; + case K_AUX5: return 788; + case K_AUX6: return 789; + case K_AUX7: return 790; + case K_AUX8: return 791; + case K_AUX9: return 792; + case K_AUX10: return 793; + case K_AUX11: return 794; + case K_AUX12: return 795; + case K_AUX13: return 796; + case K_AUX14: return 797; + case K_AUX15: return 798; + case K_AUX16: return 799; + case K_AUX17: return 800; + case K_AUX18: return 801; + case K_AUX19: return 802; + case K_AUX20: return 803; + case K_AUX21: return 804; + case K_AUX22: return 805; + case K_AUX23: return 806; + case K_AUX24: return 807; + case K_AUX25: return 808; + case K_AUX26: return 809; + case K_AUX27: return 810; + case K_AUX28: return 811; + case K_AUX29: return 812; + case K_AUX30: return 813; + case K_AUX31: return 814; + case K_AUX32: return 815; + + case K_VOLUP: return -code; + case K_VOLDOWN: return -code; + case K_APP: return -code; + case K_SEARCH: return -code; + default: return code; } } @@ -148,62 +183,34 @@ int MP_TranslateQCtoFTECodes(int code) case 150: return K_PGUP; case 151: return K_HOME; case 152: return K_END; - case 160: return K_KP_HOME; - case 161: return K_KP_UPARROW; - case 162: return K_KP_PGUP; - case 163: return K_KP_LEFTARROW; - case 164: return K_KP_5; - case 165: return K_KP_RIGHTARROW; - case 166: return K_KP_END; - case 167: return K_KP_DOWNARROW; - case 168: return K_KP_PGDN; - case 169: return K_KP_ENTER; - case 170: return K_KP_INS; - case 171: return K_KP_DEL; - case 172: return K_KP_SLASH; - case 173: return K_KP_MINUS; - case 174: return K_KP_PLUS; - case 255: return K_PAUSE; + case 153: return K_PAUSE; + case 154: return K_KP_NUMLOCK; + case 155: return K_CAPSLOCK; + case 156: return K_SCRLCK; + case 157: return K_KP_INS; + case 158: return K_KP_END; + case 159: return K_KP_DOWNARROW; + case 160: return K_KP_PGDN; + case 161: return K_KP_LEFTARROW; + case 162: return K_KP_5; + case 163: return K_KP_RIGHTARROW; + case 164: return K_KP_HOME; + case 165: return K_KP_UPARROW; + case 166: return K_KP_PGUP; + case 167: return K_KP_DEL; + case 168: return K_KP_SLASH; + case 169: return K_KP_STAR; + case 170: return K_KP_MINUS; + case 171: return K_KP_PLUS; + case 172: return K_KP_ENTER; + case 173: return K_KP_EQUALS; + case 174: return K_PRINTSCREEN; - case 768: return K_JOY1; - case 769: return K_JOY2; - case 770: return K_JOY3; - case 771: return K_JOY4; - case 772: return K_AUX1; - case 773: return K_AUX2; - case 774: return K_AUX3; - case 775: return K_AUX4; - case 776: return K_AUX5; - case 777: return K_AUX6; - case 778: return K_AUX7; - case 779: return K_AUX8; - case 780: return K_AUX9; - case 781: return K_AUX10; - case 782: return K_AUX11; - case 783: return K_AUX12; - case 784: return K_AUX13; - case 785: return K_AUX14; - case 786: return K_AUX15; - case 787: return K_AUX16; - case 788: return K_AUX17; - case 789: return K_AUX18; - case 790: return K_AUX19; - case 791: return K_AUX20; - case 792: return K_AUX21; - case 793: return K_AUX22; - case 794: return K_AUX23; - case 795: return K_AUX24; - case 796: return K_AUX25; - case 797: return K_AUX26; - case 798: return K_AUX27; - case 799: return K_AUX28; - case 800: return K_AUX29; - case 801: return K_AUX30; - case 802: return K_AUX31; - case 803: return K_AUX32; case 512: return K_MOUSE1; case 513: return K_MOUSE2; case 514: return K_MOUSE3; + case 515: return K_MWHEELUP; + case 516: return K_MWHEELDOWN; case 517: return K_MOUSE4; case 518: return K_MOUSE5; case 519: return K_MOUSE6; @@ -211,9 +218,66 @@ int MP_TranslateQCtoFTECodes(int code) case 521: return K_MOUSE8; case 522: return K_MOUSE9; case 523: return K_MOUSE10; - case 515: return K_MWHEELDOWN;//K_MOUSE4; - case 516: return K_MWHEELUP;//K_MOUSE5; - default: return code; +// case 524: return K_MOUSE11; +// case 525: return K_MOUSE12; +// case 526: return K_MOUSE13; +// case 527: return K_MOUSE14; +// case 528: return K_MOUSE15; +// case 529: return K_MOUSE16; + + case 768: return K_JOY1; + case 769: return K_JOY2; + case 770: return K_JOY3; + case 771: return K_JOY4; +// case 772: return K_JOY5; +// case 773: return K_JOY6; +// case 774: return K_JOY7; +// case 775: return K_JOY8; +// case 776: return K_JOY9; +// case 777: return K_JOY10; +// case 778: return K_JOY11; +// case 779: return K_JOY12; +// case 780: return K_JOY13; +// case 781: return K_JOY14; +// case 782: return K_JOY15; +// case 783: return K_JOY16; + + case 784: return K_AUX1; + case 785: return K_AUX2; + case 786: return K_AUX3; + case 787: return K_AUX4; + case 788: return K_AUX5; + case 789: return K_AUX6; + case 790: return K_AUX7; + case 791: return K_AUX8; + case 792: return K_AUX9; + case 793: return K_AUX10; + case 794: return K_AUX11; + case 795: return K_AUX12; + case 796: return K_AUX13; + case 797: return K_AUX14; + case 798: return K_AUX15; + case 799: return K_AUX16; + case 800: return K_AUX17; + case 801: return K_AUX18; + case 802: return K_AUX19; + case 803: return K_AUX20; + case 804: return K_AUX21; + case 805: return K_AUX22; + case 806: return K_AUX23; + case 807: return K_AUX24; + case 808: return K_AUX25; + case 809: return K_AUX26; + case 810: return K_AUX27; + case 811: return K_AUX28; + case 812: return K_AUX29; + case 813: return K_AUX30; + case 814: return K_AUX31; + case 815: return K_AUX32; + default: + if (code < 0) //negative values are 'fte-native' keys, for stuff that the api lacks. + return -code; + return code; } } diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 263fd101f..c2d9af118 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -97,6 +97,8 @@ cvar_t r_fb_models = CVARAF ("r_fb_models", "1", "gl_fb_models", CVAR_SEMICHEAT); cvar_t r_skin_overlays = SCVARF ("r_skin_overlays", "1", CVAR_SEMICHEAT|CVAR_RENDERERLATCH); +cvar_t r_globalskin_first = CVARFD ("r_globalskin_first", "100", CVAR_RENDERERLATCH, "Specifies the first .skin value that is a global skin. See also: r_globalskin_count."); +cvar_t r_globalskin_count = CVARFD ("r_globalskin_count", "10", CVAR_RENDERERLATCH, "Specifies how many globalskins there are."); cvar_t r_coronas = SCVARF ("r_coronas", "0", CVAR_ARCHIVE); cvar_t r_flashblend = SCVARF ("gl_flashblend", "0", diff --git a/engine/client/roq_read.c b/engine/client/roq_read.c index 8f2ad5943..c5afb9313 100644 --- a/engine/client/roq_read.c +++ b/engine/client/roq_read.c @@ -626,8 +626,8 @@ long fpos; { snd_left += (int)ri->snd_sqr_arr[(unsigned)VFS_GETC(fp)]; snd_right += (int)ri->snd_sqr_arr[(unsigned)VFS_GETC(fp)]; - *(short *)&ri->audio[i * 2] = snd_left; - *(short *)&ri->audio[i * 2 + 2] = snd_right; + *(short *)&ri->audio[i * 2] = snd_left & 0xffff; + *(short *)&ri->audio[i * 2 + 2] = snd_right & 0xffff; } ri->aud_pos = fpos; return chunk_size; diff --git a/engine/common/bspfile.h b/engine/common/bspfile.h index 905fc26c9..c6cd6e671 100644 --- a/engine/common/bspfile.h +++ b/engine/common/bspfile.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //#define MAX_MAP_ENTITIES 1024 //#define MAX_MAP_ENTSTRING 65536 -#define MAX_MAP_PLANES 65536*2 //sanity (used by q2) +#define SANITY_MAX_MAP_PLANES 65536*8 //sanity #define SANITY_MAX_MAP_NODES 65536 //sanity #define SANITY_MAX_MAP_CLIPNODES 65536 //sanity #define MAX_MAP_LEAFS 65536 //pvs buffer size. not sanity. @@ -44,6 +44,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //#define MAX_MAP_LIGHTING 0x100000 //#define MAX_MAP_VISIBILITY 0x200000 +#define SANITY_MAX_MAP_BRUSHSIDES 0x100000 + // key / value pair sizes #define MAX_KEY 32 @@ -412,12 +414,10 @@ typedef struct q2miptex_s // 16 bit short limits #define SANITY_MAX_Q2MAP_MODELS 1024 #define MAX_Q2MAP_ENTITIES 2048 -#define SANITY_MAX_MAP_BRUSHES 0x8000 +#define SANITY_MAX_MAP_BRUSHES 0x10000 #define MAX_Q2MAP_AREAS 256 #define MAX_Q2MAP_AREAPORTALS 1024 -#define MAX_Q2MAP_PLANES MAX_MAP_PLANES -#define MAX_Q2MAP_BRUSHSIDES 0x40000 #define MAX_Q2MAP_VERTS MAX_MAP_VERTS #define MAX_Q2MAP_FACES MAX_MAP_FACES #define SANITY_MAX_MAP_LEAFFACES 262144 //sanity only diff --git a/engine/common/cmd.c b/engine/common/cmd.c index ea479eec1..b3e5b9cce 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -cvar_t cfg_reload_on_gamedir = CVAR("cfg_reload_on_gamedir", "1"); -cvar_t com_fs_cache = SCVARF("fs_cache", IFMINIMAL("2","1"), CVAR_ARCHIVE); cvar_t rcon_level = SCVAR("rcon_level", "20"); cvar_t cmd_maxbuffersize = SCVAR("cmd_maxbuffersize", "65536"); cvar_t dpcompat_set = SCVAR("dpcompat_set", "0"); @@ -261,7 +259,7 @@ void Cbuf_InsertText (const char *text, int level, qboolean addnl) // add the entire text of the file Cbuf_AddText (text, level); if (addnl) - SZ_Write (&cmd_text[level].buf, "\n", 1); + Cbuf_AddText ("\n", level); // add the copied off data if (templen) { @@ -1285,6 +1283,9 @@ char *Cmd_ExpandString (char *data, char *dest, int destlen, int maxaccesslevel, dest[len] = 0; + if (len && dest[len-1] == '\r') //with dos line endings, don't add some pointless \r char on the end. + dest[len-1] = 0; + return dest; } @@ -3069,7 +3070,6 @@ void Cmd_Init (void) Cmd_AddCommand ("cfg_load",Cmd_Exec_f); Cmd_AddCommand ("cfg_reset",Cmd_Reset_f); - Cvar_Register(&cfg_reload_on_gamedir, "Filesystem"); Cmd_AddCommand ("exec",Cmd_Exec_f); Cmd_AddCommand ("echo",Cmd_Echo_f); @@ -3116,7 +3116,6 @@ void Cmd_Init (void) Cmd_AddMacro("version", Macro_Version, false); Cmd_AddMacro("qt", Macro_Quote, false); - Cvar_Register(&com_fs_cache, "Filesystem"); Cvar_Register(&tp_disputablemacros, "Teamplay"); Cvar_Register(&dpcompat_set, "Darkplaces compatibility"); diff --git a/engine/common/cvar.c b/engine/common/cvar.c index e35259162..aa884a180 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -150,6 +150,8 @@ char *Cvar_FlagToName(int flag) return "rulesetlatch"; case CVAR_SHADERSYSTEM: return "shadersystem"; + case CVAR_NOSAVE: + return "nosave"; } return NULL; @@ -570,6 +572,8 @@ void Cvar_Reset_f (void) if ((cmd->flags & CVAR_NOSET) && !search) continue; + if (cmd->flags & CVAR_NORESET) + continue; // reset cvar to default only if its okay to do so if (cmd->defaultstr) @@ -1297,7 +1301,7 @@ void Cvar_WriteVariables (vfsfile_t *f, qboolean all) if (var->flags & CVAR_ARCHIVE || (all && var != &cl_warncmd)) { //yeah, don't force-save readonly cvars. - if (var->flags & CVAR_NOSET) + if (var->flags & (CVAR_NOSET|CVAR_NOSAVE)) continue; if (!writtengroupheader) diff --git a/engine/common/cvar.h b/engine/common/cvar.h index 0efb26723..99979e179 100644 --- a/engine/common/cvar.h +++ b/engine/common/cvar.h @@ -138,6 +138,8 @@ typedef struct cvar_group_s #define CVAR_TELLGAMECODE (1<<17) //tells the gamecode when it has changed, does not prevent changing, added as an optimisation #define CVAR_CONFIGDEFAULT (1<<18) //this cvar's default value has been changed to match a config. +#define CVAR_NOSAVE (1<<19) //this cvar should never be saved. ever. +#define CVAR_NORESET (1<<20) //cvar is not reset by various things. #define CVAR_LASTFLAG CVAR_SHADERSYSTEM diff --git a/engine/common/fs.c b/engine/common/fs.c index 86ce9e653..54b1f29b0 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -12,16 +12,34 @@ #include "winquake.h" #endif +void fs_game_callback(cvar_t *var, char *oldvalue); hashtable_t filesystemhash; qboolean com_fschanged = true; static unsigned int fs_restarts; -extern cvar_t com_fs_cache; -extern cvar_t cfg_reload_on_gamedir; + +cvar_t com_fs_cache = CVARF("fs_cache", IFMINIMAL("2","1"), CVAR_ARCHIVE); +cvar_t cfg_reload_on_gamedir = CVAR("cfg_reload_on_gamedir", "1"); +cvar_t fs_game = CVARFDC("game", "", CVAR_NOSAVE|CVAR_NORESET, "Provided for Q2 compat.", fs_game_callback); +cvar_t fs_gamedir = CVARFD("fs_gamedir", "", CVAR_NOUNSAFEEXPAND|CVAR_NOSET|CVAR_NOSAVE, "Provided for Q2 compat."); +cvar_t fs_basedir = CVARFD("fs_basedir", "", CVAR_NOUNSAFEEXPAND|CVAR_NOSET|CVAR_NOSAVE, "Provided for Q2 compat."); int active_fs_cachetype; static int fs_referencetype; int fs_finds; void COM_CheckRegistered (void); +void fs_game_callback(cvar_t *var, char *oldvalue) +{ + static qboolean runaway = false; + char buf[MAX_OSPATH]; + if (!strcmp(var->string, oldvalue)) + return; //no change here. + if (runaway) + return; //ignore that + runaway = true; + Cmd_ExecuteString(va("gamedir %s\n", COM_QuotedString(var->string, buf, sizeof(buf))), Cmd_ExecLevel); + runaway = false; +} + struct { void *module; @@ -1940,11 +1958,6 @@ char *FS_GetGamedir(void) { return gamedirfile; } -/*unsafe - provided only for gamecode compat, should not be used for internal features*/ -char *FS_GetBasedir(void) -{ - return com_quakedir; -} //given a 'c:/foo/bar/' path, will extract 'bar'. void FS_ExtractDir(char *in, char *out, int outlen) @@ -3515,6 +3528,12 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs) Validation_FlushFileList(); //prevent previous hacks from making a difference. #endif + Cvar_ForceSet(&fs_game, FS_GetGamedir()); +#ifdef Q2SERVER + Cvar_ForceSet(&fs_gamedir, va("%s%s", com_quakedir, FS_GetGamedir())); + Cvar_ForceSet(&fs_basedir, com_quakedir); +#endif + return true; } @@ -3589,11 +3608,17 @@ void COM_InitFilesystem (void) FS_CleanDir(com_quakedir, sizeof(com_quakedir)); - - Cvar_Register(&fs_gamename, "FS"); - Cvar_Register(&fs_gamemanifest, "FS"); + Cvar_Register(&cfg_reload_on_gamedir, "Filesystem"); + Cvar_Register(&com_fs_cache, "Filesystem"); + Cvar_Register(&fs_gamename, "Filesystem"); + Cvar_Register(&fs_gamemanifest, "Filesystem"); Cvar_Register(&com_protocolname, "Server Info"); Cvar_Register(&com_modname, "Server Info"); + Cvar_Register(&fs_game, "Filesystem"); +#ifdef Q2SERVER + Cvar_Register(&fs_gamedir, "Filesystem"); + Cvar_Register(&fs_basedir, "Filesystem"); +#endif usehome = false; diff --git a/engine/common/fs_zip.c b/engine/common/fs_zip.c index bee1a7a03..89b1d9355 100644 --- a/engine/common/fs_zip.c +++ b/engine/common/fs_zip.c @@ -428,6 +428,7 @@ struct decompressstate qofs_t usize; //data remaining. refuse to read more bytes than this. unsigned char inbuffer[16384]; unsigned char outbuffer[16384]; + unsigned int readoffset; z_stream strm; }; @@ -453,23 +454,25 @@ qofs_t FSZIP_Decompress_Read(struct decompressstate *st, qbyte *buffer, qofs_t b qofs_t read = 0; while(bytes) { - if (st->strm.total_out) + if (st->readoffset < st->strm.total_out) { - unsigned int consume = st->strm.total_out; + unsigned int consume = st->strm.total_out-st->readoffset; if (consume > bytes) consume = bytes; - memcpy(buffer, st->outbuffer, consume); - st->strm.total_out -= consume; + memcpy(buffer, st->outbuffer+st->readoffset, consume); buffer += consume; bytes -= consume; read += consume; + st->readoffset += consume; continue; } else if (eof) break; //no input available, and nothing in the buffers. + st->strm.total_out = 0; st->strm.avail_out = sizeof(st->outbuffer); st->strm.next_out = st->outbuffer; + st->readoffset = 0; if (!st->strm.avail_in) { qofs_t sz; diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 35dbf086d..9d0d63418 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -12,8 +12,6 @@ #define MAX_Q3MAP_INDICES 0x8000000 //just a sanity limit #define MAX_Q3MAP_VERTEXES 0x800000 //just a sanity limit -#define MAX_Q3MAP_BRUSHSIDES 0x30000 -#define MAX_CM_BRUSHSIDES (MAX_Q3MAP_BRUSHSIDES << 1) #define MAX_CM_PATCH_VERTS (4096) #define MAX_CM_FACES (MAX_Q2MAP_FACES) #define MAX_CM_PATCHES (0x10000) @@ -285,14 +283,11 @@ static mfog_t *map_fogs; static int map_numfogs; static int numbrushsides; -static q2cbrushside_t map_brushsides[MAX_Q2MAP_BRUSHSIDES]; +static q2cbrushside_t *map_brushsides; static int numtexinfo; static q2mapsurface_t *map_surfaces; -static int numplanes; -static mplane_t map_planes[MAX_Q2MAP_PLANES+6]; // extra for box hull - static int numleafs = 1; // allow leaf funcs to be called without a map static mleaf_t map_leafs[(MAX_MAP_LEAFS+7)/8]; static int emptyleaf; @@ -1114,7 +1109,7 @@ qboolean CMod_LoadSurfaces (lump_t *l) return true; } #ifndef SERVERONLY -texture_t *Mod_LoadWall(char *name, char *sname) +texture_t *Mod_LoadWall(char *name, char *sname, unsigned int imageflags) { q2miptex_t replacementwal; qbyte *in, *oin; @@ -1130,7 +1125,7 @@ texture_t *Mod_LoadWall(char *name, char *sname) wal = (void *)FS_LoadMallocFile (name); if (!wal) { - tn.base = R_LoadReplacementTexture(name, loadname, 0); + tn.base = R_LoadReplacementTexture(name, loadname, imageflags); wal = &replacementwal; memset(wal, 0, sizeof(*wal)); Q_strncpyz(wal->name, name, sizeof(wal->name)); @@ -1138,7 +1133,7 @@ texture_t *Mod_LoadWall(char *name, char *sname) wal->height = image_height; } else - tn.base = R_LoadReplacementTexture(wal->name, loadname, IF_NOALPHA); + tn.base = R_LoadReplacementTexture(wal->name, loadname, imageflags); wal->width = LittleLong(wal->width); wal->height = LittleLong(wal->height); @@ -1161,7 +1156,7 @@ texture_t *Mod_LoadWall(char *name, char *sname) if (!TEXVALID(tn.base)) { - tn.base = R_LoadReplacementTexture(wal->name, "bmodels", IF_NOALPHA); + tn.base = R_LoadReplacementTexture(wal->name, "bmodels", imageflags); if (!TEXVALID(tn.base)) { if (!wal->offsets[0]) @@ -1170,7 +1165,7 @@ texture_t *Mod_LoadWall(char *name, char *sname) CL_CheckOrEnqueDownloadFile(name, NULL, 0); return NULL; } - tn.base = R_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, IF_NOALPHA|IF_NOGAMMA); + tn.base = R_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, imageflags); } } @@ -1267,7 +1262,7 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac } snprintf (name, sizeof(name), "textures/%s.wal", in->texture); - out->texture = Mod_LoadWall (name, sname); + out->texture = Mod_LoadWall (name, sname, (out->flags&TEX_SPECIAL)?0:IF_NOALPHA); if (!out->texture || !out->texture->width || !out->texture->height) { out->texture = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t) + 16*16+8*8+4*4+2*2); @@ -1504,7 +1499,7 @@ qboolean CMod_LoadNodes (lump_t *l) out->minmaxs[3+j] = LittleShort (in->maxs[j]); } - out->plane = map_planes + LittleLong(in->planenum); + out->plane = loadmodel->planes + LittleLong(in->planenum); out->firstsurface = LittleShort (in->firstface); out->numsurfaces = LittleShort (in->numfaces); @@ -1595,9 +1590,9 @@ qboolean CMod_LoadLeafs (lump_t *l) return false; } // need to save space for box planes - if (count > MAX_Q2MAP_PLANES) + if (count > sizeof(map_leafs)/sizeof(map_leafs[0])) { - Con_Printf (CON_ERROR "Map has too many planes\n"); + Con_Printf (CON_ERROR "Map has too many leafs\n"); return false; } @@ -1685,17 +1680,13 @@ qboolean CMod_LoadPlanes (lump_t *l) return false; } // need to save space for box planes - if (count >= MAX_Q2MAP_PLANES) + if (count >= SANITY_MAX_MAP_PLANES) { - Con_Printf (CON_ERROR "Map has too many planes\n"); + Con_Printf (CON_ERROR "Map has too many planes (%i)\n", count); return false; } - out = map_planes; - numplanes = count; - - - loadmodel->planes = out; + loadmodel->planes = out = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * count); loadmodel->numplanes = count; for ( i=0 ; ifilelen / sizeof(*in); // need to save space for box planes - if (count > MAX_Q2MAP_BRUSHSIDES) + if (count > SANITY_MAX_MAP_BRUSHSIDES) { - Con_Printf (CON_ERROR "Map has too many planes\n"); + Con_Printf (CON_ERROR "Map has too many brushsides (%i)\n", count); return false; } - out = map_brushsides; + out = map_brushsides = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * count); numbrushsides = count; for ( i=0 ; iplanenum); - out->plane = &map_planes[num]; + out->plane = &loadmodel->planes[num]; j = LittleShort (in->texinfo); if (j >= numtexinfo) { @@ -3185,17 +3176,14 @@ qboolean CModQ3_LoadPlanes (lump_t *l) return false; } count = l->filelen / sizeof(*in); - out = map_planes;//Hunk_AllocName ( count*2*sizeof(*out), loadname); - if (count > MAX_MAP_PLANES) + if (count > SANITY_MAX_MAP_PLANES) { - Con_Printf (CON_ERROR "Too many planes on map\n"); + Con_Printf (CON_ERROR "Too many planes on map (%i)\n", count); return false; } - numplanes = count; - - loadmodel->planes = out; + loadmodel->planes = out = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * count); loadmodel->numplanes = count; for ( i=0 ; ifilelen / sizeof(*in); // need to save space for box planes - if (count > MAX_Q2MAP_BRUSHSIDES) + if (count > SANITY_MAX_MAP_BRUSHSIDES) { - Con_Printf (CON_ERROR "Map has too many planes\n"); + Con_Printf (CON_ERROR "Map has too many brushsides (%i)\n", count); return false; } - out = map_brushsides; + out = map_brushsides = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * count); numbrushsides = count; for ( i=0 ; iplanenum); - out->plane = &map_planes[num]; + out->plane = &loadmodel->planes[num]; j = LittleLong (in->texinfo); if (j >= numtexinfo) { @@ -3307,19 +3295,19 @@ qboolean CModRBSP_LoadBrushSides (lump_t *l) count = l->filelen / sizeof(*in); // need to save space for box planes - if (count > MAX_Q2MAP_BRUSHSIDES) + if (count > SANITY_MAX_MAP_BRUSHSIDES) { - Con_Printf (CON_ERROR "Map has too many planes\n"); + Con_Printf (CON_ERROR "Map has too many brushsides (%i)\n", count); return false; } - out = map_brushsides; + out = map_brushsides = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * count); numbrushsides = count; for ( i=0 ; iplanenum); - out->plane = &map_planes[num]; + out->plane = &loadmodel->planes[num]; j = LittleLong (in->texinfo); if (j >= numtexinfo) { @@ -3798,7 +3786,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c void *buildcookie = NULL; // free old stuff - numplanes = 0; numleafs = 0; numcmodels = 0; numvisibility = 0; @@ -3921,7 +3908,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c noerrors = noerrors && CModQ3_LoadShaders (&header.lumps[Q3LUMP_SHADERS]); noerrors = noerrors && CModQ3_LoadPlanes (&header.lumps[Q3LUMP_PLANES]); noerrors = noerrors && CModQ3_LoadLeafBrushes (&header.lumps[Q3LUMP_LEAFBRUSHES]); - noerrors = noerrors && CModQ3_LoadBrushes (&header.lumps[Q3LUMP_BRUSHES]); if (header.version == 1) { noerrors = noerrors && CModRBSP_LoadBrushSides (&header.lumps[Q3LUMP_BRUSHSIDES]); @@ -3932,6 +3918,7 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c noerrors = noerrors && CModQ3_LoadBrushSides (&header.lumps[Q3LUMP_BRUSHSIDES]); noerrors = noerrors && CModQ3_LoadVertexes (&header.lumps[Q3LUMP_DRAWVERTS]); } + noerrors = noerrors && CModQ3_LoadBrushes (&header.lumps[Q3LUMP_BRUSHES]); if (header.version == 1) noerrors = noerrors && CModRBSP_LoadFaces (&header.lumps[Q3LUMP_SURFACES]); else @@ -4084,8 +4071,8 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c noerrors = noerrors && CMod_LoadLeafBrushes (&header.lumps[Q2LUMP_LEAFBRUSHES]); noerrors = noerrors && CMod_LoadPlanes (&header.lumps[Q2LUMP_PLANES]); noerrors = noerrors && CMod_LoadVisibility (&header.lumps[Q2LUMP_VISIBILITY]); - noerrors = noerrors && CMod_LoadBrushes (&header.lumps[Q2LUMP_BRUSHES]); noerrors = noerrors && CMod_LoadBrushSides (&header.lumps[Q2LUMP_BRUSHSIDES]); + noerrors = noerrors && CMod_LoadBrushes (&header.lumps[Q2LUMP_BRUSHES]); noerrors = noerrors && CMod_LoadSubmodels (&header.lumps[Q2LUMP_MODELS]); noerrors = noerrors && CMod_LoadLeafs (&header.lumps[Q2LUMP_LEAFS]); noerrors = noerrors && CMod_LoadNodes (&header.lumps[Q2LUMP_NODES]); @@ -4130,8 +4117,8 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c noerrors = noerrors && Mod_LoadMarksurfaces (&header.lumps[Q2LUMP_LEAFFACES], false); #endif noerrors = noerrors && CMod_LoadVisibility (&header.lumps[Q2LUMP_VISIBILITY]); - noerrors = noerrors && CMod_LoadBrushes (&header.lumps[Q2LUMP_BRUSHES]); noerrors = noerrors && CMod_LoadBrushSides (&header.lumps[Q2LUMP_BRUSHSIDES]); + noerrors = noerrors && CMod_LoadBrushes (&header.lumps[Q2LUMP_BRUSHES]); noerrors = noerrors && CMod_LoadSubmodels (&header.lumps[Q2LUMP_MODELS]); noerrors = noerrors && CMod_LoadLeafs (&header.lumps[Q2LUMP_LEAFS]); noerrors = noerrors && CMod_LoadNodes (&header.lumps[Q2LUMP_NODES]); @@ -4359,16 +4346,14 @@ void CM_InitBoxHull (void) box_model.hulls[0].available = true; box_model.nodes = ZG_Malloc(&box_model.memgroup, sizeof(mnode_t)*6); - box_planes = &map_planes[numplanes]; + box_planes = ZG_Malloc(&box_model.memgroup, sizeof(mplane_t)*12); if (numbrushes+1 > SANITY_MAX_MAP_BRUSHES - || numleafbrushes+1 > MAX_Q2MAP_LEAFBRUSHES - || numbrushsides+6 > MAX_Q2MAP_BRUSHSIDES - || numplanes+12 > MAX_Q2MAP_PLANES) + || numleafbrushes+1 > MAX_Q2MAP_LEAFBRUSHES) Host_Error ("Not enough room for box tree"); box_brush = &map_brushes[numbrushes]; box_brush->numsides = 6; - box_brush->brushside = &map_brushsides[numbrushsides]; + box_brush->brushside = ZG_Malloc(&box_model.memgroup, sizeof(q2cbrushside_t)*6); box_brush->contents = Q2CONTENTS_MONSTER; box_leaf = &map_leafs[numleafs]; @@ -4383,13 +4368,13 @@ void CM_InitBoxHull (void) side = i&1; // brush sides - s = &map_brushsides[numbrushsides+i]; - s->plane = map_planes + (numplanes+i*2+side); + s = &box_brush->brushside[i]; + s->plane = box_planes + (i*2+side); s->surface = &nullsurface; // nodes c = &box_model.nodes[i]; - c->plane = map_planes + (numplanes+i*2); + c->plane = box_planes + (i*2); c->childnum[side] = -1 - emptyleaf; if (i != 5) c->childnum[side^1] = box_headnode+i + 1; @@ -4478,7 +4463,7 @@ int CM_PointLeafnum_r (model_t *mod, vec3_t p, int num) int CM_PointLeafnum (model_t *mod, vec3_t p) { - if (!numplanes) + if (!mod || mod->needload) return 0; // sound may call this without map loaded return CM_PointLeafnum_r (mod, p, 0); } diff --git a/engine/common/q3common.c b/engine/common/q3common.c index 9f5478f52..e6a29b634 100644 --- a/engine/common/q3common.c +++ b/engine/common/q3common.c @@ -852,7 +852,7 @@ typedef struct { int bits; // bits > 0 --> unsigned integer // bits = 0 --> float value // bits < 0 --> signed integer -} field_t; +} q3field_t; // field declarations #ifdef MSG_SHOWNET @@ -874,7 +874,7 @@ typedef struct { // // entityState_t // -static const field_t esFieldTable[] = { +static const q3field_t esFieldTable[] = { ES_FIELD( pos.trTime, 32 ), ES_FIELD( pos.trBase[0], 0 ), ES_FIELD( pos.trBase[1], 0 ), @@ -945,7 +945,7 @@ returns false if the ent was removed. #ifndef SERVERONLY qboolean MSG_Q3_ReadDeltaEntity( const q3entityState_t *from, q3entityState_t *to, int number ) { - const field_t *field; + const q3field_t *field; int to_integer; int maxFieldNum; #ifdef MSG_SHOWNET @@ -1103,7 +1103,7 @@ MSG_WriteDeltaEntity #ifndef CLIENTONLY void MSGQ3_WriteDeltaEntity(sizebuf_t *msg, const q3entityState_t *from, const q3entityState_t *to, qboolean force) { - const field_t *field; + const q3field_t *field; int to_value; int to_integer; float to_float; @@ -1219,7 +1219,7 @@ void MSGQ3_WriteDeltaEntity(sizebuf_t *msg, const q3entityState_t *from, const q // // playerState_t // -static const field_t psFieldTable[] = { +static const q3field_t psFieldTable[] = { PS_FIELD( commandTime, 32 ), PS_FIELD( origin[0], 0 ), PS_FIELD( origin[1], 0 ), @@ -1283,7 +1283,7 @@ MSG_WriteDeltaPlayerstate #ifndef CLIENTONLY void MSGQ3_WriteDeltaPlayerstate(sizebuf_t *msg, const q3playerState_t *from, const q3playerState_t *to) { - const field_t *field; + const q3field_t *field; int to_value; float to_float; int to_integer; @@ -1462,7 +1462,7 @@ void MSGQ3_WriteDeltaPlayerstate(sizebuf_t *msg, const q3playerState_t *from, co #ifndef SERVERONLY void MSG_Q3_ReadDeltaPlayerstate( const q3playerState_t *from, q3playerState_t *to ) { - const field_t *field; + const q3field_t *field; int to_integer; int maxFieldNum; int bitmask; diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 31b74db6d..f3f9fdcc4 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -55,6 +55,7 @@ extern cvar_t gl_ati_truform; extern cvar_t r_vertexdlights; extern cvar_t mod_md3flags; extern cvar_t r_skin_overlays; +extern cvar_t r_globalskin_first, r_globalskin_count; #ifndef SERVERONLY static hashtable_t skincolourmapped; @@ -222,7 +223,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e *forcedtex = NULL; /*hexen2 feature: global skins */ - if (inf->numskins < 100 && e->skinnum >= 100 && e->skinnum < 110) + if (inf->numskins < e->skinnum && e->skinnum >= r_globalskin_first.ival && e->skinnum < r_globalskin_first.ival+r_globalskin_count.ival) { shader_t *s; s = R_RegisterSkin(va("gfx/skin%d.lmp", e->skinnum), NULL); diff --git a/engine/gl/gl_font.c b/engine/gl/gl_font.c index 7b449aebf..856f94ee2 100644 --- a/engine/gl/gl_font.c +++ b/engine/gl/gl_font.c @@ -638,6 +638,16 @@ static struct charcache_s *Font_TryLoadGlyph(font_t *f, CHARIDXTYPE charidx) } } #endif + + if (charidx == '\r') + { + if (f->chars[charidx|0xe000].texplane != INVALIDPLANE) + { + f->chars[charidx] = f->chars[charidx|0xe000]; + return &f->chars[charidx]; + } + } + return NULL; } diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index 00143f86b..a54a949e6 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -584,7 +584,13 @@ static void *Terr_ReadV1(heightmap_t *hm, hmsection_t *s, void *ptr, int len) Terr_GenerateWater(s, ds->waterheight); memset(s->holes, 0, sizeof(s->holes)); -// s->holes = ds->holes; + for (i = 0; i < 8*8; i++) + { + int x = (i & 7); + int y = (i>>3); + if (ds->holes & ((x>>1)|((y>>1)<<3))) + s->holes[y] |= 1u<texname[2], sizeof(ds.texname[2])); Q_strncpyz(ds.texname[3], s->texname[3], sizeof(ds.texname[3])); + for (i = 0; i < 8*8; i++) + { + int x = (i & 7); + int y = (i>>3); + if (s->holes[y] & (1u<>1)|((y>>1)<<3)); + } + lm = lightmap[s->lightmap]->lightmaps; lm += (s->lmy * HMLMSTRIDE + s->lmx) * lightmap_bytes; for (i = 0; i < SECTTEXSIZE; i++) diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index aa0777625..72e94bdca 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -10064,6 +10064,7 @@ typedef struct qboolean misc; } knowndef_t; #include "cl_master.h" +void Key_PrintQCDefines(vfsfile_t *f); void PR_DumpPlatform_f(void) { #ifdef SERVERONLY @@ -11051,6 +11052,13 @@ void PR_DumpPlatform_f(void) if (d != (ALL & ~targ)) VFS_PRINTF(f, "#endif\n"); + if (targ & (CS|MENU)) + { + VFS_PRINTF(f, "#if defined(CSQC) || defined(MENU)\n"); + Key_PrintQCDefines(f); + VFS_PRINTF(f, "#endif\n"); + } + VFS_PRINTF(f, "#pragma noref 0\n"); diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index db5a3a507..d526b4ea4 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -2390,7 +2390,7 @@ void SV_InitOperatorCommands (void) Cmd_AddCommand ("heartbeat", SV_Heartbeat_f); Cmd_AddCommand ("localinfo", SV_Localinfo_f); - Cmd_AddCommand ("gamedir", SV_Gamedir_f); + Cmd_AddCommandD ("gamedir", SV_Gamedir_f, "Change the current gamedir."); Cmd_AddCommand ("sv_gamedir", SV_Gamedir); Cmd_AddCommand ("sv_settimer", SV_SetTimer_f); Cmd_AddCommand ("stuffcmd", SV_StuffToClient_f); diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index f698f32fb..ceb822816 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -1349,27 +1349,36 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us else Info_SetValueForStarKey(svs.info, "*entfile", "", MAX_SERVERINFO_STRING); + if (!file) + file = sv.world.worldmodel->entities; + if (!file) + file = Z_StrDup(""); + switch(svs.gametype) { default: break; case GT_Q1QVM: case GT_PROGS: - sv.world.edict_size = PR_LoadEnts(svprogfuncs, file?file :sv.world.worldmodel->entities, spawnflagmask); + sv.world.edict_size = PR_LoadEnts(svprogfuncs, file, spawnflagmask); break; #ifdef Q2SERVER case GT_QUAKE2: - ge->SpawnEntities(sv.name, file?file :sv.world.worldmodel->entities, startspot?startspot:""); + ge->SpawnEntities(sv.name, file, startspot?startspot:""); break; #endif case GT_QUAKE3: break; #ifdef HLSERVER case GT_HALFLIFE: - SVHL_SpawnEntities(file?file :sv.world.worldmodel->entities); break; + SVHL_SpawnEntities(file); + break; #endif } + if (file != sv.world.worldmodel->entities) + Z_Free(file); + #ifndef SERVERONLY current_loading_size+=10; //SCR_BeginLoadingPlaque(); diff --git a/engine/server/svq2_ents.c b/engine/server/svq2_ents.c index c53a75943..4473dba30 100644 --- a/engine/server/svq2_ents.c +++ b/engine/server/svq2_ents.c @@ -570,7 +570,7 @@ void SVQ2_WriteFrameToClient (client_t *client, sizebuf_t *msg) MSG_WriteByte (msg, svcq2_frame); MSG_WriteLong (msg, sv.framenum); MSG_WriteLong (msg, lastframe); // what we are delta'ing from - MSG_WriteByte (msg, client->chokecount); // rate dropped packets + MSG_WriteByte (msg, client->chokecount&0xff); // rate dropped packets client->chokecount = 0; // send over the areabits diff --git a/engine/server/svq2_game.c b/engine/server/svq2_game.c index 306798dbb..32da15eb3 100644 --- a/engine/server/svq2_game.c +++ b/engine/server/svq2_game.c @@ -628,7 +628,13 @@ static int VARGS SVQ2_PointContents (vec3_t p) static cvar_t *VARGS Q2Cvar_Get (char *var_name, char *value, int flags) { - return Cvar_Get(var_name, value, flags, "Quake2 game variables"); + cvar_t *var = Cvar_Get(var_name, value, flags, "Quake2 game variables"); + if (!var) + { + Con_Printf("Q2Cvar_Get: variable %s not creatable\n", var_name); + return NULL; + } + return var; } cvar_t *VARGS Q2Cvar_Set (char *var_name, char *value) @@ -809,9 +815,6 @@ qboolean SVQ2_InitGameProgs(void) */ } - Cvar_ForceSet(Cvar_Get("game", "", CVAR_LATCH, "Q2 compat"), FS_GetGamedir()); - Cvar_ForceSet(Cvar_Get("basedir", "", CVAR_LATCH, "Q2 compat"), FS_GetBasedir()); - ge = (game_export_t *)SVQ2_GetGameAPI ((game_import_t*)&import); if (!ge)