fix an issue with bloom by making sure a cvar is created for glsl to use (even if not directly used by the engine). this ensures there's no weirdness with defaults.

some fixes/tweaks for the nolegacy builds.
r_skybox works mid-map again.
tweak the qc debugger to not do infinite loops so easily...
rewrote chunks of the d3d11 renderer to support q3 shaders a little more correctly. now runs quake3 acceptably.
add explicit culldistance option for terrain/.map maps. pvs will effectively cut off anything beyond this distance.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4982 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2015-09-06 03:30:28 +00:00
parent 08b809de93
commit d078c85627
34 changed files with 1013 additions and 646 deletions

View file

@ -1440,7 +1440,7 @@ void CLDP_ParseDarkPlaces5Entities(void) //the things I do.. :o(
{
read = MSG_ReadShort();
if (msg_badread)
Host_EndGame("Corrupt entitiy message packet\n");
Host_EndGame("Corrupt entity message packet\n");
remove = !!(read&0x8000);
read&=0x7fff;
if (remove && !read)

View file

@ -5255,7 +5255,7 @@ void CL_ExecInitialConfigs(char *resetcommand)
COM_ParsePlusSets(true);
#ifdef QUAKETC
def = COM_FDepthFile("default.cfg", true);
Cbuf_AddText ("exec default.cfg\n", RESTRICT_LOCAL);
if (COM_FCheckExists ("config.cfg"))
Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL);
if (COM_FCheckExists ("autoexec.cfg"))

View file

@ -3068,9 +3068,11 @@ static qboolean P_LoadParticleSet(char *name, qboolean implicit)
}
else
{
#ifndef NOLEGACY
if (P_LoadParticleSet("high", true))
Con_Printf(CON_WARNING "Couldn't find particle description %s, loading 'high' instead\n", name);
else
#endif
{
Con_Printf(CON_WARNING "Couldn't find particle description %s\n", name);
return false;

View file

@ -81,7 +81,11 @@ cvar_t pr_csqc_memsize = CVAR("pr_csqc_memsize", "-1");
cvar_t cl_csqcdebug = CVAR("cl_csqcdebug", "0"); //prints entity numbers which arrive (so I can tell people not to apply it to players...)
cvar_t cl_nocsqc = CVAR("cl_nocsqc", "0");
cvar_t pr_csqc_coreonerror = CVAR("pr_csqc_coreonerror", "1");
#ifdef NOLEGACY
cvar_t pr_csqc_formenus = CVARF("pr_csqc_formenus", "1", CVAR_NOSET);
#else
cvar_t pr_csqc_formenus = CVAR("pr_csqc_formenus", "0");
#endif
extern cvar_t dpcompat_stats;
cvar_t dpcompat_corruptglobals = CVAR("dpcompat_corruptglobals", "0");
@ -4002,18 +4006,6 @@ static void QCBUILTIN PF_cs_droptofloor (pubprogfuncs_t *prinst, struct globalva
}
}
static void QCBUILTIN PF_cs_copyentity (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
csqcedict_t *in, *out;
in = (csqcedict_t*)G_EDICT(prinst, OFS_PARM0);
out = (csqcedict_t*)G_EDICT(prinst, OFS_PARM1);
memcpy(out->v, in->v, csqcentsize);
World_LinkEdict (&csqc_world, (wedict_t*)out, false);
}
static void QCBUILTIN PF_cl_getlight (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
vec3_t ambient, diffuse, dir;
@ -5352,9 +5344,9 @@ static struct {
{"con_input", PF_SubConInput, 394},
{"cvars_haveunsaved", PF_cvars_haveunsaved, 0},
{"entityprotection", PF_entityprotection, 0},
//400
{"copyentity", PF_cs_copyentity, 400}, // #400 void(entity from, entity to) copyentity (DP_QC_COPYENTITY)
{"copyentity", PF_copyentity, 400}, // #400 void(entity from, entity to) copyentity (DP_QC_COPYENTITY)
{"setcolors", PF_NoCSQC, 401}, // #401 void(entity cl, float colours) setcolors (DP_SV_SETCOLOR) (don't implement)
{"findchain", PF_cs_findchain, 402}, // #402 entity(string field, string match) findchain (DP_QC_FINDCHAIN)
{"findchainfloat", PF_cs_findchainfloat, 403}, // #403 entity(float fld, float match) findchainfloat (DP_QC_FINDCHAINFLOAT)

View file

@ -1918,6 +1918,7 @@ static struct {
{"bound", PF_bound, 45},
{"pow", PF_pow, 46},
{"logarithm", PF_Logarithm, 0},
{"entityprotection", PF_entityprotection, 0},
{"copyentity", PF_CopyEntity, 47},
{"fopen", PF_fopen, 48},
{"fclose", PF_fclose, 49},

View file

@ -597,8 +597,13 @@ static void QDECL R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
cvar_t r_rockettrail = CVARFC("r_rockettrail", "1", CVAR_SEMICHEAT, R_Rockettrail_Callback);
cvar_t r_grenadetrail = CVARFC("r_grenadetrail", "1", CVAR_SEMICHEAT, R_Grenadetrail_Callback);
cvar_t r_particlesystem = CVARFC("r_particlesystem", IFMINIMAL("classic", "script"), CVAR_SEMICHEAT|CVAR_ARCHIVE, R_ParticleSystem_Callback);
cvar_t r_particledesc = CVARAF("r_particledesc", "classic", "r_particlesdesc", CVAR_SEMICHEAT|CVAR_ARCHIVE);
#ifdef NOLEGACY
cvar_t r_particlesystem = CVARFC("r_particlesystem", "script", CVAR_SEMICHEAT|CVAR_ARCHIVE|CVAR_NOSET, R_ParticleSystem_Callback);
cvar_t r_particledesc = CVARAF("r_particledesc", "", "r_particlesdesc", CVAR_SEMICHEAT|CVAR_ARCHIVE);
#else
cvar_t r_particlesystem = CVARFC("r_particlesystem", IFMINIMAL("classic", "script"), CVAR_SEMICHEAT|CVAR_ARCHIVE, R_ParticleSystem_Callback);
cvar_t r_particledesc = CVARAF("r_particledesc", "classic", "r_particlesdesc", CVAR_SEMICHEAT|CVAR_ARCHIVE);
#endif
extern cvar_t r_bouncysparks;
extern cvar_t r_part_rain;
extern cvar_t r_bloodstains;

View file

@ -2682,9 +2682,9 @@ void Surf_BuildModelLightmaps (model_t *m)
currentmodel = m;
shift = Surf_LightmapShift(currentmodel);
if (*m->name == '*' && m->fromgame == fg_quake3) //FIXME: should be all bsp formats
if (m->submodelof && m->fromgame == fg_quake3) //FIXME: should be all bsp formats
{
if (!cl.model_precache[1] || cl.model_precache[1]->loadstate != MLS_LOADED)
if (m->submodelof->loadstate != MLS_LOADED)
return;
newfirst = cl.model_precache[1]->lightmaps.first;
}
@ -2744,7 +2744,7 @@ void Surf_BuildModelLightmaps (model_t *m)
int j;
unsigned char *src;
unsigned char *dst;
if (*m->name != '*')
if (!m->submodelof)
for (i = 0; i < m->lightmaps.count; i++)
{
if (lightmap[newfirst+i]->external)
@ -2757,6 +2757,7 @@ void Surf_BuildModelLightmaps (model_t *m)
if (lightmap_bgra && lightmap_bytes == 4)
{
for (j = min((m->lightdatasize-i*m->lightmaps.width*m->lightmaps.height*3)/3,m->lightmaps.width*m->lightmaps.height); j > 0; j--, dst += 4, src += 3)
//for (j = 0; j < m->lightmaps.width*m->lightmaps.height; j++, dst += 4, src += 3)
{
dst[0] = src[2];
dst[1] = src[1];
@ -2766,7 +2767,8 @@ void Surf_BuildModelLightmaps (model_t *m)
}
else if (!lightmap_bgra && lightmap_bytes == 4)
{
for (j = 0; j < m->lightmaps.width*m->lightmaps.height; j++, dst += 4, src += 3)
for (j = min((m->lightdatasize-i*m->lightmaps.width*m->lightmaps.height*3)/3,m->lightmaps.width*m->lightmaps.height); j > 0; j--, dst += 4, src += 3)
//for (j = 0; j < m->lightmaps.width*m->lightmaps.height; j++, dst += 4, src += 3)
{
dst[0] = src[0];
dst[1] = src[1];

View file

@ -38,6 +38,16 @@ extern int gl_anisotropy_factor;
void QDECL SCR_Viewsize_Callback (struct cvar_s *var, char *oldvalue);
void QDECL SCR_Fov_Callback (struct cvar_s *var, char *oldvalue);
void QDECL Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue);
void QDECL R_SkyBox_Changed (struct cvar_s *var, char *oldvalue)
{
if (qrenderer != QR_NONE && cl.worldmodel)
{
if (*var->string)
R_SetSky(var->string);
else
R_SetSky(cl.skyname);
}
}
#ifdef FTE_TARGET_WEB //webgl sucks too much to get a stable framerate without vsync.
cvar_t vid_vsync = CVARAF ("vid_wait", "1",
@ -138,8 +148,8 @@ cvar_t r_novis = CVARF ("r_novis", "0", CVAR_ARCHIVE);
cvar_t r_part_rain = CVARFD ("r_part_rain", "0",
CVAR_ARCHIVE,
"Enable particle effects to emit off of surfaces. Mainly used for weather or lava/slime effects.");
cvar_t r_skyboxname = SCVARF ("r_skybox", "",
CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM);
cvar_t r_skyboxname = CVARFC ("r_skybox", "",
CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM, R_SkyBox_Changed);
cvar_t r_softwarebanding_cvar = CVARFD ("r_softwarebanding", "0", CVAR_SHADERSYSTEM, "Utilise the Quake colormap in order to emulate 8bit software rendering. This results in banding as well as other artifacts that some believe adds character. Also forces nearest sampling on affected surfaces (palette indicies do not interpolate well).");
qboolean r_softwarebanding;
cvar_t r_speeds = SCVAR ("r_speeds", "0");

View file

@ -2589,7 +2589,7 @@ BOOL CopyFileU(const char *src, const char *dst, BOOL bFailIfExists)
}
//#define SVNREVISION 1
#if defined(SVNREVISION) && !defined(MINIMAL)
#if defined(SVNREVISION) && !defined(MINIMAL) && !defined(NOLEGACY)
#define SVNREVISIONSTR STRINGIFY(SVNREVISION)
#if defined(OFFICIAL_RELEASE)
#define UPD_BUILDTYPE "rel"
@ -2601,10 +2601,18 @@ BOOL CopyFileU(const char *src, const char *dst, BOOL bFailIfExists)
#define UPDATE_URL_TESTED UPDATE_URL_ROOT "autoup/"
#define UPDATE_URL_NIGHTLY UPDATE_URL_ROOT
#define UPDATE_URL_VERSION "%sversion.txt"
#ifdef _WIN64
#define UPDATE_URL_BUILD "%swin64/fte" EXETYPE "64.exe"
#ifdef NOLEGACY
#ifdef _WIN64
#define UPDATE_URL_BUILD "%snocompat64/fte" EXETYPE "64.exe"
#else
#define UPDATE_URL_BUILD "%snocompat/fte" EXETYPE ".exe"
#endif
#else
#define UPDATE_URL_BUILD "%swin32/fte" EXETYPE ".exe"
#ifdef _WIN64
#define UPDATE_URL_BUILD "%swin64/fte" EXETYPE "64.exe"
#else
#define UPDATE_URL_BUILD "%swin32/fte" EXETYPE ".exe"
#endif
#endif
#endif
#endif

View file

@ -1206,17 +1206,23 @@ void Editor_Draw(void)
*/
}
int QCLibEditor(pubprogfuncs_t *prfncs, const char *filename, int *line, int *statement, int nump, char **parms)
int QCLibEditor(pubprogfuncs_t *prfncs, const char *filename, int *line, int *statement, char *reason, pbool fatal)
{
const char *f1, *f2;
if (!pr_debugger.ival)
{
Con_Printf("Set %s to trace\n", pr_debugger.name);
if (fatal)
return DEBUG_TRACE_ABORT;
return DEBUG_TRACE_OFF; //get lost
}
//we can cope with no line info by displaying asm
if (editormodal || !statement)
{
if (fatal)
return DEBUG_TRACE_ABORT;
return DEBUG_TRACE_OFF; //whoops
}
if (qrenderer == QR_NONE)
{
@ -1305,7 +1311,6 @@ int QCLibEditor(pubprogfuncs_t *prfncs, const char *filename, int *line, int *st
executionblock = cursorblock;
if (!parms)
{
double oldrealtime = realtime;
editormodal = true;

View file

@ -92,7 +92,7 @@ cvar_t gameversion_max = CVARD("gameversion_max","", "gamecode version for serve
cvar_t fs_gamename = CVARAFD("com_fullgamename", NULL, "fs_gamename", CVAR_NOSET, "The filesystem is trying to run this game");
cvar_t fs_gamemanifest = CVARFD("fs_gamemanifest", "", CVAR_NOSET, "A small updatable file containing a description of the game, including download mirrors.");
cvar_t com_protocolname = CVARAD("com_protocolname", NULL, "com_gamename", "The protocol game name used for dpmaster queries. For compatibility with DP, you can set this to 'DarkPlaces-Quake' in order to be listed in DP's master server, and to list DP servers.");
cvar_t com_parseutf8 = CVARD("com_parseutf8", "0", "Interpret console messages/playernames/etc as UTF-8. Requires special fonts. -1=iso 8859-1. 0=quakeascii(chat uses high chars). 1=utf8, revert to ascii on decode errors. 2=utf8 ignoring errors"); //1 parse. 2 parse, but stop parsing that string if a char was malformed.
cvar_t com_parseutf8 = CVARD("com_parseutf8", "1", "Interpret console messages/playernames/etc as UTF-8. Requires special fonts. -1=iso 8859-1. 0=quakeascii(chat uses high chars). 1=utf8, revert to ascii on decode errors. 2=utf8 ignoring errors"); //1 parse. 2 parse, but stop parsing that string if a char was malformed.
cvar_t com_parseezquake = CVARD("com_parseezquake", "0", "Treat chevron chars from configs as a per-character flag. You should use this only for compat with nquake's configs.");
cvar_t com_highlightcolor = CVARD("com_highlightcolor", STRINGIFY(COLOR_RED), "ANSI colour to be used for highlighted text, used when com_parseutf8 is active.");
cvar_t com_nogamedirnativecode = CVARFD("com_nogamedirnativecode", "1", CVAR_NOTFROMSERVER, FULLENGINENAME" blocks all downloads of files with a .dll or .so extension, however other engines (eg: ezquake and fodquake) do not - this omission can be used to trigger delayed eremote exploits in any engine (including "DISTRIBUTION") which is later run from the same gamedir.\nQuake2, Quake3(when debugging), and KTX typically run native gamecode from within gamedirs, so if you wish to run any of these games you will need to ensure this cvar is changed to 0, as well as ensure that you don't run unsafe clients.\n");
@ -3097,6 +3097,29 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
str+=2;
continue;
}
else if (str[1] == '`' && str[2] == 'u' && str[3] == '8' && str[4] == ':' && !keepmarkup)
{
int l;
char temp[1024];
str += 5;
while(*str)
{
l = 0;
while (*str && l < sizeof(temp)-32 && !(str[0] == '`' && str[1] == '='))
temp[l++] = *str++;
//recurse
temp[l] = 0;
l = COM_ParseFunString(ext, temp, out, outsize, PFS_FORCEUTF8) - out;
outsize -= l;
out += l;
if (str[0] == '`' && str[1] == '=')
{
str+=2;
break;
}
}
continue;
}
else if (str[1] == 'a')
{
ext ^= CON_2NDCHARSETTEXT;
@ -3230,6 +3253,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
continue;
}
}
#ifndef NOLEGACY
else if (*str == '&' && str[1] == 'c' && !(flags & PFS_NOMARKUP))
{
// ezQuake color codes
@ -3289,29 +3313,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
}
continue;
}
else if (str[0] == '=' && str[1] == '`' && str[2] == 'u' && str[3] == '8' && str[4] == ':' && !keepmarkup)
{
int l;
char temp[1024];
str += 5;
while(*str)
{
l = 0;
while (*str && l < sizeof(temp)-32 && !(str[0] == '`' && str[1] == '='))
temp[l++] = *str++;
//recurse
temp[l] = 0;
l = COM_ParseFunString(ext, temp, out, outsize, PFS_FORCEUTF8) - out;
outsize -= l;
out += l;
if (str[0] == '`' && str[1] == '=')
{
str+=2;
break;
}
}
continue;
}
#endif
/*
else if ((str[0] == 'h' && str[1] == 't' && str[2] == 't' && str[3] == 'p' && str[4] == ':' && !linkstart && !(flags & (PFS_NOMARKUP|PFS_KEEPMARKUP))) ||

View file

@ -353,7 +353,7 @@ unsigned int COM_DeQuake(conchar_t chr);
void COM_BiDi_Shutdown(void);
//small macro to tell COM_ParseFunString (and related functions like con_printf) that the input is a utf-8 string.
#define U8(s) "=`u8:"s"`="
#define U8(s) "^`u8:"s"`="
//handles whatever charset is active, including ^U stuff.
unsigned int unicode_byteofsfromcharofs(const char *str, unsigned int charofs, qboolean markup);

View file

@ -2567,7 +2567,7 @@ void COM_Gamedir (const char *dir, const struct gamepacks *packagespaths)
FS_ChangeGame(man, cfg_reload_on_gamedir.ival, false);
}
#define QCFG "set allow_download_refpackages 0\nset sv_bigcoords \"\"\nmap_autoopenportals 1\n"
#define QCFG "set com_parseutf8 0\nset allow_download_refpackages 0\nset sv_bigcoords \"\"\nmap_autoopenportals 1\n"
/*stuff that makes dp-only mods work a bit better*/
#define DPCOMPAT QCFG "set _cl_playermodel \"\"\n set dpcompat_set 1\nset dpcompat_corruptglobals 1\nset vid_pixelheight 1\n"
/*nexuiz/xonotic has a few quirks/annoyances...*/
@ -2577,9 +2577,9 @@ void COM_Gamedir (const char *dir, const struct gamepacks *packagespaths)
/*set some stuff so our regular qw client appears more like hexen2. sv_mintic is required to 'fix' the ravenstaff so that its projectiles don't impact upon each other*/
#define HEX2CFG "set com_parseutf8 -1\nset gl_font gfx/hexen2\nset in_builtinkeymap 0\nset_calc cl_playerclass int (random * 5) + 1\nset sv_maxspeed 640\ncl_run 0\nset watervis 1\nset r_lavaalpha 1\nset r_lavastyle -2\nset r_wateralpha 0.5\nset sv_pupglow 1\ngl_shaftlight 0.5\nsv_mintic 0.015\nset mod_warnmodels 0\nset cl_model_bobbing 1\nsv_sound_land \"fx/thngland.wav\"\n"
/*yay q2!*/
#define Q2CFG "com_nogamedirnativecode 0\nset sv_bigcoords 0\n"
#define Q2CFG "set com_parseutf8 0\ncom_nogamedirnativecode 0\nset sv_bigcoords 0\n"
/*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/
#define Q3CFG "gl_overbright 2\nseta model sarge\nseta headmodel sarge\nseta handicap 100\ncom_nogamedirnativecode 0\n"
#define Q3CFG "set com_parseutf8 0\ngl_overbright 2\nseta model sarge\nseta headmodel sarge\nseta handicap 100\ncom_nogamedirnativecode 0\n"
//#define RMQCFG "sv_bigcoords 1\n"
typedef struct {

View file

@ -102,7 +102,7 @@ static int debuggerstacky;
#include <windows.h>
void INS_UpdateGrabs(int fullscreen, int activeapp);
#endif
int QCLibEditor(pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, int nump, char **parms);
int QCLibEditor(pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *error, pbool fatal);
void QCLoadBreakpoints(const char *vmname, const char *progsname)
{ //this asks the gui to reapply any active breakpoints and waits for them so that any spawn functions can be breakpointed properly.
#if defined(_WIN32) && !defined(SERVERONLY) && !defined(FTE_SDL)
@ -272,7 +272,7 @@ qboolean QCExternalDebuggerCommand(char *text)
return true;
}
int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason)
int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason, pbool fatal)
{
#if defined(_WIN32) && !defined(SERVERONLY) && !defined(FTE_SDL)
if (isPlugin >= 2)
@ -282,6 +282,8 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int
if (!*filename || !line || !*line) //don't try editing an empty line, it won't work
{
Con_Printf("Unable to debug, please disable optimisations\n");
if (fatal)
return DEBUG_TRACE_ABORT;
return DEBUG_TRACE_OFF;
}
Sys_SendKeyEvents();
@ -333,8 +335,11 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int
#endif
#ifdef TEXTEDITOR
return QCLibEditor(prinst, filename, line, statement, 0, NULL);
return QCLibEditor(prinst, filename, line, statement, reason, fatal);
#else
if (fatal)
return DEBUG_TRACE_ABORT;
return DEBUG_TRACE_OFF; //get lost
{
int i;
char buffer[8192];
@ -374,6 +379,8 @@ int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int
VFS_CLOSE(f);
}
}
if (reason)
return DEBUG_TRACE_ABORT;
//PF_break(NULL);
return DEBUG_TRACE_OVER;
#endif
@ -2643,6 +2650,20 @@ void QCBUILTIN PF_copyentity (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
RETURN_EDICT(prinst, out);
}
void QCBUILTIN PF_entityprotection (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
world_t *w = prinst->parms->user;
wedict_t *e = G_WEDICT(prinst, OFS_PARM0);
int prot = G_FLOAT(OFS_PARM1);
if (e->isfree)
PR_BIError(prinst, "PF_entityprotection: entity is free");
G_FLOAT(OFS_RETURN) = prot;
if (prot < 0 || prot > 1)
return;
e->readonly = prot;
}
//Entities
////////////////////////////////////////////////////
@ -4627,37 +4648,6 @@ void QCBUILTIN PF_changeyaw (pubprogfuncs_t *prinst, struct globalvars_s *pr_glo
ent = PROG_TO_WEDICT(prinst, *w->g.self);
World_changeyaw(ent);
/*
current = anglemod( ent->v->angles[1] );
ideal = ent->v->ideal_yaw;
speed = ent->v->yaw_speed;
if (current == ideal)
return;
move = ideal - current;
if (ideal > current)
{
if (move >= 180)
move = move - 360;
}
else
{
if (move <= -180)
move = move + 360;
}
if (move > 0)
{
if (move > speed)
move = speed;
}
else
{
if (move < -speed)
move = -speed;
}
ent->v->angles[1] = anglemod (current + move);
*/
}
//void() changepitch = #63;
@ -5754,7 +5744,7 @@ lh_extension_t QSG_Extensions[] = {
{"FTE_PEXT_ACURATETIMINGS"}, //allows full interpolation
{"FTE_PEXT_SOUNDDBL"}, //twice the sound indexes
{"FTE_PEXT_FATNESS"}, //entities may be expanded along their vertex normals
{"DP_HALFLIFE_MAP"}, //entitiy can visit a hl bsp
{"DP_HALFLIFE_MAP"}, //entity can visit a hl bsp
{"FTE_PEXT_TE_BULLET"}, //additional particle effect. Like TE_SPIKE and TE_SUPERSPIKE
{"FTE_PEXT_HULLSIZE"}, //means we can tell a client to go to crouching hull
{"FTE_PEXT_MODELDBL"}, //max of 512 models

View file

@ -130,6 +130,7 @@ void QCBUILTIN PF_stov (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
void QCBUILTIN PF_strzone(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_strunzone(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_Spawn (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_entityprotection (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_copyentity (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_droptofloor (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_checkbottom (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -464,7 +465,7 @@ void QCBUILTIN PF_gettime (pubprogfuncs_t *prinst, struct globalvars_s *pr_globa
void QCBUILTIN PF_whichpack (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason);
int QDECL QCEditor (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason, pbool fatal);
void PR_Common_Shutdown(pubprogfuncs_t *progs, qboolean errored);
//FIXME
@ -648,7 +649,7 @@ typedef enum
VF_SCREENVSIZE = 204,
VF_SCREENPSIZE = 205,
VF_VIEWENTITY = 206,
VF_STATSENTITIY = 207, //the player number for the stats.
VF_STATSENTITY = 207, //the player number for the stats.
VF_SCREENVOFFSET = 208,
VF_RT_SOURCECOLOUR = 209,

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
#include "quakedef.h"
#ifdef D3D11QUAKE
#include "winquake.h"
#include "shader.h"
#define COBJMACROS
#include <d3d11.h>
extern ID3D11Device *pD3DDev11;
@ -117,6 +118,9 @@ qboolean D3D11_LoadTextureMips(image_t *tex, struct pendingtextureinfo *mips)
D3D11_SUBRESOURCE_DATA subresdesc[sizeof(mips->mip) / sizeof(mips->mip[0])];
int i;
if (!sh_config.texfmt[mips->encoding])
return false;
tdesc.Width = mips->mip[0].width;
tdesc.Height = mips->mip[0].height;
tdesc.ArraySize = 1;
@ -190,6 +194,9 @@ qboolean D3D11_LoadTextureMips(image_t *tex, struct pendingtextureinfo *mips)
// bytesperpixel = 2;
// break;
case PTI_RGBA8:
tdesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
bytesperpixel = 4;
break;
case PTI_RGBX8: //d3d11 has no alphaless format. be sure to proprly disable alpha in the shader.
tdesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
bytesperpixel = 4;
@ -268,7 +275,10 @@ void D3D11_UploadLightmap(lightmapinfo_t *lm)
mips.mip[0].needfree = false;
mips.mip[0].width = lm->width;
mips.mip[0].height = lm->height;
mips.encoding = PTI_RGBX8;
if (lightmap_bgra)
mips.encoding = PTI_BGRX8;
else
mips.encoding = PTI_RGBX8;
mips.mipcount = 1;
D3D11_LoadTextureMips(tex, &mips);
tex->width = lm->width;

View file

@ -204,17 +204,6 @@ ID3DInclude myd3dinclude =
&myd3dincludetab
};
typedef struct
{
vecV_t coord;
vec2_t tex;
vec2_t lm;
vec3_t ndir;
vec3_t sdir;
vec3_t tdir;
byte_vec4_t colorsb;
} vbovdata_t;
void D3D11Shader_DeleteProg(program_t *prog, unsigned int permu)
{
ID3D11InputLayout *layout;
@ -266,40 +255,39 @@ static qboolean D3D11Shader_CreateShaders(program_t *prog, const char *name, int
{
D3D11_INPUT_ELEMENT_DESC decl[13];
int elements = 0;
vbovdata_t *foo = NULL;
decl[elements].SemanticName = "POSITION";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R32G32B32_FLOAT;
decl[elements].InputSlot = 0;
decl[elements].AlignedByteOffset = (char*)&foo->coord[0] - (char*)NULL;
decl[elements].InputSlot = D3D11_BUFF_POS;
decl[elements].AlignedByteOffset = 0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
decl[elements].SemanticName = "TEXCOORD";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
decl[elements].InputSlot = 0;
decl[elements].AlignedByteOffset = (char*)&foo->tex[0] - (char*)NULL;
decl[elements].Format = DXGI_FORMAT_R32G32_FLOAT;
decl[elements].InputSlot = D3D11_BUFF_TC;
decl[elements].AlignedByteOffset = 0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
/*
decl[elements].SemanticName = "TEXCOORD";
decl[elements].SemanticIndex = 1;
decl[elements].Format = DXGI_FORMAT_R32G32_FLOAT;
decl[elements].InputSlot = 1;
decl[elements].AlignedByteOffset = (char*)&foo->lm[0] - (char*)NULL;
decl[elements].InputSlot = D3D11_BUFF_LMTC;
decl[elements].AlignedByteOffset = 0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
*/
decl[elements].SemanticName = "COLOR";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R8G8B8A8_UNORM;
decl[elements].InputSlot = 0;
decl[elements].AlignedByteOffset = (char*)&foo->colorsb[0] - (char*)NULL;
decl[elements].InputSlot = D3D11_BUFF_COL;
decl[elements].AlignedByteOffset = 0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
@ -307,8 +295,8 @@ static qboolean D3D11Shader_CreateShaders(program_t *prog, const char *name, int
decl[elements].SemanticName = "NORMAL";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R32G32B32_FLOAT;
decl[elements].InputSlot = 0;
decl[elements].AlignedByteOffset = (char*)&foo->ndir[0] - (char*)NULL;
decl[elements].InputSlot = D3D11_BUFF_NORM;
decl[elements].AlignedByteOffset = sizeof(vec3_t)*0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
@ -316,8 +304,8 @@ static qboolean D3D11Shader_CreateShaders(program_t *prog, const char *name, int
decl[elements].SemanticName = "TANGENT";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R32G32B32_FLOAT;
decl[elements].InputSlot = 0;
decl[elements].AlignedByteOffset = (char*)&foo->sdir[0] - (char*)NULL;
decl[elements].InputSlot = D3D11_BUFF_NORM;
decl[elements].AlignedByteOffset = sizeof(vec3_t)*1;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
@ -325,8 +313,8 @@ static qboolean D3D11Shader_CreateShaders(program_t *prog, const char *name, int
decl[elements].SemanticName = "BINORMAL";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R32G32B32_FLOAT;
decl[elements].InputSlot = 0;
decl[elements].AlignedByteOffset = (char*)&foo->tdir[0] - (char*)NULL;
decl[elements].InputSlot = D3D11_BUFF_NORM;
decl[elements].AlignedByteOffset = sizeof(vec3_t)*2;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
elements++;
@ -335,7 +323,7 @@ static qboolean D3D11Shader_CreateShaders(program_t *prog, const char *name, int
decl[elements].SemanticName = "BLENDWEIGHT";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
decl[elements].InputSlot = 0;
decl[elements].InputSlot = D3D11_BUFF_SKEL;
decl[elements].AlignedByteOffset = 0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
@ -344,7 +332,7 @@ static qboolean D3D11Shader_CreateShaders(program_t *prog, const char *name, int
decl[elements].SemanticName = "BLENDINDICIES";
decl[elements].SemanticIndex = 0;
decl[elements].Format = DXGI_FORMAT_R8G8B8A8_UINT;
decl[elements].InputSlot = 0;
decl[elements].InputSlot = D3D11_BUFF_SKEL;
decl[elements].AlignedByteOffset = 0;
decl[elements].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
decl[elements].InstanceDataStepRate = 0;
@ -666,7 +654,7 @@ qboolean D3D11Shader_CreateProgram (program_t *prog, const char *name, unsigned
{
int tmu;
D3D11_SHADER_INPUT_BIND_DESC bdesc = {0};
for (i = prog->numsamplers; i < be_maxpasses; i++)
for (i = prog->numsamplers; i < 16; i++)
{
if (SUCCEEDED(freflect->lpVtbl->GetResourceBindingDescByName(freflect, va("t_t%i", i), &bdesc)))
prog->numsamplers = i+1;
@ -746,9 +734,9 @@ qboolean D3D11Shader_Init(unsigned int flevel)
sh_config.pCreateProgram = D3D11Shader_CreateProgram;
sh_config.pProgAutoFields = NULL;
sh_config.tex_env_combine = 1;
sh_config.nv_tex_env_combine4 = 1;
sh_config.env_add = 1;
// sh_config.tex_env_combine = 1;
// sh_config.nv_tex_env_combine4 = 1;
// sh_config.env_add = 1;
d3dfeaturelevel = flevel;
return true;

View file

@ -244,7 +244,6 @@ enum
D3D_VDEC_SKEL = 1<<6,
D3D_VDEC_POS2 = 1<<7,
D3D_VDEC_MAX = 1<<8,
};
#define STRM_VERT 0
#define STRM_COL 1
@ -1143,7 +1142,7 @@ static void alphagenbyte(const shaderpass_t *pass, int cnt, byte_vec4_t *srcb, v
VectorSubtract(v2, mesh->xyz_array[i], v1);
f = DotProduct(v1, mesh->normals_array[i]) * Q_rsqrt(DotProduct(v1,v1));
f = f * f * f * f * f;
dst[i][3] = bound (0.0f, (int)(f*255), 255);
dst[i][3] = bound (0, (int)(f*255), 255);
}
}
break;
@ -2832,25 +2831,75 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
shaderstate.curentity = e;
m[0] = e->axis[0][0];
m[1] = e->axis[0][1];
m[2] = e->axis[0][2];
m[3] = 0;
if ((e->flags & RF_WEAPONMODEL) && r_refdef.playerview->viewentity > 0)
{
float em[16];
float vm[16];
m[4] = e->axis[1][0];
m[5] = e->axis[1][1];
m[6] = e->axis[1][2];
m[7] = 0;
vm[0] = r_refdef.playerview->vw_axis[0][0];
vm[1] = r_refdef.playerview->vw_axis[0][1];
vm[2] = r_refdef.playerview->vw_axis[0][2];
vm[3] = 0;
m[8] = e->axis[2][0];
m[9] = e->axis[2][1];
m[10] = e->axis[2][2];
m[11] = 0;
vm[4] = r_refdef.playerview->vw_axis[1][0];
vm[5] = r_refdef.playerview->vw_axis[1][1];
vm[6] = r_refdef.playerview->vw_axis[1][2];
vm[7] = 0;
m[12] = e->origin[0];
m[13] = e->origin[1];
m[14] = e->origin[2];
m[15] = 1;
vm[8] = r_refdef.playerview->vw_axis[2][0];
vm[9] = r_refdef.playerview->vw_axis[2][1];
vm[10] = r_refdef.playerview->vw_axis[2][2];
vm[11] = 0;
vm[12] = r_refdef.playerview->vw_origin[0];
vm[13] = r_refdef.playerview->vw_origin[1];
vm[14] = r_refdef.playerview->vw_origin[2];
vm[15] = 1;
em[0] = e->axis[0][0];
em[1] = e->axis[0][1];
em[2] = e->axis[0][2];
em[3] = 0;
em[4] = e->axis[1][0];
em[5] = e->axis[1][1];
em[6] = e->axis[1][2];
em[7] = 0;
em[8] = e->axis[2][0];
em[9] = e->axis[2][1];
em[10] = e->axis[2][2];
em[11] = 0;
em[12] = e->origin[0];
em[13] = e->origin[1];
em[14] = e->origin[2];
em[15] = 1;
Matrix4_Multiply(vm, em, m);
}
else
{
m[0] = e->axis[0][0];
m[1] = e->axis[0][1];
m[2] = e->axis[0][2];
m[3] = 0;
m[4] = e->axis[1][0];
m[5] = e->axis[1][1];
m[6] = e->axis[1][2];
m[7] = 0;
m[8] = e->axis[2][0];
m[9] = e->axis[2][1];
m[10] = e->axis[2][2];
m[11] = 0;
m[12] = e->origin[0];
m[13] = e->origin[1];
m[14] = e->origin[2];
m[15] = 1;
}
if (e->scale != 1 && e->scale != 0) //hexen 2 stuff
{
@ -2912,22 +2961,7 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
VectorScale((m+8), mod->clampscale, (m+8));
}
if (e->flags & RF_WEAPONMODEL)
{
/*FIXME: no bob*/
float iv[16];
Matrix4_Invert(r_refdef.m_view, iv);
Matrix4x4_CM_NewRotation(90, 1, 0, 0);
Matrix4_Multiply(iv, m, mv);
Matrix4_Multiply(mv, Matrix4x4_CM_NewRotation(-90, 1, 0, 0), iv);
Matrix4_Multiply(iv, Matrix4x4_CM_NewRotation(90, 0, 0, 1), m);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)m);
}
else
{
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)m);
}
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)m);
{
D3DVIEWPORT9 vport;

View file

@ -12,6 +12,9 @@
ID3D11Device *pD3DDev11;
ID3D11DeviceContext *d3ddevctx;
//#include <d3d11_1.h>
//ID3D11DeviceContext1 *d3ddevctx1;
#ifdef WINRT //winrt crap has its own non-hwnd window crap, after years of microsoft forcing everyone to use hwnds for everything. I wonder why they don't have that many winrt apps.
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "D3D11.lib")

View file

@ -47,6 +47,7 @@ http://prideout.net/archive/bloom/ contains some sample code
#include "gl_draw.h"
cvar_t r_bloom = CVARAFD("r_bloom", "0", "gl_bloom", CVAR_ARCHIVE, "Enables bloom (light bleeding from bright objects). Fractional values reduce the amount shown.");
cvar_t r_bloom_retain = CVARD("r_bloom_retain", "1", "How much of the regular scene to retain when bloom is active.");
cvar_t r_bloom_filter = CVARD("r_bloom_filter", "0.7 0.7 0.7", "Controls how bright the image must get before it will bloom (3 separate values, in RGB order).");
cvar_t r_bloom_size = CVARD("r_bloom_size", "4", "Target bloom kernel size (assuming a video width of 320).");
cvar_t r_bloom_downsize = CVARD("r_bloom_downsize", "0", "Technically more correct with a value of 1, but you probably won't notice.");
@ -82,6 +83,7 @@ static void R_InitBloomTextures(void)
void R_BloomRegister(void)
{
Cvar_Register (&r_bloom, "bloom");
Cvar_Register (&r_bloom_retain, "bloom");
Cvar_Register (&r_bloom_filter, "bloom");
Cvar_Register (&r_bloom_size, "bloom");
Cvar_Register (&r_bloom_downsize, "bloom");

View file

@ -296,6 +296,7 @@ typedef struct heightmap_s
char skyname[MAX_QPATH];
char groundshadername[MAX_QPATH];
char defaultwatershader[MAX_QPATH]; //typically the name of the ocean or whatever.
unsigned int culldistance;
float defaultwaterheight;
float defaultgroundheight;
char defaultgroundtexture[MAX_QPATH];
@ -359,7 +360,7 @@ typedef struct heightmap_s
#endif
char *texmask; //for editing - visually masks off the areas which CANNOT accept this texture
struct relight_ctx_s *relightcontext;
struct llightinfo_s *lightthreadmem;
@ -4203,34 +4204,53 @@ qboolean Heightmap_Trace(struct model_s *model, int hulloverride, int frame, vec
typedef struct
{
int id;
int x, y;
int pos[3];
} hmpvs_t;
typedef struct
{
int id;
int min[3], max[3];
} hmpvsent_t;
unsigned int Heightmap_FatPVS (model_t *mod, vec3_t org, qbyte *pvsbuffer, unsigned int pvssize, qboolean add)
{
//embed the org onto the pvs
hmpvs_t *hmpvs = (hmpvs_t*)pvsbuffer;
hmpvs->id = 0xdeadbeef;
hmpvs->x = org[0];
hmpvs->y = org[1];
VectorCopy(org, hmpvs->pos);
return sizeof(*hmpvs);
}
#ifndef CLIENTONLY
qboolean Heightmap_EdictInFatPVS (model_t *mod, struct pvscache_s *edict, qbyte *pvsdata)
{
int x,y;
heightmap_t *hm = mod->terrain;
int o[3], i;
hmpvs_t *hmpvs = (hmpvs_t*)pvsdata;
//check distance
x = edict->areanum - hmpvs->x;
y = edict->areanum2 - hmpvs->y;
hmpvsent_t *hmed = (hmpvsent_t*)edict;
return (x*x+y*y) < 4096*4096;
if (!hm->culldistance)
return true;
//check distance
for (i = 0; i < 3; i++)
{
if (hmpvs->pos[i] < hmed->min[i])
o[i] = hmed->min[i] - hmpvs->pos[i];
else if (hmpvs->pos[i] > hmed->max[i])
o[i] = hmed->max[i] - hmpvs->pos[i];
else
o[i] = 0;
}
return DotProduct(o,o) < hm->culldistance;
}
void Heightmap_FindTouchedLeafs (model_t *mod, pvscache_t *ent, float *mins, float *maxs)
{
ent->areanum = (mins[0] + maxs[0]) * 0.5;
ent->areanum2 = (mins[1] + maxs[1]) * 0.5;
hmpvsent_t *hmed = (hmpvsent_t*)ent;
VectorCopy(mins, hmed->min);
VectorCopy(maxs, hmed->max);
}
#endif
@ -5054,6 +5074,7 @@ void Terr_ParseEntityLump(char *data, heightmap_t *heightmap)
heightmap->sectionsize = 1024;
heightmap->mode = HMM_TERRAIN;
heightmap->culldistance = 4096;
heightmap->defaultgroundheight = 0;
heightmap->defaultwaterheight = 0;
@ -5091,6 +5112,10 @@ void Terr_ParseEntityLump(char *data, heightmap_t *heightmap)
Q_strncpyz(heightmap->defaultgroundtexture, value, sizeof(heightmap->defaultgroundtexture));
else if (!strcmp("defaultwatertexture", key))
Q_strncpyz(heightmap->defaultwatershader, value, sizeof(heightmap->defaultwatershader));
else if (!strcmp("culldistance", key))
heightmap->culldistance = atof(value);
else if (!strcmp("skybox", key))
Q_strncpyz(heightmap->skyname, value, sizeof(heightmap->skyname));
else if (!strcmp("tiles", key))
{
char *d;
@ -6650,6 +6675,8 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
if (submod->loadstate == MLS_NOTLOADED)
{
submod->type = mod_heightmap;
if (!submod->entities)
submod->entities = Z_Malloc(1);
subhm = submod->terrain = Mod_LoadTerrainInfo(submod, submod->name, true);
subhm->exteriorcontents = FTECONTENTS_EMPTY;

View file

@ -445,7 +445,6 @@ void GLR_DeInit (void)
// Cmd_RemoveCommand ("makewad");
Cvar_Unhook(&r_skyboxname);
Cvar_Unhook(&vid_conautoscale);
Cvar_Unhook(&vid_conheight);
Cvar_Unhook(&vid_conwidth);

View file

@ -4311,11 +4311,23 @@ done:;
{
for (i = 0; i < s->numpasses; i++)
{
if (s->passes[i].numtcmods || (s->passes[i].tcgen != TC_GEN_BASE && s->passes[i].tcgen != TC_GEN_LIGHTMAP) || !(s->passes[i].flags & SHADER_PASS_NOCOLORARRAY))
pass = &s->passes[i];
if (pass->numtcmods || (s->passes[i].tcgen != TC_GEN_BASE && s->passes[i].tcgen != TC_GEN_LIGHTMAP) || !(s->passes[i].flags & SHADER_PASS_NOCOLORARRAY))
{
s->flags |= SHADER_NEEDSARRAYS;
break;
}
if (!(pass->flags & SHADER_PASS_NOCOLORARRAY))
{
if (!(((pass->rgbgen == RGB_GEN_VERTEX_LIGHTING) ||
(pass->rgbgen == RGB_GEN_VERTEX_EXACT) ||
(pass->rgbgen == RGB_GEN_ONE_MINUS_VERTEX)) &&
(pass->alphagen == ALPHA_GEN_VERTEX)))
{
s->flags |= SHADER_NEEDSARRAYS;
break;
}
}
}
}
}
@ -5226,37 +5238,25 @@ void Shader_DefaultBSPQ1(const char *shortname, shader_t *s, const void *args)
void Shader_DefaultBSPVertex(const char *shortname, shader_t *s, const void *args)
{
shaderpass_t *pass;
// s->defaulttextures.base = R_LoadHiResTexture(va("%s_d.tga", shortname), NULL, 0);
char *builtin = NULL;
if (Shader_ParseShader("defaultvertexlit", s))
return;
pass = &s->passes[0];
pass->tcgen = TC_GEN_BASE;
pass->shaderbits |= SBITS_MISC_DEPTHWRITE;
pass->rgbgen = RGB_GEN_VERTEX_LIGHTING;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass->numMergedPasses = 1;
Shader_SetBlendmode(pass);
/* if (TEXVALID(s->defaulttextures.base))
if (!builtin)
{
pass->texgen = T_GEN_DIFFUSE;
}
else*/
{
s->defaulttextures->base = R_LoadHiResTexture(shortname, NULL, 0);
pass->texgen = T_GEN_DIFFUSE;
if (!TEXVALID(s->defaulttextures->base))
Con_DPrintf (CON_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
builtin = (
"{\n"
"{\n"
"map $diffuse\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"}\n"
);
}
s->numpasses = 1;
s->numdeforms = 0;
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
s->sort = SHADER_SORT_OPAQUE;
Shader_DefaultScript(shortname, s, builtin);
}
void Shader_DefaultBSPFlare(const char *shortname, shader_t *s, const void *args)
{

View file

@ -177,7 +177,7 @@ void LightReloadEntities(struct relight_ctx_s *ctx, char *entstring)
mapent->colour[1] = 0;
mapent->colour[2] = 0;
mapent->targetentnum = -1;
while(1)
while(entstring)
{
entstring = COM_ParseOut(entstring, key, sizeof(key));
if (!strcmp(key, "}"))

View file

@ -785,6 +785,18 @@ void D3D11BE_VBO_Data(vbobctx_t *ctx, void *data, unsigned int size, vboarray_t
void D3D11BE_VBO_Finish(vbobctx_t *ctx, void *edata, unsigned int esize, vboarray_t *earray);
void D3D11BE_VBO_Destroy(vboarray_t *vearray);
void D3D11BE_Scissor(srect_t *rect);
enum
{ //these are the buffer indexes
D3D11_BUFF_POS,
D3D11_BUFF_COL,
D3D11_BUFF_TC,
D3D11_BUFF_LMTC,
D3D11_BUFF_NORM,
D3D11_BUFF_SKEL,
D3D11_BUFF_POS2,
D3D11_BUFF_MAX
};
#endif
//Builds a hardware shader from the software representation

View file

@ -12,14 +12,12 @@
//Appears to work fine.
#if INTSIZE == 16
#define cont cont16
#define reeval reeval16
#define pr_statements pr_statements16
#define fakeop fakeop16
#define dstatement_t dstatement16_t
#define sofs signed short
#elif INTSIZE == 32
#define cont cont32
#define reeval reeval32
#define pr_statements pr_statements32
#define fakeop fakeop32
@ -50,7 +48,6 @@
//rely upon just st
{
#ifdef DEBUGABLE
cont: //last statement may have been a breakpoint
s = st-pr_statements;
s+=1;
@ -81,10 +78,10 @@ cont: //last statement may have been a breakpoint
// prinst.watch_ptr = NULL;
progfuncs->funcs.debug_trace=DEBUG_TRACE_INTO; //this is what it's for
s=ShowStep(progfuncs, s, "Watchpoint hit");
s=ShowStep(progfuncs, s, "Watchpoint hit", false);
}
else if (progfuncs->funcs.debug_trace)
s=ShowStep(progfuncs, s, NULL);
s=ShowStep(progfuncs, s, NULL, false);
st = pr_statements + s;
pr_xfunction->profile+=1;
@ -412,12 +409,8 @@ reeval:
case OP_ADDRESS:
errorif ((unsigned)OPA->edict >= (unsigned)num_edicts)
{
pr_xstatement = st-pr_statements;
if (PR_RunWarning (&progfuncs->funcs, "OP_ADDRESS references invalid entity in %s\n", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
{
st--;
goto cont;
}
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_ADDRESS references invalid entity in %s\n", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement;
break;
}
ed = PROG_TO_EDICT(progfuncs, OPA->edict);
@ -433,12 +426,8 @@ reeval:
fdef_t *f;
d16 = ED_GlobalAtOfs16(progfuncs, st->a);
f = ED_FieldAtOfs(progfuncs, OPB->_int + progfuncs->funcs.fieldadjust);
pr_xstatement = st-pr_statements;
if (PR_RunWarning(&progfuncs->funcs, "assignment to read-only entity %i in %s (%s.%s)\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name), d16?PR_StringToNative(&progfuncs->funcs, d16->s_name):NULL, f?f->name:NULL))
{
st--;
goto cont;
}
if (PR_ExecRunWarning(&progfuncs->funcs, st-pr_statements, "assignment to read-only entity %i in %s (%s.%s)\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name), d16?PR_StringToNative(&progfuncs->funcs, d16->s_name):NULL, f?f->name:NULL))
return pr_xstatement;
OPC->_int = ~0;
break;
}
@ -448,12 +437,8 @@ reeval:
#ifdef NOLEGACY
errorif (ed->isfree)
{
pr_xstatement = st-pr_statements;
if (PR_RunWarning (&progfuncs->funcs, "assignment to free entitiy in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
{
st--;
goto cont;
}
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "assignment to free entity in %s", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement;
break;
}
#endif
@ -470,12 +455,8 @@ reeval:
case OP_LOAD_FNC:
errorif ((unsigned)OPA->edict >= (unsigned)num_edicts)
{
pr_xstatement = st-pr_statements;
if (PR_RunWarning (&progfuncs->funcs, "OP_LOAD references invalid entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
{
st--;
goto cont;
}
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references invalid entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement;
OPC->_int = 0;
break;
}
@ -485,7 +466,11 @@ reeval:
#endif
#ifdef NOLEGACY
if (ed->isfree)
{
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references free entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement;
OPC->_int = 0;
}
else
#endif
{
@ -497,12 +482,8 @@ reeval:
case OP_LOAD_V:
errorif ((unsigned)OPA->edict >= (unsigned)num_edicts)
{
pr_xstatement = st-pr_statements;
if (PR_RunWarning (&progfuncs->funcs, "OP_LOAD_V references invalid entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
{
st--;
goto cont;
}
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD_V references invalid entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement;
OPC->_vector[0] = 0;
OPC->_vector[1] = 0;
OPC->_vector[2] = 0;
@ -515,6 +496,8 @@ reeval:
#ifdef NOLEGACY
if (ed->isfree)
{
if (PR_ExecRunWarning (&progfuncs->funcs, st-pr_statements, "OP_LOAD references free entity %i in %s\n", OPA->edict, PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name)))
return pr_xstatement;
OPC->_vector[0] = 0;
OPC->_vector[1] = 0;
OPC->_vector[2] = 0;
@ -1276,7 +1259,7 @@ reeval:
{
pr_xstatement = s;
printf("Break point hit in %s.\n", PR_StringToNative(&progfuncs->funcs, pr_xfunction->s_name));
s = ShowStep(progfuncs, s, NULL);
s = ShowStep(progfuncs, s, NULL, false);
st = &pr_statements[s]; //let the user move execution
pr_xstatement = s = st-pr_statements;
op = st->op & ~0x8000;

View file

@ -1184,7 +1184,7 @@ cont:
return ret;
}
int ShowStep(progfuncs_t *progfuncs, int statement, char *fault)
int ShowStep(progfuncs_t *progfuncs, int statement, char *fault, pbool fatal)
{
// return statement;
// texture realcursortex;
@ -1202,6 +1202,8 @@ static const char *lastfile = 0;
if (!externs->useeditor)
{
PR_PrintStatement(progfuncs, statement);
if (fatal)
progfuncs->funcs.debug_trace = DEBUG_TRACE_ABORT;
return statement;
}
@ -1224,7 +1226,7 @@ static const char *lastfile = 0;
lastfile = PR_StringToNative(&progfuncs->funcs, f->s_file);
faultline = lastline;
debugaction = externs->useeditor(&progfuncs->funcs, lastfile, ((lastline>0)?&lastline:NULL), &statement, fault);
debugaction = externs->useeditor(&progfuncs->funcs, lastfile, ((lastline>0)?&lastline:NULL), &statement, fault, fatal);
//if they changed the line to execute, we need to find a statement that is on that line
if (lastline && faultline != lastline)
@ -1274,7 +1276,7 @@ static const char *lastfile = 0;
if (debugaction == DEBUG_TRACE_NORESUME)
continue;
else if(debugaction == DEBUG_TRACE_ABORT)
progfuncs->funcs.parms->Abort ("Debugging terminated");
progfuncs->funcs.parms->Abort ("Debugger Abort");
else if (debugaction == DEBUG_TRACE_OFF)
{
//if we're resuming, don't hit any lingering step-over triggers
@ -1298,7 +1300,7 @@ static const char *lastfile = 0;
{
if (*(f->s_file+progfuncs->funcs.stringtable)) //if we can't get the filename, then it was stripped, and debugging it like this is useless
if (externs->useeditor)
externs->useeditor(&progfuncs->funcs, f->s_file+progfuncs->funcs.stringtable, NULL, NULL, fault);
externs->useeditor(&progfuncs->funcs, f->s_file+progfuncs->funcs.stringtable, NULL, NULL, fault, fatal);
return statement;
}
@ -1306,17 +1308,6 @@ static const char *lastfile = 0;
return statement;
}
int ShowStepf(progfuncs_t *progfuncs, int statement, char *fault, ...)
{
va_list argptr;
char faultstring[1024];
va_start (argptr,fault);
Q_vsnprintf (faultstring,sizeof(faultstring)-1, fault,argptr);
va_end (argptr);
return ShowStep(progfuncs, statement, faultstring);
}
//called by the qcvm when executing some statement that cannot be execed.
int PR_HandleFault (pubprogfuncs_t *ppf, char *error, ...)
{
@ -1332,7 +1323,7 @@ int PR_HandleFault (pubprogfuncs_t *ppf, char *error, ...)
PR_StackTrace (ppf, true);
ppf->parms->Printf ("%s\n", string);
resumestatement = ShowStep(progfuncs, pr_xstatement, string);
resumestatement = ShowStep(progfuncs, pr_xstatement, string, true);
if (resumestatement == 0)
{
@ -1389,6 +1380,29 @@ pbool PR_RunWarning (pubprogfuncs_t *ppf, char *error, ...)
}
return false;
}
static pbool PR_ExecRunWarning (pubprogfuncs_t *ppf, int xstatement, char *error, ...)
{
progfuncs_t *progfuncs = (progfuncs_t *)ppf;
va_list argptr;
char string[1024];
pr_xstatement = xstatement;
va_start (argptr,error);
Q_vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
progfuncs->funcs.parms->Printf ("%s", string);
if (pr_depth != 0)
PR_StackTrace (ppf, false);
if (progfuncs->funcs.debug_trace == 0)
{
pr_xstatement = ShowStep(progfuncs, xstatement, error, false);
return true;
}
return false;
}
//For debugging. Assumes classname field exists.
const char *PR_GetEdictClassname(progfuncs_t *progfuncs, int edict)

View file

@ -212,7 +212,7 @@ typedef struct progexterns_s {
void *(VARGS *memalloc) (int size); //small string allocation malloced and freed randomly by the executor. (use malloc if you want)
void (VARGS *memfree) (void * mem);
int (PDECL *useeditor) (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason); //called on syntax errors or step-by-step debugging. line and statement(if line was set to 0) can be used to change the next line. return value is the new debug state to use/step.
int (PDECL *useeditor) (pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, char *reason, pbool fatal); //called on syntax errors or step-by-step debugging. line and statement(if line was set to 0) can be used to change the next line. return value is the new debug state to use/step.
void (PDECL *addressablerelocated) (pubprogfuncs_t *progfuncs, char *oldb, char *newb, int oldlen); //called when the progs memory was resized. you must fix up all pointers to globals, strings, fields, addressable blocks.
builtin_t *globalbuiltins; //these are available to all progs

View file

@ -71,7 +71,11 @@ cvar_t pr_fixbrokenqccarrays = CVARFD("pr_fixbrokenqccarrays", "0", CVAR_LATCH,
/*other stuff*/
cvar_t pr_maxedicts = CVARAFD("pr_maxedicts", "32768", "max_edicts", CVAR_LATCH, "Maximum number of entities spawnable on the map at once. Low values will crash the server on some maps/mods. High values will result in excessive memory useage (see pr_ssqc_memsize). Illegible server messages may occur with old/other clients above 32k. FTE's network protocols have a maximum at a little over 4 million. Please don't ever make a mod that actually uses that many...");
#ifdef NOLEGACY
cvar_t pr_no_playerphysics = CVARFD("pr_no_playerphysics", "1", CVAR_LATCH, "Prevents support of the 'SV_PlayerPhysics' QC function. This allows servers to prevent needless breakage of player prediction.");
#else
cvar_t pr_no_playerphysics = CVARFD("pr_no_playerphysics", "0", CVAR_LATCH, "Prevents support of the 'SV_PlayerPhysics' QC function. This allows servers to prevent needless breakage of player prediction.");
#endif
cvar_t pr_no_parsecommand = CVARFD("pr_no_parsecommand", "0", 0, "Provides a way around invalid mod usage of SV_ParseClientCommand, eg xonotic.");
extern cvar_t pr_sourcedir;
@ -85,7 +89,11 @@ cvar_t pr_compatabilitytest = CVARFD("pr_compatabilitytest", "0", CVAR_LATCH, "O
cvar_t pr_ssqc_coreonerror = CVAR("pr_coreonerror", "1");
cvar_t sv_gameplayfix_honest_tracelines = CVAR("sv_gameplayfix_honest_tracelines", "1");
#ifdef NOLEGACY
cvar_t sv_gameplayfix_setmodelrealbox = CVARD("sv_gameplayfix_setmodelrealbox", "1", "Vanilla setmodel will setsize the entity to a hardcoded size for non-bsp models. This cvar will always use the real size of the model instead, but will require that the server actually loads the model.");
#else
cvar_t sv_gameplayfix_setmodelrealbox = CVARD("sv_gameplayfix_setmodelrealbox", "0", "Vanilla setmodel will setsize the entity to a hardcoded size for non-bsp models. This cvar will always use the real size of the model instead, but will require that the server actually loads the model.");
#endif
cvar_t sv_gameplayfix_setmodelsize_qw = CVARD("sv_gameplayfix_setmodelsize_qw", "0", "The setmodel builtin will act as a setsize for QuakeWorld mods also.");
cvar_t dpcompat_nopreparse = CVARD("dpcompat_nopreparse", "0", "Xonotic uses svc_tempentity with unknowable lengths mixed with other data that needs to be translated. This cvar disables any attempt to translate or pre-parse network messages, including disabling nq/qw cross compatibility. NOTE: because preparsing will be disabled, messages might not get backbuffered correctly if too much reliable data is written.");
@ -156,7 +164,9 @@ struct {
func_t RunClientCommand; //EXT_CSQC_1
#ifdef HEXEN2
func_t ClassChangeWeapon;//hexen2 support
#endif
func_t AddDebugPolygons;
func_t CheckRejectConnection;
} gfuncs;
@ -747,11 +757,11 @@ void PR_LoadGlabalStruct(qboolean muted)
globalvec (false, input_angles);
globalvec (false, input_movevalues);
globalfloat (false, input_buttons);
globalint (false, serverid);
memset(&evalc_idealpitch, 0, sizeof(evalc_idealpitch));
memset(&evalc_pitch_speed, 0, sizeof(evalc_pitch_speed));
pr_global_ptrs->serverid = (float *)PR_FindGlobal(svprogfuncs, "serverid", 0, NULL);
if (pr_global_ptrs->serverid)
*pr_global_ptrs->serverid = svs.clusterserverid;
for (i = 0; i < NUM_SPAWN_PARMS; i++)
@ -847,7 +857,9 @@ void PR_LoadGlabalStruct(qboolean muted)
gfuncs.PausedTic = PR_FindFunction(svprogfuncs, "SV_PausedTic", PR_ANY);
gfuncs.ShouldPause = PR_FindFunction(svprogfuncs, "SV_ShouldPause", PR_ANY);
#ifdef HEXEN2
gfuncs.ClassChangeWeapon = PR_FindFunction(svprogfuncs, "ClassChangeWeapon", PR_ANY);
#endif
gfuncs.RunClientCommand = PR_FindFunction(svprogfuncs, "SV_RunClientCommand", PR_ANY);
gfuncs.AddDebugPolygons = PR_FindFunction(svprogfuncs, "SV_AddDebugPolygons", PR_ANY);
gfuncs.CheckRejectConnection = PR_FindFunction(svprogfuncs, "SV_CheckRejectConnection", PR_ANY);
@ -3123,7 +3135,7 @@ static void set_trace_globals(pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
pr_global_struct->trace_inwater = trace->inwater;
pr_global_struct->trace_inopen = trace->inopen;
pr_global_struct->trace_surfaceflags = trace->surface?trace->surface->flags:0;
if (pr_global_struct->trace_surfacename)
if (pr_global_ptrs->trace_surfacename)
prinst->SetStringField(prinst, NULL, &pr_global_struct->trace_surfacename, trace->surface?trace->surface->name:NULL, true);
pr_global_struct->trace_endcontents = trace->contents;
pr_global_struct->trace_brush_id = trace->brush_id;
@ -8808,9 +8820,9 @@ static void QCBUILTIN PF_runclientphys(pubprogfuncs_t *prinst, struct globalvars
pmove.cmd.angles[2] = ANGLE2SHORT((pr_global_struct->input_angles)[2]);
VectorCopy(pr_global_struct->input_angles, pmove.angles);
pmove.cmd.forwardmove = (pr_global_struct->input_movevalues)[0];
pmove.cmd.sidemove = (pr_global_struct->input_movevalues)[1];
pmove.cmd.upmove = (pr_global_struct->input_movevalues)[2];
pmove.cmd.forwardmove = bound(-32767, (pr_global_struct->input_movevalues)[0], 32767);
pmove.cmd.sidemove = bound(-32767, (pr_global_struct->input_movevalues)[1], 32767);
pmove.cmd.upmove = bound(-32767, (pr_global_struct->input_movevalues)[2], 32767);
pmove.cmd.buttons = pr_global_struct->input_buttons;
pmove.safeorigin_known = true;
@ -9835,6 +9847,8 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"con_draw", PF_Fixme, 0, 0, 0, 393, D("void(string conname, vector pos, vector size, float fontsize)", "Draws the named console.")},
{"con_input", PF_Fixme, 0, 0, 0, 394, D("float(string conname, float inevtype, float parama, float paramb, float paramc)", "Forwards input events to the named console. Mouse updates should be absolute only.")},
{"cvars_haveunsaved",PF_Fixme, 0, 0, 0, 0, D("float()", "Returns true if any archived cvar has an unsaved value.")},
{"entityprotection",PF_entityprotection,0, 0, 0, 0, D("float(entity e, float nowreadonly)", "Changes the protection on the specified entity to protect it from further edits from QC. The return value is the previous setting. Note that this can be used to unprotect the world, but doing so long term is not advised as you will no longer be able to detect invalid entity references. Also, world is not networked, so results might not be seen by clients (or in other words, world.avelocity_y=64 is a bad idea).")},
//end fte extras
//DP extras
@ -10710,8 +10724,10 @@ void PR_DumpPlatform_f(void)
{"input_cursor_trace_endpos", "vector", CS/*|QW|NQ*/},
{"input_cursor_trace_entnum", "float", CS/*|QW|NQ*/},
{"trace_brush_id", "int", QW|NQ|CS},
{"trace_brush_faceid", "int", QW|NQ|CS},
{"trace_brush_id", "int", QW|NQ|CS},
{"trace_brush_faceid", "int", QW|NQ|CS},
{"serverid", "int", QW|NQ|CS, "The unique id of this server within the server cluster."},
#define comfieldfloat(name,desc) {#name, ".float", FL, desc},
#define comfieldvector(name,desc) {#name, ".vector", FL, desc},
@ -10750,7 +10766,9 @@ void PR_DumpPlatform_f(void)
{"SV_PlayerPhysics", "void()", QW|NQ, "Legacy method to tweak player input that does not reliably work with prediction (prediction WILL break). Mods that care about prediction should use SV_RunClientCommand instead. If pr_no_playerphysics is set to 1, this function will never be called, which will either fix prediction or completely break player movement depending on whether the feature was even useful."},
{"EndFrame", "void()", QW|NQ, "Called after non-player entities have been run at the end of the physics frame. Player physics is performed out of order and can/will still occur between EndFrame and BeginFrame."},
{"SV_CheckRejectConnection","string(string addr, string uinfo, string features) ", QW|NQ, "Called to give the mod a chance to ignore connection requests based upon client protocol support or other properties. Use infoget to read the uinfo and features arguments."},
#ifdef HEXEN2
{"ClassChangeWeapon", "void()", H2, "Hexen2 support. Called when cl_playerclass changes. Self is set to the player who is changing class."},
#endif
/* //mvdsv compat
{"UserInfo_Changed", "//void()", QW},
{"localinfoChanged", "//void()", QW},
@ -10820,6 +10838,9 @@ void PR_DumpPlatform_f(void)
{"MOVETYPE_BOUNCE", "const float", QW|NQ|CS, NULL, MOVETYPE_BOUNCE},
{"MOVETYPE_BOUNCEMISSILE", "const float", QW|NQ|CS, NULL, MOVETYPE_BOUNCEMISSILE},
{"MOVETYPE_FOLLOW", "const float", QW|NQ|CS, NULL, MOVETYPE_FOLLOW},
{"MOVETYPE_PUSHPULL", "const float", H2, NULL, MOVETYPE_H2PUSHPULL, "Identical to MOVETYPE_STEP. QC may treat the entity differently (typically with movechains)."},
{"MOVETYPE_SWIM", "const float", H2, NULL, MOVETYPE_H2SWIM, "Equivelent to MOVETYPE_STEP, but additionally walkmove/movetogoal will not allow a movetype_swim entity to move out of water."},
{"MOVETYPE_6DOF", "const float", QW|NQ|CS, "A glorified MOVETYPE_FLY. Players using this movetype will get some flightsim-like physics, with fully independant rotations (order-dependant transforms).", MOVETYPE_6DOF},
{"MOVETYPE_WALLWALK", "const float", QW|NQ|CS, "Players using this movetype will be able to orient themselves to walls, and then run up them.", MOVETYPE_WALLWALK},
{"MOVETYPE_PHYSICS", "const float", QW|NQ|CS, "Enable the use of ODE physics upon this entity.", MOVETYPE_PHYSICS},

View file

@ -94,7 +94,7 @@ typedef struct nqglobalvars_s
vec3_t *input_movevalues;
float *input_buttons;
float *spawnparamglobals[NUM_SPAWN_PARMS];
float *serverid;
int *serverid;
} globalptrs_t;
#define P_VEC(v) (pr_global_struct->v)

View file

@ -3201,14 +3201,14 @@ void SV_Snapshot_BuildStateQ1(entity_state_t *state, edict_t *ent, client_t *cli
if (!ent->xv->scale)
state->scale = 1*16;
else
state->scale = bound(0, ent->xv->scale*16, 255);
state->scale = bound(1, ent->xv->scale*16, 255);
#endif
#ifdef PEXT_TRANS
if (!ent->xv->alpha)
state->trans = 255;
else
state->trans = bound(0, ent->xv->alpha*255, 255);
state->trans = bound(1, ent->xv->alpha*255, 255);
//QSG_DIMENSION_PLANES - if the only shared dimensions are ghost dimensions, Set half alpha.
if (client && client->edict)

View file

@ -1,7 +1,8 @@
struct a2v
{
float4 pos: POSITION;
float4 tc: TEXCOORD0;
float2 tc: TEXCOORD0;
float2 lmtc: TEXCOORD1;
};
struct v2f
{
@ -19,8 +20,8 @@ struct v2f
outp.pos = mul(m_model, inp.pos);
outp.pos = mul(m_view, outp.pos);
outp.pos = mul(m_projection, outp.pos);
outp.tc = inp.tc.xy;
outp.lmtc = inp.tc.zw;
outp.tc = inp.tc;
outp.lmtc = inp.lmtc;
return outp;
}
#endif
@ -29,17 +30,17 @@ struct v2f
Texture2D t_lightmap : register(t2);
SamplerState s_lightmap : register(s2);
Texture2D t_diffuse : register(s0);
Texture2D t_diffuse : register(t0);
SamplerState s_diffuse : register(s0);
Texture2D t_fullbright : register(s1);
Texture2D t_fullbright : register(t1);
SamplerState s_fullbright : register(s1);
float4 main (v2f inp) : SV_TARGET
{
float4 result;
result = t_diffuse.Sample(s_diffuse, inp.tc);
result.rgb *= t_lightmap.Sample(s_lightmap, inp.lmtc).bgr * e_lmscale[0].rgb;
result.rgb *= t_lightmap.Sample(s_lightmap, inp.lmtc).rgb * e_lmscale[0].rgb;
float4 fb = t_fullbright.Sample(s_fullbright, inp.tc);
result.rgb += fb.rgb * fb.a;//lerp(result.rgb, fb.rgb, fb.a);
return result;

View file

@ -0,0 +1,42 @@
struct a2v
{
float4 pos: POSITION;
float2 tc: TEXCOORD0;
float4 vcol: COLOR0;
};
struct v2f
{
float4 pos: SV_POSITION;
float2 tc: TEXCOORD0;
float4 vcol: COLOR0;
};
#include <ftedefs.h>
#ifdef VERTEX_SHADER
v2f main (a2v inp)
{
v2f outp;
outp.pos = mul(m_model, inp.pos);
outp.pos = mul(m_view, outp.pos);
outp.pos = mul(m_projection, outp.pos);
outp.tc = inp.tc;
outp.vcol = inp.vcol;
return outp;
}
#endif
#ifdef FRAGMENT_SHADER
Texture2D t_t0 : register(t0);
SamplerState s_t0 : register(s0);
float4 main (v2f inp) : SV_TARGET
{
float4 tc = t_t0.Sample(s_t0, inp.tc).rgba;
tc.rgba *= inp.vcol.bgra;
#ifdef ALPHATEST
if (!(tc.a ALPHATEST))
discard;
#endif
return tc;
}
#endif