change cl_idlefps default to 30.

minor tweak to prediction logic. bob logic will no longer stutter in eg freecs.
reworked config ordering. autoexec-after-fte.cfg will now be enforced.
reworked rawinput logic to avoid mouse button states getting stale due to separate mouse drivers when enabling the cursor.
fixed invalid commands getting silently ignored when not connected to a server.
allow execution of menu.dat from packages specified by the fmf.
FS_NativePath now responds properly to FS_GAME, and will return logical paths, instead of mimicing FS_GAMEONLY.
d3d9: fix tcgen skybox
qcc: fix crash with __out keyword.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5171 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-11-23 07:46:39 +00:00
parent eeaa949d5d
commit 4f73088dea
17 changed files with 272 additions and 121 deletions

View File

@ -58,7 +58,7 @@ cvar_t cl_pure = CVARD("cl_pure", "0", "0=standard quake rules.\n1=clients shou
cvar_t cl_sbar = CVARFC("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_Callback);
cvar_t cl_hudswap = CVARF("cl_hudswap", "0", CVAR_ARCHIVE);
cvar_t cl_maxfps = CVARF("cl_maxfps", "500", CVAR_ARCHIVE);
cvar_t cl_idlefps = CVARFD("cl_idlefps", "0", CVAR_ARCHIVE, "This is the maximum framerate to attain while idle/paused/unfocused.");
cvar_t cl_idlefps = CVARFD("cl_idlefps", "30", CVAR_ARCHIVE, "This is the maximum framerate to attain while idle/paused/unfocused.");
cvar_t cl_yieldcpu = CVARFD("cl_yieldcpu", "0", CVAR_ARCHIVE, "Attempt to yield between frames. This can resolve issues with certain drivers and background software, but can mean less consistant frame times. Will reduce power consumption/heat generation so should be set on laptops or similar (over-hot/battery powered) devices.");
cvar_t cl_nopext = CVARF("cl_nopext", "0", CVAR_ARCHIVE);
cvar_t cl_pext_mask = CVAR("cl_pext_mask", "0xffffffff");
@ -5776,11 +5776,11 @@ void CL_StartCinematicOrMenu(void)
idroq_depth = COM_FDepthFile("video/idlogo.roq", true); //q3
ol_depth = COM_FDepthFile("video/openinglogos.roq", true); //jk2
if (ol_depth != 0x7fffffff && (ol_depth <= idroq_depth || ol_depth <= idcin_depth))
if (ol_depth != FDEPTH_MISSING && (ol_depth <= idroq_depth || ol_depth <= idcin_depth))
Media_PlayFilm("video/openinglogos.roq", true);
else if (idroq_depth != 0x7fffffff && idroq_depth <= idcin_depth)
else if (idroq_depth != FDEPTH_MISSING && idroq_depth <= idcin_depth)
Media_PlayFilm("video/idlogo.roq", true);
else if (idcin_depth != 0x7fffffff)
else if (idcin_depth != FDEPTH_MISSING)
Media_PlayFilm("video/idlog.cin", true);
#ifndef NOLEGACY
@ -5899,12 +5899,12 @@ void CL_ExecInitialConfigs(char *resetcommand)
qrc = COM_FDepthFile("quake.rc", true); //q1
hrc = COM_FDepthFile("hexen.rc", true); //h2
if (qrc <= def && qrc <= hrc && qrc!=0x7fffffff)
if (qrc <= def && qrc <= hrc && qrc!=FDEPTH_MISSING)
{
Cbuf_AddText ("exec quake.rc\n", RESTRICT_LOCAL);
def = qrc;
}
else if (hrc <= def && hrc!=0x7fffffff)
else if (hrc <= def && hrc!=FDEPTH_MISSING)
{
Cbuf_AddText ("exec hexen.rc\n", RESTRICT_LOCAL);
def = hrc;
@ -5914,23 +5914,17 @@ void CL_ExecInitialConfigs(char *resetcommand)
int cfg = COM_FDepthFile ("config.cfg", true);
int q3cfg = COM_FDepthFile ("q3config.cfg", true);
// Cbuf_AddText ("bind ` toggleconsole\n", RESTRICT_LOCAL); //in case default.cfg does not exist. :(
if (def!=0x7fffffff)
if (def!=FDEPTH_MISSING)
Cbuf_AddText ("exec default.cfg\n", RESTRICT_LOCAL);
if (cfg <= def && cfg!=0x7fffffff)
Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL);
if (q3cfg <= def && q3cfg!=0x7fffffff)
if (q3cfg <= def && q3cfg!=FDEPTH_MISSING)
Cbuf_AddText ("exec q3config.cfg\n", RESTRICT_LOCAL);
if (def!=0x7fffffff)
else //if (cfg <= def && cfg!=0x7fffffff)
Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL);
// else
// Cbuf_AddText ("exec fte.cfg\n", RESTRICT_LOCAL);
if (def!=FDEPTH_MISSING)
Cbuf_AddText ("exec autoexec.cfg\n", RESTRICT_LOCAL);
}
qrc = COM_FDepthFile("fte.cfg", true);
if (qrc != 0x7fffffff)
{
if (qrc <= def) //don't use it if we're running a mod with a default.cfg that is in a stronger path than fte.cfg, as this indicates that fte.cfg is from fte/ and not $currentmod/.
Cbuf_AddText ("exec fte.cfg\n", RESTRICT_LOCAL);
else
Cbuf_AddText ("echo skipping fte.cfg from wrong gamedir\n", RESTRICT_LOCAL);
}
#endif
#ifdef QUAKESPYAPI
if (COM_FCheckExists ("frontend.cfg"))

View File

@ -862,6 +862,7 @@ void CL_PredictMovePNum (int seat)
int fromframe, toframe;
outframe_t *backdate;
player_state_t *fromstate, *tostate, framebuf[2]; //need two framebufs so we can interpolate between two states.
static player_state_t nullstate;
usercmd_t *cmdfrom = NULL, *cmdto = NULL;
double fromtime, totime;
int oldphysent;
@ -1114,6 +1115,12 @@ void CL_PredictMovePNum (int seat)
break;
}
}
if (i == pe->num_entities && pv->nolocalplayer)
{
fromstate = &nullstate;
nopred = true;
}
pe = &cl.inframes[toframe & UPDATE_MASK].packet_entities;
for (i = 0; i < pe->num_entities; i++)
{
@ -1137,8 +1144,17 @@ void CL_PredictMovePNum (int seat)
break;
}
}
if (i == pe->num_entities && pv->nolocalplayer)
{
tostate = &nullstate;
nopred = true;
}
if (pv->nolocalplayer && trackent < cl.maxlerpents)
{
le = &cl.lerpents[trackent];
if (le->sequence != cl.lerpentssequence)
nopred = true; //err, guys, this guy ain't valid... we don't know who we are! no point predicting.
}
}
// predict forward until cl.time <= to->senttime

View File

@ -1906,7 +1906,7 @@ void SCR_DrawLoading (qboolean opaque)
int qdepth = COM_FDepthFile(qname, true);
int h2depth = COM_FDepthFile("gfx/menu/loading.lmp", true);
if (!(qdepth < h2depth || h2depth > 0xffffff))
if (!(qdepth < h2depth || h2depth > FDEPTH_MISSING))
{ //hexen2 files.
//hexen2 has some fancy sliders built into its graphics in specific places. so this is messy.
pic = R2D_SafeCachePic ("gfx/menu/loading.lmp");

View File

@ -573,7 +573,7 @@ void IN_Commands(void)
void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frametime)
{
int mx, my;
float mx, my;
double mouse_x, mouse_y, mouse_deltadist;
int mfwt;
qboolean strafe_x, strafe_y;
@ -658,8 +658,8 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame
//if they're strafing, calculate the speed to move at based upon their displacement
if (mouse->held)
{
mx = mouse->oldpos[0] - (vid.pixelwidth*3)/4;
my = mouse->oldpos[1] - (vid.pixelheight*3)/4;
mx = mouse->oldpos[0] - (vid.pixelwidth*3)/4.0;
my = mouse->oldpos[1] - (vid.pixelheight*3)/4.0;
//mx = (mouse->oldpos[0] - mouse->heldpos[0])*0.1;
//my = (mouse->oldpos[1] - mouse->heldpos[1])*0.1;
@ -673,7 +673,7 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame
if (m_touchmajoraxis.ival)
{
//major axis only
if (abs(mx) > abs(my))
if (fabs(mx) > fabs(my))
my = 0;
else
mx = 0;

View File

@ -470,14 +470,6 @@ static void INS_ActivateMouse (void)
#endif
{
#ifdef USINGRAWINPUT
if (rawmicecount > 0)
{
if (INS_RawInput_MouseRegister())
{
Con_SafePrintf("Raw input: unable to register raw input for mice, deinitializing\n");
INS_RawInput_MouseDeRegister();
}
}
if (rawkbdcount > 0)
{
if (INS_RawInput_KeyboardRegister())
@ -549,8 +541,8 @@ static void INS_DeactivateMouse (void)
#endif
{
#ifdef USINGRAWINPUT
if (rawmicecount > 0)
INS_RawInput_MouseDeRegister();
// if (rawmicecount > 0)
// INS_RawInput_MouseDeRegister();
#endif
if (restore_spi)
@ -906,7 +898,8 @@ int INS_RawInput_MouseRegister(void)
//register to get wm_input messages
Rid.usUsagePage = 0x01;
Rid.usUsage = 0x02;
Rid.dwFlags = RIDEV_NOLEGACY; // adds HID mouse and also ignores legacy mouse messages
//note: we don't exclude legacy events any more. while we don't really want them, we also don't want to get confused about click states. this way we can track the states properly without breaking.
Rid.dwFlags = 0;//RIDEV_NOLEGACY; // adds HID mouse and also ignores legacy mouse messages
Rid.hwndTarget = NULL;
// Register to receive the WM_INPUT message for any change in mouse (buttons, wheel, and movement will all generate the same message)
@ -1201,6 +1194,18 @@ void INS_ReInit (void)
INS_StartupMouse ();
INS_StartupJoystick ();
// INS_ActivateMouse();
#ifdef USINGRAWINPUT
//mouse rawinput is always enabled, because its too messy otherwise.
if (rawmicecount > 0)
{
if (INS_RawInput_MouseRegister())
{
Con_SafePrintf("Raw input: unable to register raw input for mice, deinitializing\n");
INS_RawInput_MouseDeRegister();
}
}
#endif
}
void INS_Init (void)
@ -1302,7 +1307,10 @@ void INS_MouseEvent (int mstate)
if ( (mstate & (1<<i)) &&
!(sysmouse.oldbuttons & (1<<i)) )
{
IN_KeyEvent (sysmouse.qdeviceid, true, K_MOUSE1 + i, 0);
if (!rawmicecount)
IN_KeyEvent (sysmouse.qdeviceid, true, K_MOUSE1 + i, 0);
else
mstate &= ~(1<<i);
}
if ( !(mstate & (1<<i)) &&
@ -1508,76 +1516,82 @@ void INS_RawInput_MouseRead(void)
multicursor_active[mouse->qdeviceid&7] = 0;
// movement
if (raw->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
if (vid.activeapp)
{
if (in_simulatemultitouch.ival)
// movement
if (raw->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
{
multicursor_active[mouse->qdeviceid&7] = true;
multicursor_x[mouse->qdeviceid&7] = raw->data.mouse.lLastX;
multicursor_y[mouse->qdeviceid&7] = raw->data.mouse.lLastY;
if (in_simulatemultitouch.ival)
{
multicursor_active[mouse->qdeviceid&7] = true;
multicursor_x[mouse->qdeviceid&7] = raw->data.mouse.lLastX;
multicursor_y[mouse->qdeviceid&7] = raw->data.mouse.lLastY;
}
IN_MouseMove(mouse->qdeviceid, true, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
}
IN_MouseMove(mouse->qdeviceid, true, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
}
else // RELATIVE
{
if (in_simulatemultitouch.ival)
else if (mouseactive)// RELATIVE
{
multicursor_active[mouse->qdeviceid&7] = true;
multicursor_x[mouse->qdeviceid&7] += raw->data.mouse.lLastX;
multicursor_y[mouse->qdeviceid&7] += raw->data.mouse.lLastY;
multicursor_x[mouse->qdeviceid&7] = bound(0, multicursor_x[mouse->qdeviceid&7], vid.pixelwidth);
multicursor_y[mouse->qdeviceid&7] = bound(0, multicursor_y[mouse->qdeviceid&7], vid.pixelheight);
IN_MouseMove(mouse->qdeviceid, true, multicursor_x[mouse->qdeviceid&7], multicursor_y[mouse->qdeviceid&7], 0, 0);
if (in_simulatemultitouch.ival)
{
multicursor_active[mouse->qdeviceid&7] = true;
multicursor_x[mouse->qdeviceid&7] += raw->data.mouse.lLastX;
multicursor_y[mouse->qdeviceid&7] += raw->data.mouse.lLastY;
multicursor_x[mouse->qdeviceid&7] = bound(0, multicursor_x[mouse->qdeviceid&7], vid.pixelwidth);
multicursor_y[mouse->qdeviceid&7] = bound(0, multicursor_y[mouse->qdeviceid&7], vid.pixelheight);
IN_MouseMove(mouse->qdeviceid, true, multicursor_x[mouse->qdeviceid&7], multicursor_y[mouse->qdeviceid&7], 0, 0);
}
else
IN_MouseMove(mouse->qdeviceid, false, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
}
else
IN_MouseMove(mouse->qdeviceid, false, raw->data.mouse.lLastX, raw->data.mouse.lLastY, 0, 0);
}
// buttons
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE1, 0);
// button presses
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE1, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE2, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE3, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE4, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE5, 0);
// mouse wheel
if (raw->data.mouse.usButtonFlags & RI_MOUSE_WHEEL)
{ // If the current message has a mouse_wheel message
if ((SHORT)raw->data.mouse.usButtonData > 0)
{
IN_KeyEvent(mouse->qdeviceid, true, K_MWHEELUP, 0);
IN_KeyEvent(mouse->qdeviceid, false, K_MWHEELUP, 0);
}
if ((SHORT)raw->data.mouse.usButtonData < 0)
{
IN_KeyEvent(mouse->qdeviceid, true, K_MWHEELDOWN, 0);
IN_KeyEvent(mouse->qdeviceid, false, K_MWHEELDOWN, 0);
}
}
}
//button releass
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_UP)
IN_KeyEvent(mouse->qdeviceid, false, K_MOUSE1, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE2, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_UP)
IN_KeyEvent(mouse->qdeviceid, false, K_MOUSE2, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE3, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_UP)
IN_KeyEvent(mouse->qdeviceid, false, K_MOUSE3, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE4, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_UP)
IN_KeyEvent(mouse->qdeviceid, false, K_MOUSE4, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN)
IN_KeyEvent(mouse->qdeviceid, true, K_MOUSE5, 0);
if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_UP)
IN_KeyEvent(mouse->qdeviceid, false, K_MOUSE5, 0);
// mouse wheel
if (raw->data.mouse.usButtonFlags & RI_MOUSE_WHEEL)
{ // If the current message has a mouse_wheel message
if ((SHORT)raw->data.mouse.usButtonData > 0)
{
IN_KeyEvent(mouse->qdeviceid, true, K_MWHEELUP, 0);
IN_KeyEvent(mouse->qdeviceid, false, K_MWHEELUP, 0);
}
if ((SHORT)raw->data.mouse.usButtonData < 0)
{
IN_KeyEvent(mouse->qdeviceid, true, K_MWHEELDOWN, 0);
IN_KeyEvent(mouse->qdeviceid, false, K_MWHEELDOWN, 0);
}
}
// extra buttons
tbuttons = raw->data.mouse.ulRawButtons & RI_RAWBUTTON_MASK;
for (j=6 ; j<rawmice[i].numbuttons ; j++)
{
if ( (tbuttons & (1<<j)) && !(rawmice[i].oldbuttons & (1<<j)) )
{
IN_KeyEvent (mouse->qdeviceid, true, K_MOUSE1 + j, 0);
if (vid.activeapp)
IN_KeyEvent (mouse->qdeviceid, true, K_MOUSE1 + j, 0);
}
if ( !(tbuttons & (1<<j)) && (rawmice[i].oldbuttons & (1<<j)) )

View File

@ -196,6 +196,8 @@ keyname_t keynames[] =
{"MOUSE8", K_MOUSE8},
{"MOUSE9", K_MOUSE9},
{"MOUSE10", K_MOUSE10},
{"MWHEELUP", K_MWHEELUP},
{"MWHEELDOWN", K_MWHEELDOWN},
{"LWIN", K_LWIN},
{"RWIN", K_RWIN},
@ -246,9 +248,6 @@ keyname_t keynames[] =
{"PAUSE", K_PAUSE},
{"MWHEELUP", K_MWHEELUP},
{"MWHEELDOWN", K_MWHEELDOWN},
{"PRINTSCREEN", K_PRINTSCREEN},
{"CAPSLOCK", K_CAPSLOCK},
{"SCROLLLOCK", K_SCRLCK},
@ -512,6 +511,8 @@ int Con_ExecuteLine(console_t *con, char *line)
waschat = true;
Cbuf_AddText (line, RESTRICT_LOCAL);
}
else
exec = line; //exec it anyway. let the cbuf give the error message in case its 'INVALID;VALID'
}
if (exec)

View File

@ -1131,7 +1131,7 @@ void PM_LoadPackages(searchpath_t **oldpaths, const char *parent_pure, const cha
if (d->dtype == DEP_FILE)
{
Q_snprintfz(temp, sizeof(temp), "%s/%s", p->gamedir, d->name);
FS_AddHashedPackage(oldpaths, parent_pure, parent_logical, search, loadstuff, temp, p->qhash, NULL);
FS_AddHashedPackage(oldpaths, parent_pure, parent_logical, search, loadstuff, temp, p->qhash, NULL, SPF_COPYPROTECTED|SPF_UNTRUSTED);
}
}
}

View File

@ -2816,11 +2816,13 @@ qboolean MP_Keydown(int key, int unicode, unsigned int devid)
{
void *pr_globals = PR_globals(menu_world.progs, PR_CURRENT);
G_FLOAT(OFS_PARM0) = CSIE_KEYDOWN;
G_FLOAT(OFS_PARM1) = MP_TranslateFTEtoQCCodes(key);
G_FLOAT(OFS_PARM2) = unicode;
G_FLOAT(OFS_PARM1) = qcinput_scan = MP_TranslateFTEtoQCCodes(key);
G_FLOAT(OFS_PARM2) = qcinput_unicode = unicode;
G_FLOAT(OFS_PARM3) = devid;
PR_ExecuteProgram(menu_world.progs, mp_inputevent_function);
result = G_FLOAT(OFS_RETURN);
qcinput_scan = 0;
qcinput_unicode = 0;
}
else if (mp_keydown_function)
{

View File

@ -642,7 +642,50 @@ void Cmd_Exec_f (void)
COM_DefaultExtension(name, ".cfg", sizeof(name));
}
else
{
Q_strncpyz(name, Cmd_Argv(1), sizeof(name));
#ifndef QUAKETC
//fte writes to a different config file from that specified by the quake.rc, to avoid conflicts.
//so make sure that fte's settings override those from whatever other engine that wrote the legacy config.cfg file.
if (!strcmp(name, "config.cfg") || !strcmp(name, "q3config.cfg"))
{
int cfgdepth = COM_FDepthFile(name, true);
int defdepth = COM_FDepthFile("default.cfg", true);
Cbuf_InsertText("exec fte.cfg", Cmd_ExecLevel, true);
if (defdepth < cfgdepth && cfgdepth != FDEPTH_MISSING)
{
if (cl_warncmd.ival)
{
char fulldefault[MAX_OSPATH];
char fullconfig[MAX_OSPATH];
*fulldefault = *fullconfig = 0;
FS_NativePath("default.cfg", FS_GAME, fulldefault, sizeof(fulldefault));
FS_NativePath(name, FS_GAME, fullconfig, sizeof(fullconfig));
Con_Printf("Refusing to execute \"%s\", superceded by %s\n", fullconfig, fulldefault);
}
return;
}
}
else if (!strcmp(name, "fte.cfg"))
{
int cfgdepth = COM_FDepthFile(name, true);
int defdepth = COM_FDepthFile("default.cfg", true);
if (defdepth < cfgdepth && cfgdepth != FDEPTH_MISSING)
{
if (cl_warncmd.ival)
{
char fulldefault[MAX_OSPATH];
char fullconfig[MAX_OSPATH];
*fulldefault = *fullconfig = 0;
FS_NativePath("default.cfg", FS_GAME, fulldefault, sizeof(fulldefault));
FS_NativePath(name, FS_GAME, fullconfig, sizeof(fullconfig));
Con_Printf("Refusing to execute \"%s\", superceded by %s\n", fullconfig, fulldefault);
}
return;
}
}
#endif
}
if (!strncmp(name, "../", 3) || !strncmp(name, "..\\", 3) || !strncmp(name, "./", 2) || !strncmp(name, ".\\", 2))
{ //filesystem will correctly block this (and more), but it does look dodgy when servers try doing this dodgy shit anyway.
@ -683,7 +726,7 @@ void Cmd_Exec_f (void)
s+=3;
}
if (!strcmp(name, "config.cfg") || !strcmp(name, "fte.cfg"))
if (!strcmp(name, "config.cfg") || !strcmp(name, "q3config.cfg") || !strcmp(name, "fte.cfg"))
{
//if the config is from id1 and the default.cfg was from some mod, make sure the default.cfg overrides the config.
//we won't just exec the default instead, because we can at least retain things which are not specified (ie: a few binds)

View File

@ -522,6 +522,7 @@ char *FS_GetPackNames(char *buffer, int buffersize, int referencedonly, qboolean
qboolean FS_GenCachedPakName(const char *pname, const char *crc, char *local, int llen); //returns false if the name is invalid.
void FS_ReferenceControl(unsigned int refflag, unsigned int resetflags);
#define FDEPTH_MISSING 0x7fffffff
#define COM_FDepthFile(filename,ignorepacks) FS_FLocateFile(filename,FSLF_DONTREFERENCE|FSLF_DEEPONFAILURE|(ignorepacks?0:FSLF_DEPTH_INEXPLICIT), NULL)
#define COM_FCheckExists(filename) FS_FLocateFile(filename,FSLF_IFFOUND, NULL)

View File

@ -530,7 +530,7 @@ static qboolean FS_Manifest_ParseTokens(ftemanifest_t *man)
else if (!Q_strcasecmp(cmd, "install"))
{
if (man->installupd)
Z_StrCat(&man->defaultoverrides, va(";%s", Cmd_Args()));
Z_StrCat(&man->installupd, va(";%s", Cmd_Argv(1)));
else
man->installupd = Z_StrDup(Cmd_Argv(1));
}
@ -1661,6 +1661,7 @@ vfsfile_t *VFS_Filter(const char *filename, vfsfile_t *handle)
qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, char *out, int outlen)
{
flocation_t loc;
char *last;
int i;
char cleanname[MAX_QPATH];
@ -1694,8 +1695,14 @@ qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, char *out
switch (relativeto)
{
case FS_GAME: //this is really for diagnostic type stuff...
if (FS_FLocateFile(fname, FSLF_IFFOUND, &loc))
{
snprintf(out, outlen, "%s/%s", loc.search->logicalpath, fname);
break;
}
//fallthrough
case FS_GAMEONLY:
case FS_GAME:
if (com_homepathenabled)
snprintf(out, outlen, "%s%s/%s", com_homepath, gamedirfile, fname);
else
@ -2388,7 +2395,7 @@ searchpathfuncs_t *FS_OpenPackByExtension(vfsfile_t *f, const char *pakname)
}
//
void FS_AddHashedPackage(searchpath_t **oldpaths, const char *parentpath, const char *logicalpaths, searchpath_t *search, unsigned int loadstuff, const char *pakpath, const char *qhash, const char *pakprefix)
void FS_AddHashedPackage(searchpath_t **oldpaths, const char *parentpath, const char *logicalpaths, searchpath_t *search, unsigned int loadstuff, const char *pakpath, const char *qhash, const char *pakprefix, unsigned int packflags)
{
searchpathfuncs_t *handle;
searchpath_t *oldp;
@ -2481,7 +2488,7 @@ void FS_AddHashedPackage(searchpath_t **oldpaths, const char *parentpath, const
}
}
if (handle)
FS_AddPathHandle(oldpaths, pakpath, lname, handle, pakprefix, SPF_COPYPROTECTED|SPF_UNTRUSTED|keptflags, (unsigned int)-1);
FS_AddPathHandle(oldpaths, pakpath, lname, handle, pakprefix, packflags|keptflags, (unsigned int)-1);
}
return;
}
@ -2504,7 +2511,7 @@ static void FS_AddManifestPackages(searchpath_t **oldpaths, const char *purepath
if (palen > ptlen && (fs_manifest->package[i].path[ptlen] == '/' || fs_manifest->package[i].path[ptlen] == '\\' )&& !strncmp(purepath, fs_manifest->package[i].path, ptlen))
{
Q_snprintfz(qhash, sizeof(qhash), "%#x", fs_manifest->package[i].crc);
FS_AddHashedPackage(oldpaths,purepath,logicalpaths,search,loadstuff, fs_manifest->package[i].path,fs_manifest->package[i].crcknown?qhash:NULL,fs_manifest->package[i].prefix);
FS_AddHashedPackage(oldpaths,purepath,logicalpaths,search,loadstuff, fs_manifest->package[i].path,fs_manifest->package[i].crcknown?qhash:NULL,fs_manifest->package[i].prefix, SPF_COPYPROTECTED|(fs_manifest->security==MANIFEST_SECURITY_NOT?SPF_UNTRUSTED:0));
}
}
}

View File

@ -68,7 +68,7 @@ int FS_RegisterFileSystemType(void *module, const char *extension, searchpathfun
void FS_UnRegisterFileSystemType(int idx);
void FS_UnRegisterFileSystemModule(void *module);
void FS_AddHashedPackage(searchpath_t **oldpaths, const char *parent_pure, const char *parent_logical, searchpath_t *search, unsigned int loadstuff, const char *pakpath, const char *qhash, const char *pakprefix);
void FS_AddHashedPackage(searchpath_t **oldpaths, const char *parent_pure, const char *parent_logical, searchpath_t *search, unsigned int loadstuff, const char *pakpath, const char *qhash, const char *pakprefix, unsigned int packageflags);
void PM_LoadPackages(searchpath_t **oldpaths, const char *parent_pure, const char *parent_logical, searchpath_t *search, unsigned int loadstuff, int minpri, int maxpri);
void PM_EnumeratePlugins(void (*callback)(const char *name));
int PM_IsApplying(qboolean listsonly);

View File

@ -236,15 +236,16 @@ extern int be_maxpasses;
enum
{
D3D_VDEC_COL4B = 1<<0,
D3D_VDEC_ST0 = 1<<1,
D3D_VDEC_ST1 = 1<<2,
D3D_VDEC_ST2 = 1<<3,
D3D_VDEC_ST3 = 1<<4,
D3D_VDEC_NORM = 1<<5,
D3D_VDEC_SKEL = 1<<6,
D3D_VDEC_POS2 = 1<<7,
D3D_VDEC_MAX = 1<<8,
D3D_VDEC_COL4B = 1<<0,
D3D_VDEC_ST0 = 1<<1,
D3D_VDEC_ST1 = 1<<2,
D3D_VDEC_ST2 = 1<<3,
D3D_VDEC_ST3 = 1<<4,
D3D_VDEC_NORM = 1<<5,
D3D_VDEC_SKEL = 1<<6,
D3D_VDEC_POS2 = 1<<7,
D3D_VDEC_CM = 1<<8,
D3D_VDEC_MAX = 1<<9,
};
#define STRM_VERT 0
#define STRM_COL 1
@ -583,7 +584,10 @@ void D3D9BE_Reset(qboolean before)
{
decl[elements].Stream = STRM_TC0+tmu;
decl[elements].Offset = 0;
decl[elements].Type = D3DDECLTYPE_FLOAT2;
if (i & D3D_VDEC_CM)
decl[elements].Type = D3DDECLTYPE_FLOAT3;
else
decl[elements].Type = D3DDECLTYPE_FLOAT2;
decl[elements].Method = D3DDECLMETHOD_DEFAULT;
decl[elements].Usage = D3DDECLUSAGE_TEXCOORD;
decl[elements].UsageIndex = tmu;
@ -1292,6 +1296,25 @@ static float *tcgen(const shaderpass_t *pass, int cnt, float *dst, const mesh_t
}
}
static float *tcgen3(const shaderpass_t *pass, int cnt, float *dst, const mesh_t *mesh)
{
int i;
vecV_t *src;
switch (pass->tcgen)
{
default:
case TC_GEN_SKYBOX:
src = mesh->xyz_array;
for (i = 0; i < cnt; i++, dst += 3)
{
dst[0] = src[i][0] - r_refdef.vieworg[0];
dst[1] = r_refdef.vieworg[1] - src[i][1];
dst[2] = src[i][2] - r_refdef.vieworg[2];
}
return dst-cnt*3;
}
}
/*src and dst can be the same address when tcmods are chained*/
static void tcmod(const tcmod_t *tcmod, int cnt, const float *src, float *dst, const mesh_t *mesh)
{
@ -1412,6 +1435,41 @@ static void GenerateTCMods(const shaderpass_t *pass, float *dest)
}
}
}
static void GenerateTCMods3(const shaderpass_t *pass, float *dest)
{
mesh_t *mesh;
unsigned int mno;
// unsigned int fvertex = 0; //unused variable
int i;
float *src;
float *out;
for (mno = 0; mno < shaderstate.nummeshes; mno++)
{
mesh = shaderstate.meshlist[mno];
#if 0
out = dest + mesh->vbofirstvert*3;
#else
out = dest;
dest += mesh->numvertexes*3;
#endif
src = tcgen3(pass, mesh->numvertexes, out, mesh);
//tcgen might return unmodified info
/*if (pass->numtcmods)
{
for (i = 0; i < pass->numtcmods; i++)
{
tcmod3(&pass->tcmods[i], mesh->numvertexes, src, out, mesh);
src = out;
}
}
else */if (src != out)
{
memcpy(out, src, sizeof(vec2_t)*mesh->numvertexes);
}
}
}
//end texture coords
/*******************************************************************************************************************/
@ -1703,6 +1761,14 @@ static qboolean BE_DrawMeshChain_SetupPass(shaderpass_t *pass, unsigned int vert
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_TC0+tmu, shaderstate.batchvbo->texcoord.d3d.buff, shaderstate.batchvbo->texcoord.d3d.offs, sizeof(vbovdata_t)));
else if (shaderstate.batchvbo && pass[passno].tcgen == TC_GEN_LIGHTMAP && !pass[passno].numtcmods)
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_TC0+tmu, shaderstate.batchvbo->lmcoord[0].d3d.buff, shaderstate.batchvbo->lmcoord[0].d3d.offs, sizeof(vbovdata_t)));
else if (pass[passno].tcgen == TC_GEN_SKYBOX)
{
vdec |= D3D_VDEC_CM;
allocvertexbuffer(shaderstate.dynst_buff[tmu], shaderstate.dynst_size, &shaderstate.dynst_offs[tmu], &map, vertcount*sizeof(vec3_t));
GenerateTCMods3(pass+passno, map);
d3dcheck(IDirect3DVertexBuffer9_Unlock(shaderstate.dynst_buff[tmu]));
d3dcheck(IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_TC0+tmu, shaderstate.dynst_buff[tmu], shaderstate.dynst_offs[tmu] - vertcount*sizeof(vec3_t), sizeof(vec3_t)));
}
else
{
allocvertexbuffer(shaderstate.dynst_buff[tmu], shaderstate.dynst_size, &shaderstate.dynst_offs[tmu], &map, vertcount*sizeof(vec2_t));

View File

@ -4902,23 +4902,24 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"};\n"
"#ifdef VERTEX_SHADER\n"
"float3 e_eyepos;\n"
"float4x4 m_modelviewprojection;\n"
"v2f main (a2v inp)\n"
"{\n"
"v2f outp;\n"
"outp.pos = mul(m_modelviewprojection, inp.pos);\n"
"outp.texc= inp.pos - e_eyepos;\n"
"outp.texc.y = -outp.texc;\n"
"outp.texc = inp.pos.xyz;\n"
"return outp;\n"
"}\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"float3 e_eyepos;\n"
"sampler s_reflectcube;\n"
"float4 main (v2f inp) : COLOR0\n"
"{\n"
"return texCUBE(s_reflectcube, inp.texc);\n"
"float3 tc = inp.texc - e_eyepos.xyz;\n"
"tc.y = -tc.y;\n"
"return texCUBE(s_reflectcube, tc);\n"
"}\n"
"#endif\n"
},
@ -8505,6 +8506,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
#endif
#ifdef GLQUAKE
{QR_OPENGL, 110, "lpp_wall",
"!!ver 100 150\n"
"!!permu BUMP //for offsetmapping rather than bumpmapping (real bumps are handled elsewhere)\n"
"!!cvarf r_glsl_offsetmapping_scale\n"
"!!samps 2\n"

View File

@ -5304,6 +5304,8 @@ QCC_sref_t QCC_PR_GenerateFunctionCallRef (QCC_sref_t newself, QCC_sref_t func,
d.cast = type_vector;
}
d.cast = args[i].ref.cast;
if (!d.cast)
continue;
if (QCC_RemapTemp(args[i].firststatement, numstatements, args[i].ref, d))
{
@ -5352,6 +5354,8 @@ QCC_sref_t QCC_PR_GenerateFunctionCallRef (QCC_sref_t newself, QCC_sref_t func,
{
for (i = 0; i < parm && i < 2; i++)
{
if (!args[i].ref.cast)
continue;
args[i].ref.sym->referenced=true;
QCC_FreeTemp(args[i].ref);
}
@ -5415,7 +5419,7 @@ QCC_sref_t QCC_PR_GenerateFunctionCallRef (QCC_sref_t newself, QCC_sref_t func,
if (arglist[i]->readonly)
{
QCC_PR_ParseWarning(ERR_TYPEMISMATCHPARM, "Unanle to write to out argument\n");
QCC_PR_ParseWarning(ERR_TYPEMISMATCHPARM, "Unable to write to out argument\n");
continue;
}
if (parm>=MAX_PARMS)

View File

@ -1892,7 +1892,7 @@ void Q_InitProgs(void)
}
}
if (COM_FDepthFile("fteadd.dat", true)!=0x7fffffff)
if (COM_FDepthFile("fteadd.dat", true)!=FDEPTH_MISSING)
{
prnum = AddProgs("fteadd.dat");
if (prnum>=0)
@ -1913,21 +1913,21 @@ void Q_InitProgs(void)
switch (sv.world.worldmodel->fromgame) //spawn functions for - spawn funcs still come from the first progs found.
{
case fg_quake2:
if (COM_FDepthFile("q2bsp.dat", true)!=0x7fffffff)
if (COM_FDepthFile("q2bsp.dat", true)!=FDEPTH_MISSING)
prnum = AddProgs("q2bsp.dat");
break;
case fg_quake3:
if (COM_FDepthFile("q3bsp.dat", true)!=0x7fffffff)
if (COM_FDepthFile("q3bsp.dat", true)!=FDEPTH_MISSING)
prnum = AddProgs("q3bsp.dat");
else if (COM_FDepthFile("q2bsp.dat", true)!=0x7fffffff) //fallback
else if (COM_FDepthFile("q2bsp.dat", true)!=FDEPTH_MISSING) //fallback
prnum = AddProgs("q2bsp.dat");
break;
case fg_doom:
if (COM_FDepthFile("doombsp.dat", true)!=0x7fffffff)
if (COM_FDepthFile("doombsp.dat", true)!=FDEPTH_MISSING)
prnum = AddProgs("doombsp.dat");
break;
case fg_halflife:
if (COM_FDepthFile("hlbsp.dat", true)!=0x7fffffff)
if (COM_FDepthFile("hlbsp.dat", true)!=FDEPTH_MISSING)
prnum = AddProgs("hlbsp.dat");
break;

View File

@ -11,22 +11,23 @@
};
#ifdef VERTEX_SHADER
float3 e_eyepos;
float4x4 m_modelviewprojection;
v2f main (a2v inp)
{
v2f outp;
outp.pos = mul(m_modelviewprojection, inp.pos);
outp.texc= inp.pos - e_eyepos;
outp.texc.y = -outp.texc;
outp.texc = inp.pos.xyz;
return outp;
}
#endif
#ifdef FRAGMENT_SHADER
float3 e_eyepos;
sampler s_reflectcube;
float4 main (v2f inp) : COLOR0
{
return texCUBE(s_reflectcube, inp.texc);
float3 tc = inp.texc - e_eyepos.xyz;
tc.y = -tc.y;
return texCUBE(s_reflectcube, tc);
}
#endif