2005-09-08 02:02:09 +00:00
//a note about dedicated servers:
//In the server-side gamecode, a couple of q1 extensions require knowing something about models.
//So we load models serverside, if required.
//things we need:
//tag/bone names and indexes so we can have reasonable modding with tags. :)
//tag/bone positions so we can shoot from the actual gun or other funky stuff
//vertex positions so we can trace against the mesh rather than the bbox.
//we use the gl renderer's model code because it supports more sorts of models than the sw renderer. Sad but true.
2004-08-22 22:29:09 +00:00
# include "quakedef.h"
2010-11-02 23:17:25 +00:00
# include "glquake.h"
2012-09-30 05:52:03 +00:00
# ifndef SERVERONLY
2004-11-29 01:21:00 +00:00
2008-05-25 22:23:43 +00:00
# include "com_mesh.h"
2012-09-30 05:52:03 +00:00
# if defined(RTLIGHTS)
static int numProjectedShadowVerts ;
static vec3_t * ProjectedShadowVerts ;
static int numFacing ;
static qbyte * triangleFacing ;
# endif
2004-08-22 22:29:09 +00:00
//FIXME
typedef struct
{
float scale [ 3 ] ; // multiply qbyte verts by this
float translate [ 3 ] ; // then add this
char name [ 16 ] ; // frame name from grabbing
dtrivertx_t verts [ 1 ] ; // variable sized
} dmd2aliasframe_t ;
2012-01-24 04:24:14 +00:00
extern cvar_t gl_part_flame , r_fullbrightSkins , r_fb_models , ruleset_allow_fbmodels ;
2004-08-22 22:29:09 +00:00
extern cvar_t r_noaliasshadows ;
2019-07-29 05:28:20 +00:00
extern cvar_t r_lodscale , r_lodbias ;
2004-08-22 22:29:09 +00:00
extern cvar_t gl_ati_truform ;
2004-11-18 17:55:04 +00:00
extern cvar_t r_vertexdlights ;
2005-09-08 02:02:09 +00:00
extern cvar_t mod_md3flags ;
2008-05-25 22:23:43 +00:00
extern cvar_t r_skin_overlays ;
2014-02-11 17:51:29 +00:00
extern cvar_t r_globalskin_first , r_globalskin_count ;
2005-07-16 00:53:08 +00:00
# ifndef SERVERONLY
2004-08-22 22:29:09 +00:00
static hashtable_t skincolourmapped ;
2006-02-27 00:42:25 +00:00
2014-03-30 08:55:06 +00:00
//q3 .skin support
static skinfile_t * * registeredskins ;
static skinid_t numregisteredskins ;
2014-08-03 14:47:47 +00:00
struct cctx_s
{
texid_t diffuse ;
int width ;
int height ;
} ;
2014-09-08 23:47:19 +00:00
void Mod_FlushSkin ( skinid_t id )
{
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2014-09-08 23:47:19 +00:00
skinfile_t * sk ;
id - - ;
if ( id > = numregisteredskins )
return ; //invalid!
sk = registeredskins [ id ] ;
if ( ! sk )
return ;
sk - > qwskin = NULL ;
2018-03-04 14:41:16 +00:00
# endif
2014-09-08 23:47:19 +00:00
}
2018-01-22 19:18:04 +00:00
void Mod_WipeSkin ( skinid_t id , qboolean force )
2014-03-30 08:55:06 +00:00
{
2015-11-18 07:37:39 +00:00
//FIXME: skin objects should persist for a frame.
2014-05-18 23:02:04 +00:00
skinfile_t * sk ;
2014-03-30 08:55:06 +00:00
int i ;
2014-05-18 23:02:04 +00:00
id - - ;
if ( id > = numregisteredskins )
return ; //invalid!
sk = registeredskins [ id ] ;
2014-03-30 08:55:06 +00:00
if ( ! sk )
return ;
2018-01-22 19:18:04 +00:00
if ( ! force & & - - sk - > refcount > 0 )
return ; //still in use.
2014-03-30 08:55:06 +00:00
for ( i = 0 ; i < sk - > nummappings ; i + + )
{
if ( sk - > mappings [ i ] . needsfree )
2017-11-14 14:37:04 +00:00
{
2015-03-03 00:14:43 +00:00
Image_UnloadTexture ( sk - > mappings [ i ] . texnums . base ) ;
2017-11-14 14:37:04 +00:00
sk - > mappings [ i ] . texnums . base = r_nulltex ;
}
2014-03-30 08:55:06 +00:00
R_UnloadShader ( sk - > mappings [ i ] . shader ) ;
}
Z_Free ( registeredskins [ id ] ) ;
registeredskins [ id ] = NULL ;
}
2014-09-08 23:47:19 +00:00
static void Mod_WipeAllSkins ( qboolean final )
2014-03-30 08:55:06 +00:00
{
skinid_t id ;
2014-09-08 23:47:19 +00:00
if ( final )
{
for ( id = 0 ; id < numregisteredskins ; )
2018-01-22 19:18:04 +00:00
Mod_WipeSkin ( + + id , true ) ;
2014-09-08 23:47:19 +00:00
Z_Free ( registeredskins ) ;
registeredskins = NULL ;
numregisteredskins = 0 ;
}
else
{
for ( id = 0 ; id < numregisteredskins ; )
Mod_FlushSkin ( + + id ) ;
}
2014-03-30 08:55:06 +00:00
}
skinfile_t * Mod_LookupSkin ( skinid_t id )
{
id - - ;
if ( id < numregisteredskins )
return registeredskins [ id ] ;
return NULL ;
}
2017-11-14 14:37:04 +00:00
struct composeline_s
{
shader_t * sourceimg ;
vec2_t pos , size ;
vec4_t tc ;
vec4_t rgba ;
} ;
static void Mod_ParseComposeLine ( char * texture , struct composeline_s * line )
2014-03-30 08:55:06 +00:00
{
int l ;
char * s , tname [ MAX_QPATH ] ;
for ( s = texture ; * s ; s + + )
{
if ( * s = = ' @ ' | | * s = = ' : ' | | * s = = ' ? ' | | * s = = ' * ' )
break ;
}
l = s - texture ;
if ( l > MAX_QPATH - 1 )
l = MAX_QPATH - 1 ;
memcpy ( tname , texture , l ) ;
tname [ l ] = 0 ;
//load the image and set some default sizes, etc.
2017-11-14 14:37:04 +00:00
if ( * tname )
line - > sourceimg = R2D_SafeCachePic ( tname ) ;
2014-08-03 14:47:47 +00:00
else
2017-11-14 14:37:04 +00:00
line - > sourceimg = NULL ;
Vector2Set ( line - > pos , 0 , 0 ) ;
Vector2Set ( line - > size , - 1 , - 1 ) ;
Vector4Set ( line - > tc , 0 , 0 , 1 , 1 ) ;
Vector4Set ( line - > rgba , 1 , 1 , 1 , 1 ) ;
2014-03-30 08:55:06 +00:00
while ( * s )
{
switch ( * s )
{
case ' @ ' :
2017-11-14 14:37:04 +00:00
line - > pos [ 0 ] = strtod ( s + 1 , & s ) ;
2014-03-30 08:55:06 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > pos [ 1 ] = strtod ( s , & s ) ;
2014-03-30 08:55:06 +00:00
break ;
case ' : ' :
2017-11-14 14:37:04 +00:00
line - > size [ 0 ] = strtod ( s + 1 , & s ) ;
2014-03-30 08:55:06 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > size [ 1 ] = strtod ( s , & s ) ;
2014-03-30 08:55:06 +00:00
break ;
2016-07-21 19:27:59 +00:00
case ' $ ' :
2017-11-14 14:37:04 +00:00
line - > tc [ 0 ] = strtod ( s + 1 , & s ) ;
2016-07-21 19:27:59 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > tc [ 1 ] = strtod ( s , & s ) ;
2016-07-21 19:27:59 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > tc [ 2 ] = strtod ( s , & s ) ;
2016-07-21 19:27:59 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > tc [ 3 ] = strtod ( s , & s ) ;
2016-07-21 19:27:59 +00:00
break ;
2014-03-30 08:55:06 +00:00
case ' ? ' :
2017-11-14 14:37:04 +00:00
line - > rgba [ 0 ] = strtod ( s + 1 , & s ) ;
2014-03-30 08:55:06 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > rgba [ 1 ] = strtod ( s , & s ) ;
2014-03-30 08:55:06 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > rgba [ 2 ] = strtod ( s , & s ) ;
2014-03-30 08:55:06 +00:00
if ( * s = = ' , ' )
s + + ;
2017-11-14 14:37:04 +00:00
line - > rgba [ 3 ] = strtod ( s , & s ) ;
2014-03-30 08:55:06 +00:00
break ;
// case '*':
// break;
default :
s + = strlen ( s ) ; //some sort of error or other thing we don't support
break ;
}
}
2017-11-14 14:37:04 +00:00
}
static void Mod_ComposeSkin ( char * texture , struct cctx_s * cctx , struct composeline_s * line )
{
int iw = 0 , ih = 0 ;
2014-03-30 08:55:06 +00:00
2017-11-14 14:37:04 +00:00
if ( ! line - > sourceimg | | R_GetShaderSizes ( line - > sourceimg , & iw , & ih , false ) ! = 1 ) //no shader? no point in doing anything.
2014-08-03 14:47:47 +00:00
{
2017-11-14 14:37:04 +00:00
iw = ih = 0 ;
line - > sourceimg = NULL ;
2014-08-03 14:47:47 +00:00
}
2017-11-14 14:37:04 +00:00
if ( line - > size [ 0 ] < 0 )
line - > size [ 0 ] = iw ;
if ( line - > size [ 1 ] < 0 )
line - > size [ 1 ] = ih ;
2014-08-03 14:47:47 +00:00
2017-11-14 14:37:04 +00:00
if ( line - > size [ 0 ] > 0 & & line - > size [ 1 ] > 0 )
{
//create a render target if one is not already selected
if ( ! TEXVALID ( cctx - > diffuse ) )
{
if ( R2D_Flush )
R2D_Flush ( ) ;
strcpy ( r_refdef . rt_destcolour [ 0 ] . texname , " - " ) ;
cctx - > width = line - > pos [ 0 ] + line - > size [ 0 ] ;
cctx - > height = line - > pos [ 1 ] + line - > size [ 1 ] ;
cctx - > diffuse = R2D_RT_Configure ( r_refdef . rt_destcolour [ 0 ] . texname , cctx - > width , cctx - > height , TF_RGBA32 , RT_IMAGEFLAGS ) ;
BE_RenderToTextureUpdate2d ( true ) ;
}
if ( line - > sourceimg )
{
R2D_ImageColours ( line - > rgba [ 0 ] , line - > rgba [ 1 ] , line - > rgba [ 2 ] , line - > rgba [ 3 ] ) ;
R2D_Image ( line - > pos [ 0 ] , line - > pos [ 1 ] , line - > size [ 0 ] , line - > size [ 1 ] , line - > tc [ 0 ] , line - > tc [ 1 ] , line - > tc [ 2 ] , line - > tc [ 3 ] , line - > sourceimg ) ;
}
}
2014-03-30 08:55:06 +00:00
2017-11-14 14:37:04 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
R_UnloadShader ( line - > sourceimg ) ; //we're done with it now
2014-03-30 08:55:06 +00:00
}
//create a new skin with explicit name and text. even if its already loaded. this means you can free it safely.
skinid_t Mod_ReadSkinFile ( const char * skinname , const char * skintext )
{
skinid_t id ;
char * nl ;
skinfile_t * skin ;
char shadername [ MAX_QPATH ] ;
for ( id = 0 ; id < numregisteredskins ; id + + )
{
if ( ! registeredskins [ id ] )
break ;
}
if ( id = = numregisteredskins )
{
int newn = numregisteredskins + 64 ;
registeredskins = BZ_Realloc ( registeredskins , sizeof ( * registeredskins ) * newn ) ;
memset ( registeredskins + numregisteredskins , 0 , ( newn - numregisteredskins ) * sizeof ( * registeredskins ) ) ;
numregisteredskins = newn ;
}
2015-05-03 19:57:46 +00:00
2014-03-30 08:55:06 +00:00
skin = Z_Malloc ( sizeof ( * skin ) - sizeof ( skin - > mappings ) + sizeof ( skin - > mappings [ 0 ] ) * 4 ) ;
2018-01-22 19:18:04 +00:00
skin - > refcount + + ;
2014-03-30 08:55:06 +00:00
skin - > maxmappings = 4 ;
Q_strncpyz ( skin - > skinname , skinname , sizeof ( skin - > skinname ) ) ;
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2015-01-12 12:28:13 +00:00
skin - > q1lower = Q1UNSPECIFIED ;
skin - > q1upper = Q1UNSPECIFIED ;
2018-03-04 14:41:16 +00:00
# endif
2014-03-30 08:55:06 +00:00
while ( skintext )
{
if ( skin - > nummappings = = skin - > maxmappings )
{
skin - > maxmappings + = 4 ;
skin = BZ_Realloc ( skin , sizeof ( * skin ) - sizeof ( skin - > mappings ) + sizeof ( skin - > mappings [ 0 ] ) * skin - > maxmappings ) ;
}
skintext = COM_ParseToken ( skintext , " , " ) ;
if ( ! skintext )
break ;
if ( ! strcmp ( com_token , " replace " ) )
{
skintext = COM_ParseToken ( skintext , NULL ) ;
if ( com_tokentype ! = TTP_LINEENDING )
{
Q_strncpyz ( skin - > mappings [ skin - > nummappings ] . surface , com_token , sizeof ( skin - > mappings [ skin - > nummappings ] . surface ) ) ;
skintext = COM_ParseToken ( skintext , NULL ) ;
Q_strncpyz ( shadername , com_token , sizeof ( shadername ) ) ;
skin - > mappings [ skin - > nummappings ] . shader = R_RegisterSkin ( shadername , skin - > skinname ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , skin - > mappings [ skin - > nummappings ] . shader , 0 ) ;
2015-05-03 19:57:46 +00:00
skin - > mappings [ skin - > nummappings ] . texnums = * skin - > mappings [ skin - > nummappings ] . shader - > defaulttextures ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
skin - > mappings [ skin - > nummappings ] . needsfree = false ;
2014-03-30 08:55:06 +00:00
skin - > nummappings + + ;
}
}
else if ( ! strcmp ( com_token , " compose " ) )
{
skintext = COM_ParseToken ( skintext , NULL ) ;
//body
if ( com_tokentype ! = TTP_LINEENDING )
{
2017-11-14 14:37:04 +00:00
size_t l , lines ;
struct composeline_s line [ 64 ] ;
2014-10-05 20:04:11 +00:00
//fixme: this blocks waiting for the textures to load.
2014-08-03 14:47:47 +00:00
struct cctx_s cctx ;
memset ( & cctx , 0 , sizeof ( cctx ) ) ;
2014-03-30 08:55:06 +00:00
Q_strncpyz ( skin - > mappings [ skin - > nummappings ] . surface , com_token , sizeof ( skin - > mappings [ skin - > nummappings ] . surface ) ) ;
skintext = COM_ParseToken ( skintext , NULL ) ;
Q_strncpyz ( shadername , com_token , sizeof ( shadername ) ) ;
skin - > mappings [ skin - > nummappings ] . shader = R_RegisterSkin ( shadername , skin - > skinname ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , skin - > mappings [ skin - > nummappings ] . shader , 0 ) ;
2015-05-03 19:57:46 +00:00
skin - > mappings [ skin - > nummappings ] . texnums = * skin - > mappings [ skin - > nummappings ] . shader - > defaulttextures ;
2014-03-30 08:55:06 +00:00
2017-11-14 14:37:04 +00:00
//parse the lines, and start to load the various shaders.
for ( lines = 0 ; lines < countof ( line ) ; )
2014-03-30 08:55:06 +00:00
{
while ( * skintext = = ' ' | | * skintext = = ' \t ' )
skintext + + ;
if ( * skintext = = ' + ' )
skintext + + ;
else
break ;
skintext = COM_Parse ( skintext ) ;
2017-11-14 14:37:04 +00:00
Mod_ParseComposeLine ( com_token , & line [ lines + + ] ) ;
2014-03-30 08:55:06 +00:00
}
2017-11-14 14:37:04 +00:00
//all the textures should be loading now... block while waiting for them (sucks)
for ( l = 0 ; l < lines ; l + + )
R_GetShaderSizes ( line [ l ] . sourceimg , NULL , NULL , true ) ;
//okay, they're loaded, do the compose now.
for ( l = 0 ; l < lines ; l + + )
Mod_ComposeSkin ( com_token , & cctx , & line [ l ] ) ;
* r_refdef . rt_destcolour [ 0 ] . texname = 0 ;
BE_RenderToTextureUpdate2d ( true ) ;
2014-03-30 08:55:06 +00:00
skin - > mappings [ skin - > nummappings ] . needsfree = 1 ;
2014-08-03 14:47:47 +00:00
skin - > mappings [ skin - > nummappings ] . texnums . base = cctx . diffuse ;
2014-03-30 08:55:06 +00:00
skin - > nummappings + + ;
}
}
else if ( ! strcmp ( com_token , " geomset " ) )
{
int set ;
skintext = COM_ParseToken ( skintext , NULL ) ;
set = atoi ( com_token ) ;
if ( com_tokentype ! = TTP_LINEENDING )
{
skintext = COM_ParseToken ( skintext , NULL ) ;
if ( set < MAX_GEOMSETS )
skin - > geomset [ set ] = atoi ( com_token ) ;
}
}
else if ( ! strncmp ( com_token , " tag_ " , 4 ) )
{
//ignore it. matches q3.
}
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2014-09-08 23:47:19 +00:00
else if ( ! strcmp ( com_token , " qwskin " ) )
{
skintext = COM_ParseToken ( skintext , NULL ) ;
Q_strncpyz ( skin - > qwskinname , com_token , sizeof ( skin - > qwskinname ) ) ;
}
2015-01-12 12:28:13 +00:00
else if ( ! strcmp ( com_token , " q1lower " ) )
{
skintext = COM_ParseToken ( skintext , NULL ) ;
if ( ! strncmp ( com_token , " 0x " , 2 ) )
skin - > q1lower = 0xff000000 | strtoul ( com_token + 2 , NULL , 16 ) ;
else
skin - > q1lower = atoi ( com_token ) ;
}
else if ( ! strcmp ( com_token , " q1upper " ) )
{
skintext = COM_ParseToken ( skintext , NULL ) ;
if ( ! strncmp ( com_token , " 0x " , 2 ) )
skin - > q1upper = 0xff000000 | strtoul ( com_token + 2 , NULL , 16 ) ;
else
skin - > q1upper = atoi ( com_token ) ;
}
2018-03-04 14:41:16 +00:00
# endif
2014-03-30 08:55:06 +00:00
else
{
while ( * skintext = = ' ' | | * skintext = = ' \t ' )
skintext + + ;
if ( * skintext = = ' , ' )
{
Q_strncpyz ( skin - > mappings [ skin - > nummappings ] . surface , com_token , sizeof ( skin - > mappings [ skin - > nummappings ] . surface ) ) ;
skintext = COM_ParseToken ( skintext + 1 , NULL ) ;
2014-04-24 01:53:01 +00:00
Q_strncpyz ( shadername , com_token , sizeof ( shadername ) ) ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
skin - > mappings [ skin - > nummappings ] . shader = R_RegisterCustom ( shadername , 0 , Shader_DefaultSkin , NULL ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , skin - > mappings [ skin - > nummappings ] . shader , 0 ) ;
2015-05-03 19:57:46 +00:00
skin - > mappings [ skin - > nummappings ] . texnums = * skin - > mappings [ skin - > nummappings ] . shader - > defaulttextures ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
skin - > mappings [ skin - > nummappings ] . needsfree = false ;
2014-03-30 08:55:06 +00:00
skin - > nummappings + + ;
}
}
if ( com_tokentype = = TTP_LINEENDING | | ! skintext )
continue ;
nl = strchr ( skintext , ' \n ' ) ;
if ( ! nl )
skintext = skintext + strlen ( skintext ) ;
else
skintext = nl + 1 ;
if ( ! * skintext )
break ;
}
registeredskins [ id ] = skin ;
return id + 1 ;
}
//registers a skin. loads it if there's not one with that name already registered.
//returns 0 if it failed.
skinid_t Mod_RegisterSkinFile ( const char * skinname )
{
char * f ;
skinid_t id ;
//block duplicates
for ( id = 0 ; id < numregisteredskins ; id + + )
{
if ( ! registeredskins [ id ] )
continue ;
if ( ! strcmp ( skinname , registeredskins [ id ] - > skinname ) )
2018-01-22 19:18:04 +00:00
{
registeredskins [ id ] - > refcount + + ;
2014-03-30 08:55:06 +00:00
return id + 1 ;
2018-01-22 19:18:04 +00:00
}
2014-03-30 08:55:06 +00:00
}
2014-10-05 20:04:11 +00:00
f = FS_LoadMallocFile ( skinname , NULL ) ;
2014-03-30 08:55:06 +00:00
if ( ! f )
return 0 ;
id = Mod_ReadSkinFile ( skinname , f ) ;
Z_Free ( f ) ;
return id ;
}
2005-09-08 02:02:09 +00:00
//changes vertex lighting values
2009-11-07 13:29:15 +00:00
#if 0
2006-02-27 00:42:25 +00:00
static void R_GAliasApplyLighting ( mesh_t * mesh , vec3_t org , vec3_t angles , float * colormod )
2004-09-07 23:09:15 +00:00
{
int l , v ;
vec3_t rel ;
vec3_t dir ;
2009-11-04 21:16:50 +00:00
float dot , d , a ;
2006-02-27 00:42:25 +00:00
2009-11-04 21:16:50 +00:00
if ( mesh - > colors4f_array )
2004-09-07 23:09:15 +00:00
{
2006-02-27 00:42:25 +00:00
float l ;
int temp ;
int i ;
2009-11-04 21:16:50 +00:00
avec4_t * colours = mesh - > colors4f_array ;
2006-02-27 00:42:25 +00:00
vec3_t * normals = mesh - > normals_array ;
vec3_t ambient , shade ;
2009-11-04 21:16:50 +00:00
qbyte alphab = bound ( 0 , colormod [ 3 ] , 1 ) ;
2006-02-27 00:42:25 +00:00
if ( ! mesh - > normals_array )
2004-09-07 23:09:15 +00:00
{
2009-11-04 21:16:50 +00:00
mesh - > colors4f_array = NULL ;
2006-02-27 00:42:25 +00:00
return ;
}
2004-09-07 23:09:15 +00:00
2006-02-27 00:42:25 +00:00
VectorCopy ( ambientlight , ambient ) ;
VectorCopy ( shadelight , shade ) ;
for ( i = 0 ; i < 3 ; i + + )
{
ambient [ i ] * = colormod [ i ] ;
shade [ i ] * = colormod [ i ] ;
}
for ( i = mesh - > numvertexes - 1 ; i > = 0 ; i - - )
{
l = DotProduct ( normals [ i ] , shadevector ) ;
temp = l * ambient [ 0 ] + shade [ 0 ] ;
colours [ i ] [ 0 ] = temp ;
temp = l * ambient [ 1 ] + shade [ 1 ] ;
colours [ i ] [ 1 ] = temp ;
temp = l * ambient [ 2 ] + shade [ 2 ] ;
colours [ i ] [ 2 ] = temp ;
colours [ i ] [ 3 ] = alphab ;
}
}
2009-11-04 21:16:50 +00:00
if ( r_vertexdlights . value & & mesh - > colors4f_array )
2006-02-27 00:42:25 +00:00
{
2009-11-04 21:16:50 +00:00
//don't include world lights
for ( l = rtlights_first ; l < RTL_FIRST ; l + + )
2006-02-27 00:42:25 +00:00
{
if ( cl_dlights [ l ] . radius )
2004-09-07 23:09:15 +00:00
{
2006-02-27 00:42:25 +00:00
VectorSubtract ( cl_dlights [ l ] . origin ,
org ,
dir ) ;
if ( Length ( dir ) > cl_dlights [ l ] . radius + mesh - > radius ) //far out man!
continue ;
rel [ 0 ] = - DotProduct ( dir , currententity - > axis [ 0 ] ) ;
rel [ 1 ] = - DotProduct ( dir , currententity - > axis [ 1 ] ) ; //quake's crazy.
rel [ 2 ] = - DotProduct ( dir , currententity - > axis [ 2 ] ) ;
/*
glBegin ( GL_LINES ) ;
glVertex3f ( 0 , 0 , 0 ) ;
glVertex3f ( rel [ 0 ] , rel [ 1 ] , rel [ 2 ] ) ;
glEnd ( ) ;
*/
for ( v = 0 ; v < mesh - > numvertexes ; v + + )
2004-09-07 23:09:15 +00:00
{
2006-02-27 00:42:25 +00:00
VectorSubtract ( mesh - > xyz_array [ v ] , rel , dir ) ;
dot = DotProduct ( dir , mesh - > normals_array [ v ] ) ;
if ( dot > 0 )
2004-09-07 23:09:15 +00:00
{
2006-02-27 00:42:25 +00:00
d = DotProduct ( dir , dir ) ;
a = 1 / d ;
if ( a > 0 )
{
a * = 10000000 * dot / sqrt ( d ) ;
2009-11-04 21:16:50 +00:00
mesh - > colors4f_array [ v ] [ 0 ] + = a * cl_dlights [ l ] . color [ 0 ] ;
mesh - > colors4f_array [ v ] [ 1 ] + = a * cl_dlights [ l ] . color [ 1 ] ;
mesh - > colors4f_array [ v ] [ 2 ] + = a * cl_dlights [ l ] . color [ 2 ] ;
2006-02-27 00:42:25 +00:00
}
// else
2009-11-04 21:16:50 +00:00
// mesh->colors4f_array[v][1] = 1;
2004-09-07 23:09:15 +00:00
}
2006-02-27 00:42:25 +00:00
// else
2009-11-04 21:16:50 +00:00
// mesh->colors4f_array[v][2] = 1;
2004-09-07 23:09:15 +00:00
}
}
}
}
}
2009-11-07 13:29:15 +00:00
# endif
2013-03-12 22:56:10 +00:00
/*
void GL_GAliasFlushOneSkin ( char * skinname )
{
int i ;
bucket_t * * l ;
galiascolourmapped_t * cm ;
for ( i = 0 ; i < skincolourmapped . numbuckets ; i + + )
{
for ( l = & skincolourmapped . bucket [ i ] ; * l ; )
{
cm = ( * l ) - > data ;
if ( strstr ( cm - > name , skinname ) )
{
* l = cm - > bucket . next ;
BZ_Free ( cm ) ;
continue ;
}
l = & ( * l ) - > next ;
}
}
} */
2014-09-08 23:47:19 +00:00
//final is set when the renderer is going down.
//if not set, this is mid-map, and everything should be regeneratable.
void R_GAliasFlushSkinCache ( qboolean final )
2004-08-22 22:29:09 +00:00
{
int i ;
bucket_t * b ;
for ( i = 0 ; i < skincolourmapped . numbuckets ; i + + )
{
while ( ( b = skincolourmapped . bucket [ i ] ) )
{
skincolourmapped . bucket [ i ] = b - > next ;
BZ_Free ( b - > data ) ;
}
}
if ( skincolourmapped . bucket )
BZ_Free ( skincolourmapped . bucket ) ;
skincolourmapped . bucket = NULL ;
skincolourmapped . numbuckets = 0 ;
2012-09-30 05:52:03 +00:00
# ifdef RTLIGHTS
BZ_Free ( ProjectedShadowVerts ) ;
ProjectedShadowVerts = NULL ;
numProjectedShadowVerts = 0 ;
BZ_Free ( triangleFacing ) ;
triangleFacing = NULL ;
numFacing = 0 ;
# endif
2014-03-30 08:55:06 +00:00
2014-09-08 23:47:19 +00:00
Mod_WipeAllSkins ( final ) ;
2004-08-22 22:29:09 +00:00
}
2012-02-12 05:18:31 +00:00
static shader_t * GL_ChooseSkin ( galiasinfo_t * inf , model_t * model , int surfnum , entity_t * e , texnums_t * * forcedtex )
2004-08-22 22:29:09 +00:00
{
galiasskin_t * skins ;
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2012-02-12 05:18:31 +00:00
shader_t * shader ;
2014-09-08 23:47:19 +00:00
qwskin_t * plskin = NULL ;
2009-11-04 21:16:50 +00:00
unsigned int subframe ;
2018-03-04 14:41:16 +00:00
unsigned int tc = e - > topcolour , bc = e - > bottomcolour , pc ;
2014-03-30 08:55:06 +00:00
qboolean generateupperlower = false ;
2018-03-04 14:41:16 +00:00
qboolean forced ;
extern int cl_playerindex ; //so I don't have to strcmp
# endif
int frame ;
2015-01-12 12:28:13 +00:00
2012-02-12 05:18:31 +00:00
* forcedtex = NULL ;
2014-03-30 08:55:06 +00:00
/*q3 .skin files*/
if ( e - > customskin )
{
skinfile_t * sk = Mod_LookupSkin ( e - > customskin ) ;
if ( sk )
{
2017-08-29 02:29:06 +00:00
int i , fallback = - 1 ;
2014-03-30 08:55:06 +00:00
if ( inf - > geomset < MAX_GEOMSETS & & sk - > geomset [ inf - > geomset ] ! = inf - > geomid )
return NULL ; //don't allow this surface to be drawn.
for ( i = 0 ; i < sk - > nummappings ; i + + )
{
if ( ! strcmp ( sk - > mappings [ i ] . surface , inf - > surfacename ) )
{
* forcedtex = & sk - > mappings [ i ] . texnums ;
return sk - > mappings [ i ] . shader ;
}
2017-08-29 02:29:06 +00:00
if ( ! * sk - > mappings [ i ] . surface )
fallback = i ;
}
if ( fallback > = 0 )
{
* forcedtex = & sk - > mappings [ fallback ] . texnums ;
return sk - > mappings [ fallback ] . shader ;
2014-03-30 08:55:06 +00:00
}
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2015-01-12 12:28:13 +00:00
if ( sk - > q1lower ! = Q1UNSPECIFIED )
2015-06-04 06:15:14 +00:00
bc = e - > bottomcolour = sk - > q1lower ;
2015-01-12 12:28:13 +00:00
if ( sk - > q1upper ! = Q1UNSPECIFIED )
2015-11-18 07:37:39 +00:00
tc = e - > topcolour = sk - > q1upper ;
2018-03-04 14:41:16 +00:00
if ( ! sk - > qwskin & & * sk - > qwskinname )
sk - > qwskin = Skin_Lookup ( sk - > qwskinname ) ;
2014-09-08 23:47:19 +00:00
plskin = sk - > qwskin ;
2018-03-04 14:41:16 +00:00
# endif
2014-03-30 08:55:06 +00:00
}
}
2017-01-13 00:39:50 +00:00
else if ( inf - > geomset < MAX_GEOMSETS & & 0 ! = inf - > geomid )
return NULL ;
2012-02-12 05:18:31 +00:00
2012-07-05 19:42:36 +00:00
/*hexen2 feature: global skins */
2014-02-11 17:51:29 +00:00
if ( inf - > numskins < e - > skinnum & & e - > skinnum > = r_globalskin_first . ival & & e - > skinnum < r_globalskin_first . ival + r_globalskin_count . ival )
2010-08-14 00:15:07 +00:00
{
shader_t * s ;
2011-07-30 14:14:56 +00:00
s = R_RegisterSkin ( va ( " gfx/skin%d.lmp " , e - > skinnum ) , NULL ) ;
2013-03-12 22:56:10 +00:00
if ( s )
{
2016-07-12 00:40:13 +00:00
if ( ! TEXVALID ( s - > defaulttextures - > base ) )
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , s , 0 ) ;
2013-03-12 22:56:10 +00:00
return s ;
}
2010-08-14 00:15:07 +00:00
}
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2014-03-30 08:55:06 +00:00
if ( ( e - > model - > engineflags & MDLF_NOTREPLACEMENTS ) & & ! ruleset_allow_sensitive_texture_replacements . ival )
2008-02-01 15:21:14 +00:00
forced = true ;
else
forced = false ;
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
if ( ! gl_nocolors . ival | | forced )
2004-08-22 22:29:09 +00:00
{
2015-06-04 06:15:14 +00:00
if ( plskin & & plskin - > loadstate = = SKIN_LOADING )
plskin = NULL ;
else if ( ! plskin | | plskin - > loadstate ! = SKIN_LOADED )
2004-09-26 00:30:42 +00:00
{
2014-09-08 23:47:19 +00:00
if ( e - > playerindex > = 0 & & e - > playerindex < = MAX_CLIENTS )
{
//heads don't get skinned, only players (and weaponless players), they do still get recoloured.
2018-09-01 04:18:08 +00:00
if ( model = = cl . model_precache [ cl_playerindex ]
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2018-09-01 04:18:08 +00:00
| | model = = cl . model_precache_vwep [ 0 ]
# endif
)
2014-09-08 23:47:19 +00:00
{
if ( ! cl . players [ e - > playerindex ] . qwskin )
Skin_Find ( & cl . players [ e - > playerindex ] ) ;
plskin = cl . players [ e - > playerindex ] . qwskin ;
}
else
plskin = NULL ;
2014-10-06 17:55:39 +00:00
2016-07-16 14:24:06 +00:00
if ( plskin & & plskin - > loadstate < SKIN_LOADED )
2014-10-06 17:55:39 +00:00
{
2020-08-13 08:39:48 +00:00
Skin_TryCache8 ( plskin ) ; //we're not going to use it, but make sure its status is updated when it is finally loaded..
2020-08-24 07:52:55 +00:00
if ( plskin - > loadstate < SKIN_LOADED )
{
plskin = cl . players [ e - > playerindex ] . lastskin ;
if ( ! plskin | | plskin - > loadstate < SKIN_LOADED )
return NULL ; //just wait for it to finish loading so we don't generate pointless skins.
}
2014-10-06 17:55:39 +00:00
}
else
cl . players [ e - > playerindex ] . lastskin = plskin ;
2014-09-08 23:47:19 +00:00
}
else
plskin = NULL ;
2004-09-26 00:30:42 +00:00
}
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
pc = e - > h2playerclass ;
2014-09-17 03:04:08 +00:00
# else
pc = 0 ;
# endif
2005-11-26 03:02:55 +00:00
2013-03-12 22:44:00 +00:00
if ( forced | | tc ! = TOP_DEFAULT | | bc ! = BOTTOM_DEFAULT | | plskin )
2004-08-22 22:29:09 +00:00
{
2005-02-06 02:47:36 +00:00
int inwidth , inheight ;
int tinwidth , tinheight ;
char * skinname ;
qbyte * original ;
galiascolourmapped_t * cm ;
2005-03-20 02:57:11 +00:00
char hashname [ 512 ] ;
2005-02-06 02:47:36 +00:00
if ( ! skincolourmapped . numbuckets )
2008-05-14 18:06:58 +00:00
{
2019-07-29 05:28:20 +00:00
int bucketcount = 256 ;
void * buckets = BZ_Malloc ( Hash_BytesForBuckets ( bucketcount ) ) ;
memset ( buckets , 0 , Hash_BytesForBuckets ( bucketcount ) ) ;
Hash_InitTable ( & skincolourmapped , bucketcount , buckets ) ;
2008-05-14 18:06:58 +00:00
}
2005-11-26 03:02:55 +00:00
2005-03-20 02:57:11 +00:00
if ( ! inf - > numskins )
{
2012-02-12 05:18:31 +00:00
/*model has no skins*/
2005-03-20 02:57:11 +00:00
skins = NULL ;
2009-11-04 21:16:50 +00:00
subframe = 0 ;
2012-02-12 05:18:31 +00:00
shader = NULL ;
2005-03-20 02:57:11 +00:00
}
else
{
2013-07-14 12:22:51 +00:00
skins = inf - > ofsskins ;
2012-02-12 05:18:31 +00:00
if ( e - > skinnum > = 0 & & e - > skinnum < inf - > numskins )
skins + = e - > skinnum ;
2014-10-05 20:04:11 +00:00
if ( ! skins - > numframes )
2009-11-04 21:16:50 +00:00
{
2012-02-12 05:18:31 +00:00
/*model has a skin, but has no framegroups*/
2009-11-04 21:16:50 +00:00
skins = NULL ;
subframe = 0 ;
2012-02-12 05:18:31 +00:00
shader = NULL ;
2009-11-04 21:16:50 +00:00
}
else
{
subframe = cl . time * skins - > skinspeed ;
2014-10-05 20:04:11 +00:00
subframe = subframe % skins - > numframes ;
2009-11-04 21:16:50 +00:00
2014-10-05 20:04:11 +00:00
shader = skins - > frame [ subframe ] . shader ;
2009-11-04 21:16:50 +00:00
}
}
2014-03-30 08:55:06 +00:00
if ( shader )
{
2014-10-05 20:04:11 +00:00
if ( ! plskin )
{
2015-05-03 19:57:46 +00:00
texnums_t * tex = shader - > defaulttextures ;
2014-10-05 20:04:11 +00:00
//do this for the loading case too, in the hope that it'll avoid generating a per-player skin at all
2020-02-11 18:06:10 +00:00
if ( ( tex - > base & & ( tex - > base - > status = = TEX_LOADING ) ) | |
( tex - > loweroverlay & & ( tex - > loweroverlay - > status = = TEX_LOADING | | tex - > loweroverlay - > status = = TEX_LOADED ) ) | |
2015-05-03 19:57:46 +00:00
( tex - > upperoverlay & & ( tex - > upperoverlay - > status = = TEX_LOADING | | tex - > upperoverlay - > status = = TEX_LOADED ) ) )
2014-10-05 20:04:11 +00:00
return shader ;
2020-02-11 18:06:10 +00:00
//if we've got a replacement texture (read: its size differs from the proper skin size) then don't use the base texels for colourmapping.
if ( tex - > base & & skins & &
( tex - > base - > width ! = skins - > skinwidth | | tex - > base - > height ! = skins - > skinheight ) )
return shader ;
2014-10-05 20:04:11 +00:00
}
2016-11-20 20:52:41 +00:00
if ( ( shader - > flags & SHADER_HASTOPBOTTOM ) & & ! h2playertranslations )
{ //this shader will try to do top+bottom colours. this means we can generate only a black image, with separate top+bottom textures.
2014-04-13 04:23:13 +00:00
tc = 0xfe000000 ;
bc = 0xfe000000 ;
2014-03-30 08:55:06 +00:00
generateupperlower = true ;
}
2019-07-29 05:28:20 +00:00
if ( ! skins | | ! skins - > numframes | | ! skins - > frame [ subframe ] . texels )
{ //no top/bottom colourmapping possible here. don't cache a million different values.
tc = 0xfe000000 ;
bc = 0xfe000000 ;
generateupperlower = true ;
}
}
if ( plskin )
{
snprintf ( hashname , sizeof ( hashname ) , " %s$%s$%i " , model - > name , plskin - > name , surfnum ) ;
skinname = hashname ;
}
else if ( surfnum )
{
snprintf ( hashname , sizeof ( hashname ) , " %s$%i " , model - > name , surfnum ) ;
skinname = hashname ;
2014-03-30 08:55:06 +00:00
}
2019-07-29 05:28:20 +00:00
else
skinname = model - > name ;
2009-11-04 21:16:50 +00:00
for ( cm = Hash_Get ( & skincolourmapped , skinname ) ; cm ; cm = Hash_GetNext ( & skincolourmapped , skinname , cm ) )
{
2010-08-28 17:14:38 +00:00
if ( cm - > tcolour = = tc & & cm - > bcolour = = bc & & cm - > skinnum = = e - > skinnum & & cm - > subframe = = subframe & & cm - > pclass = = pc )
2009-11-04 21:16:50 +00:00
{
2012-02-12 05:18:31 +00:00
* forcedtex = & cm - > texnum ;
2012-07-05 19:42:36 +00:00
if ( ! shader )
shader = R_RegisterSkin ( skinname , NULL ) ;
2012-02-12 05:18:31 +00:00
return shader ;
2009-11-04 21:16:50 +00:00
}
2005-03-20 02:57:11 +00:00
}
2020-08-13 08:39:48 +00:00
if ( plskin )
{
original = Skin_TryCache8 ( plskin ) ; //will start it loading if not already loaded.
if ( plskin - > loadstate = = SKIN_LOADING )
return shader ;
inwidth = plskin - > width ;
inheight = plskin - > height ;
}
else
{
original = NULL ;
inwidth = 0 ;
inheight = 0 ;
}
2005-02-06 02:47:36 +00:00
//colourmap isn't present yet.
2015-05-03 19:57:46 +00:00
cm = Z_Malloc ( sizeof ( * cm ) ) ;
2012-02-12 05:18:31 +00:00
* forcedtex = & cm - > texnum ;
2005-02-06 02:47:36 +00:00
Q_strncpyz ( cm - > name , skinname , sizeof ( cm - > name ) ) ;
2005-02-09 19:32:09 +00:00
Hash_Add ( & skincolourmapped , cm - > name , cm , & cm - > bucket ) ;
2008-06-01 22:06:22 +00:00
cm - > tcolour = tc ;
cm - > bcolour = bc ;
2014-09-17 03:04:08 +00:00
cm - > pclass = pc ; //is this needed? surely it'll be baked as part of the modelname?
2005-02-06 02:47:36 +00:00
cm - > skinnum = e - > skinnum ;
2009-11-04 21:16:50 +00:00
cm - > subframe = subframe ;
2005-03-20 02:57:11 +00:00
2014-10-06 17:55:39 +00:00
//q2 has no surfaces in its player models, so don't crash from that
//note that q2 should also always have a custom skin set. its not our problem (here) if it doesn't.
2012-02-12 05:18:31 +00:00
if ( ! shader )
shader = R_RegisterSkin ( skinname , NULL ) ;
2015-05-03 19:57:46 +00:00
cm - > texnum . bump = shader - > defaulttextures - > bump ; //can't colour bumpmapping
2020-08-24 07:52:55 +00:00
if ( plskin )
2004-12-09 23:45:14 +00:00
{
2020-08-24 07:52:55 +00:00
if ( TEXLOADED ( plskin - > textures . base ) )
2009-07-17 22:28:16 +00:00
{
2013-03-12 22:56:10 +00:00
cm - > texnum . loweroverlay = plskin - > textures . loweroverlay ;
cm - > texnum . upperoverlay = plskin - > textures . upperoverlay ;
cm - > texnum . base = plskin - > textures . base ;
cm - > texnum . fullbright = plskin - > textures . fullbright ;
cm - > texnum . specular = plskin - > textures . specular ;
2015-05-03 19:57:46 +00:00
cm - > texnum . paletted = r_nulltex ;
cm - > texnum . reflectcube = r_nulltex ;
cm - > texnum . reflectmask = r_nulltex ;
2019-02-01 08:29:14 +00:00
cm - > texnum . displacement = r_nulltex ;
2012-02-12 05:18:31 +00:00
return shader ;
2009-07-17 22:28:16 +00:00
}
2004-12-09 23:45:14 +00:00
}
2005-02-06 02:47:36 +00:00
if ( ! original )
2004-08-22 22:29:09 +00:00
{
2014-10-11 19:39:45 +00:00
if ( skins & & skins - > numframes & & skins - > frame [ subframe ] . texels )
2005-02-06 02:47:36 +00:00
{
2014-10-05 20:04:11 +00:00
original = skins - > frame [ subframe ] . texels ;
2005-02-06 02:47:36 +00:00
inwidth = skins - > skinwidth ;
inheight = skins - > skinheight ;
}
2004-08-22 22:29:09 +00:00
else
{
2005-02-06 02:47:36 +00:00
original = NULL ;
inwidth = 0 ;
inheight = 0 ;
2004-08-22 22:29:09 +00:00
}
}
2014-10-11 19:39:45 +00:00
if ( skins )
{
tinwidth = skins - > skinwidth ;
tinheight = skins - > skinheight ;
}
else
{
tinwidth = inwidth ;
tinheight = inheight ;
}
2005-02-06 02:47:36 +00:00
if ( original )
2004-08-22 22:29:09 +00:00
{
2005-02-06 02:47:36 +00:00
int i , j ;
unsigned translate32 [ 256 ] ;
2014-08-25 07:35:41 +00:00
unsigned * pixels ;
2005-02-06 02:47:36 +00:00
unsigned * out ;
unsigned frac , fracstep ;
2005-11-26 03:02:55 +00:00
2005-02-06 02:47:36 +00:00
unsigned scaled_width , scaled_height ;
qbyte * inrow ;
2005-11-26 03:02:55 +00:00
2012-02-12 05:18:31 +00:00
cm - > texnum . base = r_nulltex ;
cm - > texnum . fullbright = r_nulltex ;
2005-11-26 03:02:55 +00:00
2005-02-06 02:47:36 +00:00
scaled_width = gl_max_size . value < 512 ? gl_max_size . value : 512 ;
scaled_height = gl_max_size . value < 512 ? gl_max_size . value : 512 ;
2005-11-26 03:02:55 +00:00
2008-01-16 03:19:14 +00:00
//handle the case of an external skin being smaller than the texture that its meant to replace
//(to support the evil hackage of the padding on the outside of common qw skins)
if ( tinwidth > inwidth )
tinwidth = inwidth ;
if ( tinheight > inheight )
tinheight = inheight ;
//don't make scaled width any larger than it needs to be
2014-09-02 02:44:43 +00:00
if ( sh_config . texture_non_power_of_two )
2008-01-16 03:19:14 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
scaled_width = tinwidth ;
scaled_height = tinheight ;
2008-01-16 03:19:14 +00:00
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
else
2008-01-16 03:19:14 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
for ( i = 0 ; i < 10 ; i + + )
{
scaled_width = ( 1 < < i ) ;
if ( scaled_width > = tinwidth )
break ; //its covered
}
for ( i = 0 ; i < 10 ; i + + )
{
scaled_height = ( 1 < < i ) ;
if ( scaled_height > = tinheight )
break ; //its covered
}
2008-01-16 03:19:14 +00:00
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( scaled_width > gl_max_size . value )
scaled_width = gl_max_size . value ; //whoops, we made it too big
2008-01-16 03:19:14 +00:00
if ( scaled_height > gl_max_size . value )
scaled_height = gl_max_size . value ; //whoops, we made it too big
2010-11-02 23:17:25 +00:00
if ( scaled_width < 4 )
scaled_width = 4 ;
if ( scaled_height < 4 )
scaled_height = 4 ;
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2010-08-28 17:14:38 +00:00
if ( h2playertranslations & & pc )
{
unsigned int color_offsets [ 5 ] = { 2 * 14 * 256 , 0 , 1 * 14 * 256 , 2 * 14 * 256 , 2 * 14 * 256 } ;
unsigned char * colorA , * colorB , * sourceA , * sourceB ;
colorA = h2playertranslations + 256 + color_offsets [ pc - 1 ] ;
colorB = colorA + 256 ;
sourceA = colorB + ( tc * 256 ) ;
sourceB = colorB + ( bc * 256 ) ;
for ( i = 0 ; i < 256 ; i + + )
{
translate32 [ i ] = d_8to24rgbtable [ i ] ;
2011-05-15 13:23:13 +00:00
if ( tc > 0 & & ( colorA [ i ] ! = 255 ) )
2014-10-11 19:39:45 +00:00
{
if ( tc > = 16 )
{
unsigned int v = d_8to24rgbtable [ colorA [ i ] ] ;
v = max ( max ( ( v > > 0 ) & 0xff , ( v > > 8 ) & 0xff ) , ( v > > 16 ) & 0xff ) ;
* ( ( unsigned char * ) & translate32 [ i ] + 0 ) = ( ( ( tc & 0xff0000 ) > > 16 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ i ] + 1 ) = ( ( ( tc & 0x00ff00 ) > > 8 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ i ] + 2 ) = ( ( ( tc & 0x0000ff ) > > 0 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ i ] + 3 ) = 0xff ;
}
else
translate32 [ i ] = d_8to24rgbtable [ sourceA [ i ] ] ;
}
2011-05-15 13:23:13 +00:00
if ( bc > 0 & & ( colorB [ i ] ! = 255 ) )
2014-10-11 19:39:45 +00:00
{
if ( bc > = 16 )
{
unsigned int v = d_8to24rgbtable [ colorB [ i ] ] ;
v = max ( max ( ( v > > 0 ) & 0xff , ( v > > 8 ) & 0xff ) , ( v > > 16 ) & 0xff ) ;
* ( ( unsigned char * ) & translate32 [ i ] + 0 ) = ( ( ( bc & 0xff0000 ) > > 16 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ i ] + 1 ) = ( ( ( bc & 0x00ff00 ) > > 8 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ i ] + 2 ) = ( ( ( bc & 0x0000ff ) > > 0 ) * v ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ i ] + 3 ) = 0xff ;
}
else
translate32 [ i ] = d_8to24rgbtable [ sourceB [ i ] ] ;
}
2010-08-28 17:14:38 +00:00
}
translate32 [ 0 ] = 0 ;
}
else
2014-09-17 03:04:08 +00:00
# endif
2005-02-06 02:47:36 +00:00
{
2008-06-01 22:06:22 +00:00
for ( i = 0 ; i < 256 ; i + + )
translate32 [ i ] = d_8to24rgbtable [ i ] ;
2005-11-26 03:02:55 +00:00
2008-06-01 22:06:22 +00:00
for ( i = 0 ; i < 16 ; i + + )
{
if ( tc > = 16 )
{
//assumption: row 0 is pure white.
2008-06-03 22:16:39 +00:00
* ( ( unsigned char * ) & translate32 [ TOP_RANGE + i ] + 0 ) = ( ( ( tc & 0xff0000 ) > > 16 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ i ] + 0 ) ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ TOP_RANGE + i ] + 1 ) = ( ( ( tc & 0x00ff00 ) > > 8 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ i ] + 1 ) ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ TOP_RANGE + i ] + 2 ) = ( ( ( tc & 0x0000ff ) > > 0 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ i ] + 2 ) ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ TOP_RANGE + i ] + 3 ) = 0xff ;
2008-06-01 22:06:22 +00:00
}
else
{
if ( tc < 8 )
translate32 [ TOP_RANGE + i ] = d_8to24rgbtable [ ( tc < < 4 ) + i ] ;
else
2008-12-06 02:04:29 +00:00
translate32 [ TOP_RANGE + i ] = d_8to24rgbtable [ ( tc < < 4 ) + 15 - i ] ;
2008-06-01 22:06:22 +00:00
}
if ( bc > = 16 )
{
2008-06-03 22:16:39 +00:00
* ( ( unsigned char * ) & translate32 [ BOTTOM_RANGE + i ] + 0 ) = ( ( ( bc & 0xff0000 ) > > 16 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ i ] + 0 ) ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ BOTTOM_RANGE + i ] + 1 ) = ( ( ( bc & 0x00ff00 ) > > 8 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ i ] + 1 ) ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ BOTTOM_RANGE + i ] + 2 ) = ( ( ( bc & 0x0000ff ) > > 0 ) * * ( ( unsigned char * ) & d_8to24rgbtable [ i ] + 2 ) ) > > 8 ;
* ( ( unsigned char * ) & translate32 [ BOTTOM_RANGE + i ] + 3 ) = 0xff ;
2008-06-01 22:06:22 +00:00
}
else
{
if ( bc < 8 )
translate32 [ BOTTOM_RANGE + i ] = d_8to24rgbtable [ ( bc < < 4 ) + i ] ;
else
translate32 [ BOTTOM_RANGE + i ] = d_8to24rgbtable [ ( bc < < 4 ) + 15 - i ] ;
}
}
2005-02-06 02:47:36 +00:00
}
2005-11-26 03:02:55 +00:00
2014-08-25 07:35:41 +00:00
pixels = malloc ( sizeof ( * pixels ) * scaled_height * scaled_width ) ;
2005-02-06 02:47:36 +00:00
out = pixels ;
fracstep = tinwidth * 0x10000 / scaled_width ;
for ( i = 0 ; i < scaled_height ; i + + , out + = scaled_width )
2004-08-22 22:29:09 +00:00
{
2005-03-28 00:11:59 +00:00
inrow = original + inwidth * ( i * inheight / scaled_height ) ;
2005-02-06 02:47:36 +00:00
frac = fracstep > > 1 ;
for ( j = 0 ; j < scaled_width ; j + = 4 )
{
out [ j ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 1 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 2 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 3 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
}
2004-08-22 22:29:09 +00:00
}
2013-03-12 22:44:00 +00:00
cm - > texnum . base = R_LoadTexture ( va ( " base$%x$%x$%i$%i$%i$%s " , tc , bc , cm - > skinnum , subframe , pc , cm - > name ) ,
scaled_width , scaled_height , h2playertranslations ? TF_RGBA32 : TF_RGBX32 , pixels , IF_NOMIPMAP ) ;
2005-11-26 03:02:55 +00:00
2015-05-03 19:57:46 +00:00
cm - > texnum . bump = shader - > defaulttextures - > bump ;
cm - > texnum . fullbright = shader - > defaulttextures - > fullbright ;
cm - > texnum . specular = shader - > defaulttextures - > specular ;
cm - > texnum . reflectcube = shader - > defaulttextures - > reflectcube ;
cm - > texnum . reflectmask = shader - > defaulttextures - > reflectmask ;
2018-01-03 04:40:06 +00:00
cm - > texnum . paletted = shader - > defaulttextures - > paletted ;
2019-02-01 08:29:14 +00:00
cm - > texnum . displacement = shader - > defaulttextures - > displacement ;
2018-01-03 04:40:06 +00:00
# ifdef HEXEN2 //too lazy to do this
if ( h2playertranslations & & pc )
;
else
# endif
if ( r_softwarebanding )
{
qbyte * pixels8 = ( void * ) pixels ;
qbyte * out8 ;
for ( i = 0 ; i < 256 ; i + + )
translate32 [ i ] = i ;
//fancy colours are not supported here. try to aproximate them.
if ( tc > = 16 )
tc = GetPaletteIndexNoFB ( ( tc > > 16 ) & 0xff , ( tc > > 8 ) & 0xff , ( tc > > 0 ) & 0xff ) / 16 ;
if ( bc > = 16 )
bc = GetPaletteIndexNoFB ( ( bc > > 16 ) & 0xff , ( bc > > 8 ) & 0xff , ( bc > > 0 ) & 0xff ) / 16 ;
for ( i = 0 ; i < 16 ; i + + )
{
if ( tc < 8 )
translate32 [ TOP_RANGE + i ] = ( tc < < 4 ) + i ;
else
translate32 [ TOP_RANGE + i ] = ( tc < < 4 ) + 15 - i ;
if ( bc < 8 )
translate32 [ BOTTOM_RANGE + i ] = ( bc < < 4 ) + i ;
else
translate32 [ BOTTOM_RANGE + i ] = ( bc < < 4 ) + 15 - i ;
}
fracstep = tinwidth * 0x10000 / scaled_width ;
for ( i = 0 , out8 = pixels8 ; i < scaled_height ; i + + , out8 + = scaled_width )
{
inrow = original + inwidth * ( i * inheight / scaled_height ) ;
frac = fracstep > > 1 ;
for ( j = 0 ; j < scaled_width ; j + = 4 )
{
out8 [ j ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out8 [ j + 1 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out8 [ j + 2 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out8 [ j + 3 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
}
}
cm - > texnum . paletted = R_LoadTexture ( va ( " paletted$%x$%x$%i$%i$%i$%s " , tc , bc , cm - > skinnum , subframe , pc , cm - > name ) ,
2019-02-16 19:09:07 +00:00
scaled_width , scaled_height , PTI_P8 , pixels8 , IF_NEAREST | IF_NOMIPMAP ) ;
2018-01-03 04:40:06 +00:00
}
2013-03-12 22:44:00 +00:00
/*if (!h2playertranslations)
2005-02-06 02:47:36 +00:00
{
2013-03-12 22:44:00 +00:00
qboolean valid = false ;
2010-08-28 17:14:38 +00:00
//now do the fullbrights.
out = pixels ;
fracstep = tinwidth * 0x10000 / scaled_width ;
for ( i = 0 ; i < scaled_height ; i + + , out + = scaled_width )
2005-02-06 02:47:36 +00:00
{
2010-08-28 17:14:38 +00:00
inrow = original + inwidth * ( i * inheight / scaled_height ) ;
frac = fracstep > > 1 ;
for ( j = 0 ; j < scaled_width ; j + = 1 )
{
if ( inrow [ frac > > 16 ] < 255 - vid . fullbright )
( ( char * ) ( & out [ j ] ) ) [ 3 ] = 0 ; //alpha 0
2013-03-12 22:44:00 +00:00
else
valid = true ;
2010-08-28 17:14:38 +00:00
frac + = fracstep ;
}
2005-02-06 02:47:36 +00:00
}
2013-03-12 22:44:00 +00:00
if ( valid )
cm - > texnum . fullbright = R_LoadTexture ( va ( " fb$%x$%x$%i$%i$%i$%s " , tc , bc , cm - > skinnum , subframe , pc , cm - > name ) ,
scaled_width , scaled_height , TF_RGBA32 , pixels , IF_NOMIPMAP ) ;
} */
2014-03-30 08:55:06 +00:00
if ( generateupperlower )
{
for ( i = 0 ; i < 256 ; i + + )
translate32 [ i ] = 0xff000000 ;
for ( i = 0 ; i < 16 ; i + + )
translate32 [ TOP_RANGE + i ] = d_8to24rgbtable [ i ] ;
out = pixels ;
fracstep = tinwidth * 0x10000 / scaled_width ;
for ( i = 0 ; i < scaled_height ; i + + , out + = scaled_width )
{
inrow = original + inwidth * ( i * inheight / scaled_height ) ;
frac = fracstep > > 1 ;
for ( j = 0 ; j < scaled_width ; j + = 4 )
{
out [ j ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 1 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 2 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 3 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
}
}
cm - > texnum . upperoverlay = R_LoadTexture ( va ( " up$%i$%i$%i$%s " , cm - > skinnum , subframe , pc , cm - > name ) ,
scaled_width , scaled_height , TF_RGBA32 , pixels , IF_NOMIPMAP ) ;
for ( i = 0 ; i < 256 ; i + + )
translate32 [ i ] = 0xff000000 ;
for ( i = 0 ; i < 16 ; i + + )
translate32 [ BOTTOM_RANGE + i ] = d_8to24rgbtable [ i ] ;
out = pixels ;
fracstep = tinwidth * 0x10000 / scaled_width ;
for ( i = 0 ; i < scaled_height ; i + + , out + = scaled_width )
{
inrow = original + inwidth * ( i * inheight / scaled_height ) ;
frac = fracstep > > 1 ;
for ( j = 0 ; j < scaled_width ; j + = 4 )
{
out [ j ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 1 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 2 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
out [ j + 3 ] = translate32 [ inrow [ frac > > 16 ] ] ;
frac + = fracstep ;
}
}
cm - > texnum . loweroverlay = R_LoadTexture ( va ( " lo$%i$%i$%i$%s " , cm - > skinnum , subframe , pc , cm - > name ) ,
scaled_width , scaled_height , TF_RGBA32 , pixels , IF_NOMIPMAP ) ;
}
2014-08-25 07:35:41 +00:00
free ( pixels ) ;
2004-08-22 22:29:09 +00:00
}
2005-02-06 02:47:36 +00:00
else
{
2012-02-12 05:18:31 +00:00
/*model has no original skin info and thus cannot be reskinned, copy over the default textures so that the skincache doesn't break things when it gets reused*/
2015-05-03 19:57:46 +00:00
cm - > texnum = * shader - > defaulttextures ;
2005-02-06 02:47:36 +00:00
}
2012-02-12 05:18:31 +00:00
return shader ;
2004-08-22 22:29:09 +00:00
}
}
2018-03-04 14:41:16 +00:00
# endif
2005-03-18 06:14:33 +00:00
if ( ! inf - > numskins )
return NULL ;
2013-07-14 12:22:51 +00:00
skins = inf - > ofsskins ;
2004-08-22 22:29:09 +00:00
if ( e - > skinnum > = 0 & & e - > skinnum < inf - > numskins )
skins + = e - > skinnum ;
2005-08-03 23:14:59 +00:00
else
2006-03-15 20:07:43 +00:00
{
2015-05-03 19:57:46 +00:00
if ( developer . ival )
{
static int lastframe ;
if ( lastframe ! = r_framecount & & lastframe ! = r_framecount - 1 ) //patented anti-spam technology!... actually, I wonder if it would actually be eligable for a patent.
Con_DPrintf ( " Skin number out of range (%u >= %u - %s) \n " , e - > skinnum , inf - > numskins , model - > name ) ;
lastframe = r_framecount ;
}
2006-03-15 20:07:43 +00:00
if ( ! inf - > numskins )
return NULL ;
}
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
if ( ! skins - > numframes )
2004-08-22 22:29:09 +00:00
return NULL ;
frame = cl . time * skins - > skinspeed ;
2014-10-05 20:04:11 +00:00
frame = frame % skins - > numframes ;
return skins - > frame [ frame ] . shader ;
2004-08-22 22:29:09 +00:00
}
2012-01-01 02:26:42 +00:00
# if defined(RTLIGHTS)
2004-08-22 22:29:09 +00:00
static void R_CalcFacing ( mesh_t * mesh , vec3_t lightpos )
{
float * v1 , * v2 , * v3 ;
vec3_t d1 , d2 , norm ;
int i ;
2004-10-19 16:10:14 +00:00
index_t * indexes = mesh - > indexes ;
2004-08-22 22:29:09 +00:00
int numtris = mesh - > numindexes / 3 ;
2005-11-26 03:02:55 +00:00
2004-08-22 22:29:09 +00:00
if ( numFacing < numtris )
{
if ( triangleFacing )
BZ_Free ( triangleFacing ) ;
triangleFacing = BZ_Malloc ( sizeof ( * triangleFacing ) * numtris ) ;
numFacing = numtris ;
}
for ( i = 0 ; i < numtris ; i + + , indexes + = 3 )
{
v1 = ( float * ) ( mesh - > xyz_array + indexes [ 0 ] ) ;
v2 = ( float * ) ( mesh - > xyz_array + indexes [ 1 ] ) ;
v3 = ( float * ) ( mesh - > xyz_array + indexes [ 2 ] ) ;
VectorSubtract ( v1 , v2 , d1 ) ;
VectorSubtract ( v3 , v2 , d2 ) ;
CrossProduct ( d1 , d2 , norm ) ;
triangleFacing [ i ] = ( ( lightpos [ 0 ] - v1 [ 0 ] ) * norm [ 0 ] + ( lightpos [ 1 ] - v1 [ 1 ] ) * norm [ 1 ] + ( lightpos [ 2 ] - v1 [ 2 ] ) * norm [ 2 ] ) > 0 ;
}
}
# define PROJECTION_DISTANCE 30000
static void R_ProjectShadowVolume ( mesh_t * mesh , vec3_t lightpos )
{
int numverts = mesh - > numvertexes ;
int i ;
2009-11-04 21:16:50 +00:00
vecV_t * input = mesh - > xyz_array ;
2004-08-22 22:29:09 +00:00
vec3_t * projected ;
if ( numProjectedShadowVerts < numverts )
{
if ( ProjectedShadowVerts )
BZ_Free ( ProjectedShadowVerts ) ;
ProjectedShadowVerts = BZ_Malloc ( sizeof ( * ProjectedShadowVerts ) * numverts ) ;
numProjectedShadowVerts = numverts ;
}
projected = ProjectedShadowVerts ;
for ( i = 0 ; i < numverts ; i + + )
{
projected [ i ] [ 0 ] = input [ i ] [ 0 ] + ( input [ i ] [ 0 ] - lightpos [ 0 ] ) * PROJECTION_DISTANCE ;
projected [ i ] [ 1 ] = input [ i ] [ 1 ] + ( input [ i ] [ 1 ] - lightpos [ 1 ] ) * PROJECTION_DISTANCE ;
projected [ i ] [ 2 ] = input [ i ] [ 2 ] + ( input [ i ] [ 2 ] - lightpos [ 2 ] ) * PROJECTION_DISTANCE ;
}
}
static void R_DrawShadowVolume ( mesh_t * mesh )
{
2012-01-01 02:26:42 +00:00
# ifdef GLQUAKE
2004-08-22 22:29:09 +00:00
int t ;
vec3_t * proj = ProjectedShadowVerts ;
2009-11-04 21:16:50 +00:00
vecV_t * verts = mesh - > xyz_array ;
2004-10-19 16:10:14 +00:00
index_t * indexes = mesh - > indexes ;
2004-08-22 22:29:09 +00:00
int * neighbours = mesh - > trneighbors ;
int numtris = mesh - > numindexes / 3 ;
2005-01-07 02:54:22 +00:00
qglBegin ( GL_TRIANGLES ) ;
2004-08-22 22:29:09 +00:00
for ( t = 0 ; t < numtris ; t + + )
{
if ( triangleFacing [ t ] )
{
//draw front
2005-01-07 02:54:22 +00:00
qglVertex3fv ( verts [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 2 ] ] ) ;
2004-08-22 22:29:09 +00:00
//draw back
2005-01-07 02:54:22 +00:00
qglVertex3fv ( proj [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 2 ] ] ) ;
2004-08-22 22:29:09 +00:00
//draw side caps
if ( neighbours [ t * 3 + 0 ] < 0 | | ! triangleFacing [ neighbours [ t * 3 + 0 ] ] )
{
2005-01-07 02:54:22 +00:00
qglVertex3fv ( verts [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 1 ] ] ) ;
2004-08-22 22:29:09 +00:00
}
if ( neighbours [ t * 3 + 1 ] < 0 | | ! triangleFacing [ neighbours [ t * 3 + 1 ] ] )
{
2005-01-07 02:54:22 +00:00
qglVertex3fv ( verts [ indexes [ t * 3 + 2 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 2 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 1 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 2 ] ] ) ;
2004-08-22 22:29:09 +00:00
}
if ( neighbours [ t * 3 + 2 ] < 0 | | ! triangleFacing [ neighbours [ t * 3 + 2 ] ] )
{
2005-01-07 02:54:22 +00:00
qglVertex3fv ( verts [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 2 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 2 ] ] ) ;
qglVertex3fv ( verts [ indexes [ t * 3 + 0 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 2 ] ] ) ;
qglVertex3fv ( proj [ indexes [ t * 3 + 0 ] ] ) ;
2004-08-22 22:29:09 +00:00
}
}
}
2005-01-07 02:54:22 +00:00
qglEnd ( ) ;
2012-01-01 02:26:42 +00:00
# endif
2004-08-22 22:29:09 +00:00
}
2009-11-07 13:29:15 +00:00
# endif
2004-10-19 16:10:14 +00:00
2009-11-04 21:16:50 +00:00
//true if no shading is to be used.
2012-07-05 19:42:36 +00:00
qboolean R_CalcModelLighting ( entity_t * e , model_t * clmodel )
2004-08-22 22:29:09 +00:00
{
vec3_t lightdir ;
2009-11-04 21:16:50 +00:00
int i ;
vec3_t dist ;
2015-01-21 18:18:37 +00:00
float add , m ;
2011-04-30 17:21:10 +00:00
vec3_t shadelight , ambientlight ;
2004-08-22 22:29:09 +00:00
2011-04-30 17:21:10 +00:00
if ( e - > light_known )
return e - > light_known - 1 ;
e - > light_dir [ 0 ] = 0 ; e - > light_dir [ 1 ] = 1 ; e - > light_dir [ 2 ] = 0 ;
2018-09-29 17:31:58 +00:00
if ( ( clmodel - > engineflags & MDLF_FLAME ) | | r_fullbright . ival )
2004-11-27 08:16:25 +00:00
{
2011-04-30 17:21:10 +00:00
e - > light_avg [ 0 ] = e - > light_avg [ 1 ] = e - > light_avg [ 2 ] = 1 ;
e - > light_range [ 0 ] = e - > light_range [ 1 ] = e - > light_range [ 2 ] = 0 ;
e - > light_known = 2 ;
return e - > light_known - 1 ;
2004-11-27 08:16:25 +00:00
}
2018-09-01 04:18:08 +00:00
if (
2017-02-19 00:15:42 +00:00
# ifdef HEXEN2
2018-09-01 04:18:08 +00:00
( e - > drawflags & MLS_MASK ) = = MLS_FULLBRIGHT | |
# endif
( e - > flags & RF_FULLBRIGHT ) )
2009-11-04 21:16:50 +00:00
{
2011-04-30 17:21:10 +00:00
e - > light_avg [ 0 ] = e - > light_avg [ 1 ] = e - > light_avg [ 2 ] = 1 ;
e - > light_range [ 0 ] = e - > light_range [ 1 ] = e - > light_range [ 2 ] = 0 ;
e - > light_known = 2 ;
return e - > light_known - 1 ;
2004-11-27 08:16:25 +00:00
}
2012-01-24 04:24:14 +00:00
if ( r_fb_models . ival = = 1 & & ruleset_allow_fbmodels . ival & & ( clmodel - > engineflags & MDLF_EZQUAKEFBCHEAT ) & & cls . protocol = = CP_QUAKEWORLD & & cl . deathmatch )
{
e - > light_avg [ 0 ] = e - > light_avg [ 1 ] = e - > light_avg [ 2 ] = 1 ;
e - > light_range [ 0 ] = e - > light_range [ 1 ] = e - > light_range [ 2 ] = 0 ;
e - > light_known = 2 ;
return e - > light_known - 1 ;
}
2004-11-27 08:16:25 +00:00
2014-03-31 17:06:41 +00:00
if ( ! ( r_refdef . flags & RDF_NOWORLDMODEL ) )
2004-08-22 22:29:09 +00:00
{
2014-03-31 17:06:41 +00:00
if ( e - > flags & RF_WEAPONMODEL )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2006-09-17 00:59:22 +00:00
cl . worldmodel - > funcs . LightPointValues ( cl . worldmodel , r_refdef . vieworg , shadelight , ambientlight , lightdir ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < 3 ; i + + )
{ /*viewmodels may not be pure black*/
if ( ambientlight [ i ] < 24 )
ambientlight [ i ] = 24 ;
}
}
2005-04-18 17:12:18 +00:00
else
2010-08-18 21:55:24 +00:00
{
vec3_t center ;
#if 0 /*hexen2*/
VectorAvg ( clmodel - > mins , clmodel - > maxs , center ) ;
VectorAdd ( e - > origin , center , center ) ;
# else
VectorCopy ( e - > origin , center ) ;
2020-02-11 23:12:33 +00:00
center [ 2 ] + = 24 ;
2010-08-18 21:55:24 +00:00
# endif
cl . worldmodel - > funcs . LightPointValues ( cl . worldmodel , center , shadelight , ambientlight , lightdir ) ;
}
2004-08-22 22:29:09 +00:00
}
else
{
2011-04-25 03:25:22 +00:00
ambientlight [ 0 ] = ambientlight [ 1 ] = ambientlight [ 2 ] = shadelight [ 0 ] = shadelight [ 1 ] = shadelight [ 2 ] = 128 ;
2004-08-22 22:29:09 +00:00
lightdir [ 0 ] = 0 ;
lightdir [ 1 ] = 1 ;
lightdir [ 2 ] = 1 ;
}
2018-01-03 04:40:06 +00:00
# ifdef HEXEN2
if ( ( e - > drawflags & MLS_MASK ) = = MLS_ABSLIGHT )
2004-08-22 22:29:09 +00:00
{
2018-01-03 04:40:06 +00:00
shadelight [ 0 ] = shadelight [ 1 ] = shadelight [ 2 ] = e - > abslight ;
ambientlight [ 0 ] = ambientlight [ 1 ] = ambientlight [ 2 ] = e - > abslight ;
}
else
# endif
2015-01-21 18:18:37 +00:00
2018-01-03 04:40:06 +00:00
if ( r_softwarebanding )
{
//mimic software rendering as closely as possible
lightdir [ 2 ] = 0 ; //horizontal light only.
VectorMA ( vec3_origin , 0.5 , shadelight , ambientlight ) ;
VectorCopy ( ambientlight , shadelight ) ;
if ( ! r_vertexdlights . ival & & r_dynamic . ival > 0 )
2004-08-22 22:29:09 +00:00
{
2018-01-03 04:40:06 +00:00
float * org = e - > origin ;
if ( e - > flags & RF_WEAPONMODEL )
org = r_refdef . vieworg ;
//don't do world lights, although that might be funny
for ( i = rtlights_first ; i < RTL_FIRST ; i + + )
2004-09-07 23:09:15 +00:00
{
2018-01-03 04:40:06 +00:00
if ( cl_dlights [ i ] . radius )
{
VectorSubtract ( org ,
cl_dlights [ i ] . origin ,
dist ) ;
add = cl_dlights [ i ] . radius - Length ( dist ) ;
2014-10-05 20:04:11 +00:00
# ifdef RTLIGHTS
2018-01-03 04:40:06 +00:00
if ( r_shadow_realtime_world . ival ) //if world lighting is on, there may be no lightmap influence even if r_dynamic is on.
add * = r_shadow_realtime_world_lightmaps . value ;
2014-10-05 20:04:11 +00:00
# endif
2018-01-03 04:40:06 +00:00
if ( add > 0 )
{
if ( r_dynamic . ival = = 2 )
{
ambientlight [ 0 ] + = add * 2 ;
ambientlight [ 1 ] + = add * 2 ;
ambientlight [ 2 ] + = add * 2 ;
}
else
{
ambientlight [ 0 ] + = add * cl_dlights [ i ] . color [ 0 ] ;
ambientlight [ 1 ] + = add * cl_dlights [ i ] . color [ 1 ] ;
ambientlight [ 2 ] + = add * cl_dlights [ i ] . color [ 2 ] ;
}
}
2004-09-07 23:09:15 +00:00
}
2004-08-22 22:29:09 +00:00
}
}
2018-01-03 04:40:06 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
if ( ambientlight [ i ] > 128 )
ambientlight [ i ] = 128 ;
if ( ambientlight [ i ] + shadelight [ i ] > 192 )
shadelight [ i ] = 192 - ambientlight [ i ] ;
}
2004-08-22 22:29:09 +00:00
}
2018-01-03 04:40:06 +00:00
else
2004-08-22 22:29:09 +00:00
{
2018-01-03 04:40:06 +00:00
if ( ! r_vertexdlights . ival & & r_dynamic . ival > 0 )
2004-08-22 22:29:09 +00:00
{
2018-01-03 04:40:06 +00:00
float * org = e - > origin ;
if ( e - > flags & RF_WEAPONMODEL )
org = r_refdef . vieworg ;
2006-05-11 02:30:13 +00:00
2018-01-03 04:40:06 +00:00
//don't do world lights, although that might be funny
for ( i = rtlights_first ; i < RTL_FIRST ; i + + )
2006-05-11 02:30:13 +00:00
{
2018-01-03 04:40:06 +00:00
if ( cl_dlights [ i ] . radius )
{
VectorSubtract ( org ,
cl_dlights [ i ] . origin ,
dist ) ;
add = cl_dlights [ i ] . radius - Length ( dist ) ;
# ifdef RTLIGHTS
if ( r_shadow_realtime_world . ival ) //if world lighting is on, there may be no lightmap influence even if r_dynamic is on.
add * = r_shadow_realtime_world_lightmaps . value ;
# endif
2011-04-30 17:21:10 +00:00
2018-01-03 04:40:06 +00:00
if ( add > 0 )
{
if ( r_dynamic . ival = = 2 )
{
ambientlight [ 0 ] + = add * 2 ;
ambientlight [ 1 ] + = add * 2 ;
ambientlight [ 2 ] + = add * 2 ;
//ZOID models should be affected by dlights as well
shadelight [ 0 ] + = add * 2 ;
shadelight [ 1 ] + = add * 2 ;
shadelight [ 2 ] + = add * 2 ;
}
else
{
ambientlight [ 0 ] + = add * cl_dlights [ i ] . color [ 0 ] ;
ambientlight [ 1 ] + = add * cl_dlights [ i ] . color [ 1 ] ;
ambientlight [ 2 ] + = add * cl_dlights [ i ] . color [ 2 ] ;
//ZOID models should be affected by dlights as well
shadelight [ 0 ] + = add * cl_dlights [ i ] . color [ 0 ] ;
shadelight [ 1 ] + = add * cl_dlights [ i ] . color [ 1 ] ;
shadelight [ 2 ] + = add * cl_dlights [ i ] . color [ 2 ] ;
}
}
}
2006-05-11 02:30:13 +00:00
}
2018-01-03 04:40:06 +00:00
}
2018-10-27 04:32:18 +00:00
switch ( PTI_E5BGR9 ) //lightmap_fmt)
2018-01-03 04:40:06 +00:00
{
2018-10-27 04:32:18 +00:00
//don't clamp model lighting if we're not clamping world lighting either.
2018-03-04 14:41:16 +00:00
case PTI_E5BGR9 :
case PTI_RGBA16F :
case PTI_RGBA32F :
break ;
2018-09-23 19:35:24 +00:00
default : //non-hdr lightmap format. clamp model lighting to match the lightmap's clamps.
2018-03-04 14:41:16 +00:00
m = max ( max ( ambientlight [ 0 ] , ambientlight [ 1 ] ) , ambientlight [ 2 ] ) ;
if ( m > 255 )
{
ambientlight [ 0 ] * = 255.0 / m ;
ambientlight [ 1 ] * = 255.0 / m ;
ambientlight [ 2 ] * = 255.0 / m ;
}
m = max ( max ( shadelight [ 0 ] , shadelight [ 1 ] ) , shadelight [ 2 ] ) ;
if ( m > 128 )
{
shadelight [ 0 ] * = 128.0 / m ;
shadelight [ 1 ] * = 128.0 / m ;
shadelight [ 2 ] * = 128.0 / m ;
}
break ;
2018-01-03 04:40:06 +00:00
}
//MORE HUGE HACKS! WHEN WILL THEY CEASE!
// clamp lighting so it doesn't overbright as much
// ZOID: never allow players to go totally black
if ( clmodel - > engineflags & MDLF_PLAYER )
{
float fb = r_fullbrightSkins . value ;
if ( fb > cls . allow_fbskins )
fb = cls . allow_fbskins ;
if ( fb < 0 )
fb = 0 ;
if ( fb )
2004-08-22 22:29:09 +00:00
{
2018-01-03 04:40:06 +00:00
extern cvar_t r_fb_models ;
if ( fb > = 1 & & r_fb_models . value )
2006-05-11 02:30:13 +00:00
{
2018-01-03 04:40:06 +00:00
ambientlight [ 0 ] = ambientlight [ 1 ] = ambientlight [ 2 ] = 1 ;
shadelight [ 0 ] = shadelight [ 1 ] = shadelight [ 2 ] = 1 ;
2018-07-22 11:49:37 +00:00
VectorSet ( e - > light_dir , 1 , 0 , 0 ) ;
VectorClear ( e - > light_range ) ;
VectorScale ( shadelight , fb , e - > light_avg ) ;
2018-01-03 04:40:06 +00:00
e - > light_known = 2 ;
return e - > light_known - 1 ;
}
else
{
for ( i = 0 ; i < 3 ; i + + )
{
ambientlight [ i ] = max ( ambientlight [ i ] , 8 + fb * 120 ) ;
shadelight [ i ] = max ( shadelight [ i ] , 8 + fb * 120 ) ;
}
2006-05-11 02:30:13 +00:00
}
2004-08-22 22:29:09 +00:00
}
2018-01-03 04:40:06 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
if ( ambientlight [ i ] < 8 )
ambientlight [ i ] = 8 ;
}
2004-08-22 22:29:09 +00:00
}
2009-11-04 21:16:50 +00:00
2018-01-03 04:40:06 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
if ( ambientlight [ i ] > 128 )
ambientlight [ i ] = 128 ;
2004-08-22 22:29:09 +00:00
2018-01-03 04:40:06 +00:00
shadelight [ i ] / = 200.0 / 255 ;
ambientlight [ i ] / = 200.0 / 255 ;
}
2004-08-22 22:29:09 +00:00
2018-01-03 04:40:06 +00:00
if ( ( e - > model - > flags & MF_ROTATE ) & & cl . hexen2pickups )
{
shadelight [ 0 ] = shadelight [ 1 ] = shadelight [ 2 ] =
ambientlight [ 0 ] = ambientlight [ 1 ] = ambientlight [ 2 ] = 128 + sin ( cl . servertime * 4 ) * 64 ;
}
2004-08-22 22:29:09 +00:00
}
2015-01-21 18:18:37 +00:00
if ( e - > flags & RF_WEAPONMODEL )
{
vec3_t temp ;
temp [ 0 ] = DotProduct ( lightdir , vpn ) ;
temp [ 1 ] = - DotProduct ( lightdir , vright ) ;
temp [ 2 ] = DotProduct ( lightdir , vup ) ;
e - > light_dir [ 0 ] = DotProduct ( temp , e - > axis [ 0 ] ) ;
e - > light_dir [ 1 ] = DotProduct ( temp , e - > axis [ 1 ] ) ;
e - > light_dir [ 2 ] = DotProduct ( temp , e - > axis [ 2 ] ) ;
}
else
{
2011-04-30 17:21:10 +00:00
e - > light_dir [ 0 ] = DotProduct ( lightdir , e - > axis [ 0 ] ) ;
e - > light_dir [ 1 ] = DotProduct ( lightdir , e - > axis [ 1 ] ) ;
e - > light_dir [ 2 ] = DotProduct ( lightdir , e - > axis [ 2 ] ) ;
2004-08-22 22:29:09 +00:00
}
2015-01-21 18:18:37 +00:00
VectorNormalize ( e - > light_dir ) ;
2005-08-03 23:14:59 +00:00
2009-11-04 21:16:50 +00:00
shadelight [ 0 ] * = 1 / 255.0f ;
shadelight [ 1 ] * = 1 / 255.0f ;
shadelight [ 2 ] * = 1 / 255.0f ;
ambientlight [ 0 ] * = 1 / 255.0f ;
ambientlight [ 1 ] * = 1 / 255.0f ;
ambientlight [ 2 ] * = 1 / 255.0f ;
2005-08-03 23:14:59 +00:00
if ( e - > flags & Q2RF_GLOW )
{
2014-05-10 13:42:13 +00:00
float scale = 1 + 0.2 * sin ( cl . time * 7 ) ;
VectorScale ( ambientlight , scale , ambientlight ) ;
VectorScale ( shadelight , scale , shadelight ) ;
2005-08-03 23:14:59 +00:00
}
2011-04-30 17:21:10 +00:00
2018-01-03 04:40:06 +00:00
if ( r_softwarebanding )
{ //overbright the models.
VectorScale ( ambientlight , 2 , e - > light_avg ) ;
VectorScale ( shadelight , 2 , e - > light_range ) ;
}
else
{ //calculate average and range, to allow for negative lighting dotproducts
VectorMA ( ambientlight , 0.5 , shadelight , e - > light_avg ) ;
VectorSubtract ( shadelight , ambientlight , e - > light_range ) ;
}
2011-04-30 17:21:10 +00:00
e - > light_known = 1 ;
return e - > light_known - 1 ;
2009-11-04 21:16:50 +00:00
}
2005-08-03 23:14:59 +00:00
2010-08-28 17:14:38 +00:00
void R_GAlias_DrawBatch ( batch_t * batch )
2009-11-04 21:16:50 +00:00
{
2010-08-28 17:14:38 +00:00
entity_t * e ;
2005-11-26 03:02:55 +00:00
2010-08-28 17:14:38 +00:00
galiasinfo_t * inf ;
model_t * clmodel ;
2020-08-13 08:39:48 +00:00
unsigned int surfnum ;
2010-08-28 17:14:38 +00:00
static mesh_t mesh ;
static mesh_t * meshl = & mesh ;
2004-08-22 22:29:09 +00:00
2013-05-11 05:03:07 +00:00
// qboolean needrecolour;
// qboolean nolightdir;
2004-08-22 22:29:09 +00:00
2010-08-28 17:14:38 +00:00
e = batch - > ent ;
clmodel = e - > model ;
currententity = e ;
2013-05-11 05:03:07 +00:00
/*nolightdir =*/ R_CalcModelLighting ( e , clmodel ) ;
2010-08-28 17:14:38 +00:00
2013-07-14 12:22:51 +00:00
inf = Mod_Extradata ( clmodel ) ;
2010-11-02 23:17:25 +00:00
if ( inf )
2010-08-28 17:14:38 +00:00
{
2010-11-02 23:17:25 +00:00
memset ( & mesh , 0 , sizeof ( mesh ) ) ;
2013-07-14 12:22:51 +00:00
for ( surfnum = 0 ; inf ; inf = inf - > nextsurf , surfnum + + )
2010-08-28 17:14:38 +00:00
{
2020-08-13 08:39:48 +00:00
if ( batch - > user . alias . surfrefs [ 0 ] = = surfnum )
2010-11-02 23:17:25 +00:00
{
2016-07-12 00:40:13 +00:00
/*needrecolour =*/ Alias_GAliasBuildMesh ( & mesh , & batch - > vbo , inf , surfnum , e , batch - > shader - > prog & & ( batch - > shader - > prog - > supportedpermutations & PERMUTATION_SKELETAL ) ) ;
2010-11-02 23:17:25 +00:00
batch - > mesh = & meshl ;
2015-06-28 00:42:00 +00:00
if ( ! mesh . numindexes )
{
batch - > meshes = 0 ; //something went screwy
batch - > mesh = NULL ;
}
2010-11-02 23:17:25 +00:00
return ;
}
2010-08-28 17:14:38 +00:00
}
}
2010-11-02 23:17:25 +00:00
batch - > meshes = 0 ;
Con_Printf ( " Broken model surfaces mid-frame \n " ) ;
return ;
2010-08-28 17:14:38 +00:00
}
void R_GAlias_GenerateBatches ( entity_t * e , batch_t * * batches )
{
galiasinfo_t * inf ;
model_t * clmodel ;
2012-02-12 05:18:31 +00:00
shader_t * shader , * regshader ;
2010-08-28 17:14:38 +00:00
batch_t * b ;
2014-09-20 04:11:39 +00:00
int surfnum , j ;
2011-04-25 03:25:22 +00:00
shadersort_t sort ;
2019-07-29 05:28:20 +00:00
float lod ;
2004-08-22 22:29:09 +00:00
2010-08-28 17:14:38 +00:00
texnums_t * skin ;
2009-11-04 21:16:50 +00:00
2018-10-11 10:31:23 +00:00
if ( ( r_refdef . externalview | | r_refdef . recurse ) & & ( e - > flags & RF_WEAPONMODEL ) )
2009-11-04 21:16:50 +00:00
return ;
2004-08-22 22:29:09 +00:00
2013-10-08 14:28:11 +00:00
clmodel = e - > model ;
2018-03-04 14:41:16 +00:00
# ifdef QWSKINS
2010-08-28 17:14:38 +00:00
/*switch model if we're the player model, and the player skin says a new model*/
2005-05-17 02:36:54 +00:00
{
2009-11-04 21:16:50 +00:00
extern int cl_playerindex ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( e - > playerindex > = 0 & & e - > model = = cl . model_precache [ cl_playerindex ] )
2009-11-04 21:16:50 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
clmodel = cl . players [ e - > playerindex ] . model ;
2013-10-08 14:28:11 +00:00
if ( ! clmodel | | clmodel - > type ! = mod_alias )
clmodel = e - > model ; //oops, never mind
2009-11-04 21:16:50 +00:00
}
2005-05-17 02:36:54 +00:00
}
2018-03-04 14:41:16 +00:00
# endif
2009-11-04 21:16:50 +00:00
2014-03-31 17:06:41 +00:00
if ( ! ( e - > flags & RF_WEAPONMODEL )
2014-03-30 08:55:06 +00:00
# ifdef SKELETALMODELS
& & ! e - > framestate . bonestate
# endif
)
2004-08-22 22:29:09 +00:00
{
2009-11-04 21:16:50 +00:00
if ( R_CullEntityBox ( e , clmodel - > mins , clmodel - > maxs ) )
return ;
# ifdef RTLIGHTS
if ( BE_LightCullModel ( e - > origin , clmodel ) )
return ;
}
else
{
if ( BE_LightCullModel ( r_origin , clmodel ) )
return ;
# endif
}
2010-08-28 17:14:38 +00:00
if ( clmodel - > tainted )
2004-08-22 22:29:09 +00:00
{
2010-08-28 17:14:38 +00:00
if ( ! ruleset_allow_modified_eyes . ival & & ! strcmp ( clmodel - > name , " progs/eyes.mdl " ) )
return ;
2004-08-22 22:29:09 +00:00
}
2008-01-19 05:59:00 +00:00
2013-07-14 12:22:51 +00:00
inf = Mod_Extradata ( clmodel ) ;
2004-08-22 22:29:09 +00:00
2019-07-29 05:28:20 +00:00
if ( clmodel - > maxlod )
{
vec3_t v ;
float z ;
VectorSubtract ( e - > origin , r_refdef . vieworg , v ) ;
z = DotProduct ( v , vpn ) ;
if ( z < - clmodel - > radius )
return ; //furthest extent of bounding sphere is nearer than the near clip plane, and thus completely invisible
else if ( z < 0 )
lod = 0 ; //nearer than the camera, use the highest lod
else
{
//if the ent is in the middle of the screen, then the right edge of its sphere is at what percentage of the width of the screen...?
//simplified Matrix4x4_CM_Transform4
float coverage = ( r_refdef . m_projection_std [ 5 ] * clmodel - > radius + r_refdef . m_projection_std [ 9 ] * - z + r_refdef . m_projection_std [ 13 ] ) /
( r_refdef . m_projection_std [ 7 ] * clmodel - > radius + r_refdef . m_projection_std [ 11 ] * - z + r_refdef . m_projection_std [ 15 ] ) ;
lod = 1 - ( coverage * r_lodscale . value ) ;
lod = bound ( 0 , lod , 1 ) ; //so lodbias is a little more reliable.
lod * = clmodel - > maxlod ;
lod + = r_lodbias . value ;
lod = max ( 0 , lod ) ; //never nearer than 0, the min value check wouldn't cope.
}
}
else
lod = 0 ;
2013-07-14 12:22:51 +00:00
for ( surfnum = 0 ; inf ; inf = inf - > nextsurf , surfnum + + )
2004-08-22 22:29:09 +00:00
{
2019-09-04 08:32:22 +00:00
if ( ! inf - > numindexes )
continue ;
2019-07-29 05:28:20 +00:00
if ( lod < inf - > mindist | | ( inf - > maxdist & & lod > = inf - > maxdist ) )
continue ;
2012-02-12 05:18:31 +00:00
regshader = GL_ChooseSkin ( inf , clmodel , surfnum , e , & skin ) ;
if ( ! regshader )
2010-09-15 09:06:31 +00:00
continue ;
2015-05-03 19:57:46 +00:00
skin = skin ? skin : NULL ;
2012-02-12 05:18:31 +00:00
shader = e - > forcedshader ? e - > forcedshader : regshader ;
2018-03-23 06:35:32 +00:00
if ( shader & & ! ( shader - > flags & SHADER_NODRAW ) )
2004-10-19 16:10:14 +00:00
{
2010-08-28 17:14:38 +00:00
b = BE_GetTempBatch ( ) ;
if ( ! b )
break ;
b - > buildmeshes = R_GAlias_DrawBatch ;
b - > ent = e ;
2018-07-24 13:59:42 +00:00
b - > envmap = Mod_CubemapForOrigin ( cl . worldmodel , e - > origin ) ;
2017-11-30 17:59:11 +00:00
# if defined(Q3BSPS) || defined(RFBSPS)
2014-10-05 20:04:11 +00:00
b - > fog = Mod_FogForOrigin ( cl . worldmodel , e - > origin ) ;
2012-10-08 05:30:46 +00:00
# endif
2010-08-28 17:14:38 +00:00
b - > mesh = NULL ;
b - > firstmesh = 0 ;
b - > meshes = 1 ;
b - > skin = skin ;
b - > texture = NULL ;
b - > shader = shader ;
2014-09-20 04:11:39 +00:00
for ( j = 0 ; j < MAXRLIGHTMAPS ; j + + )
2020-08-13 08:39:48 +00:00
{
2015-06-22 11:49:15 +00:00
b - > lightmap [ j ] = - 1 ;
2020-08-13 08:39:48 +00:00
b - > lmlightstyle [ j ] = INVALID_LIGHTSTYLE ;
}
b - > user . alias . surfrefs [ 0 ] = surfnum ;
2010-11-02 23:17:25 +00:00
b - > flags = 0 ;
2011-04-25 03:25:22 +00:00
sort = shader - > sort ;
2012-04-09 19:12:12 +00:00
if ( e - > flags & RF_FORCECOLOURMOD )
b - > flags | = BEF_FORCECOLOURMOD ;
2014-03-31 17:06:41 +00:00
if ( e - > flags & RF_ADDITIVE )
2011-04-25 03:25:22 +00:00
{
2011-04-23 20:37:20 +00:00
b - > flags | = BEF_FORCEADDITIVE ;
2011-04-25 03:25:22 +00:00
if ( sort < SHADER_SORT_ADDITIVE )
sort = SHADER_SORT_ADDITIVE ;
}
2014-03-31 17:06:41 +00:00
if ( e - > flags & RF_TRANSLUCENT )
2011-04-25 03:25:22 +00:00
{
2011-04-23 20:37:20 +00:00
b - > flags | = BEF_FORCETRANSPARENT ;
2011-09-03 03:49:43 +00:00
if ( SHADER_SORT_PORTAL < sort & & sort < SHADER_SORT_BLEND )
2011-04-25 03:25:22 +00:00
sort = SHADER_SORT_BLEND ;
}
2017-02-19 00:15:42 +00:00
# ifdef HEXEN2
2014-04-12 03:31:59 +00:00
else if ( e - > drawflags & DRF_TRANSLUCENT )
{
b - > flags | = BEF_FORCETRANSPARENT ;
if ( SHADER_SORT_PORTAL < sort & & sort < SHADER_SORT_BLEND )
sort = SHADER_SORT_BLEND ;
e - > shaderRGBAf [ 3 ] = r_wateralpha . value ;
}
2017-02-19 00:15:42 +00:00
# endif
2011-04-23 20:37:20 +00:00
if ( e - > flags & RF_NODEPTHTEST )
2011-04-25 03:25:22 +00:00
{
2011-04-23 20:37:20 +00:00
b - > flags | = BEF_FORCENODEPTH ;
2011-04-25 03:25:22 +00:00
if ( sort < SHADER_SORT_NEAREST )
sort = SHADER_SORT_NEAREST ;
}
if ( e - > flags & RF_NOSHADOW )
b - > flags | = BEF_NOSHADOWS ;
2011-12-23 03:12:29 +00:00
b - > vbo = NULL ;
2011-04-25 03:25:22 +00:00
b - > next = batches [ sort ] ;
batches [ sort ] = b ;
2004-08-22 22:29:09 +00:00
}
}
}
2010-11-15 02:40:31 +00:00
#if 0
void R_Sprite_GenerateBatches ( entity_t * e , batch_t * * batches )
{
galiasinfo_t * inf ;
model_t * clmodel ;
shader_t * shader ;
batch_t * b ;
int surfnum ;
texnums_t * skin ;
if ( r_refdef . externalview & & e - > flags & Q2RF_WEAPONMODEL )
return ;
clmodel = e - > model ;
if ( ! ( e - > flags & Q2RF_WEAPONMODEL ) )
{
if ( R_CullEntityBox ( e , clmodel - > mins , clmodel - > maxs ) )
return ;
# ifdef RTLIGHTS
if ( BE_LightCullModel ( e - > origin , clmodel ) )
return ;
}
else
{
if ( BE_LightCullModel ( r_origin , clmodel ) )
return ;
# endif
}
if ( clmodel - > tainted )
{
if ( ! ruleset_allow_modified_eyes . ival & & ! strcmp ( clmodel - > name , " progs/eyes.mdl " ) )
return ;
}
inf = RMod_Extradata ( clmodel ) ;
if ( ! e - > model | | e - > forcedshader )
{
//fixme
return ;
}
else
{
frame = R_GetSpriteFrame ( e ) ;
psprite = e - > model - > cache . data ;
sprtype = psprite - > type ;
shader = frame - > shader ;
}
if ( shader )
{
b = BE_GetTempBatch ( ) ;
if ( ! b )
break ;
b - > buildmeshes = R_Sprite_DrawBatch ;
b - > ent = e ;
b - > mesh = NULL ;
b - > firstmesh = 0 ;
b - > meshes = 1 ;
b - > skin = frame - ;
b - > texture = NULL ;
b - > shader = frame - > shader ;
2015-06-22 11:49:15 +00:00
for ( j = 0 ; j < MAXRLIGHTMAPS ; j + + )
b - > lightmap [ j ] = - 1 ;
2010-11-15 02:40:31 +00:00
b - > surf_first = surfnum ;
b - > flags = 0 ;
2011-12-23 03:12:29 +00:00
b - > vbo = NULL ;
2010-11-15 02:40:31 +00:00
b - > next = batches [ shader - > sort ] ;
batches [ shader - > sort ] = b ;
}
}
# endif
2010-07-11 02:22:39 +00:00
//returns the rotated offset of the two points in result
2009-07-05 18:45:53 +00:00
void RotateLightVector ( const vec3_t * axis , const vec3_t origin , const vec3_t lightpoint , vec3_t result )
2004-08-22 22:29:09 +00:00
{
2005-08-03 23:14:59 +00:00
vec3_t offs ;
2004-12-09 23:45:14 +00:00
offs [ 0 ] = lightpoint [ 0 ] - origin [ 0 ] ;
offs [ 1 ] = lightpoint [ 1 ] - origin [ 1 ] ;
offs [ 2 ] = lightpoint [ 2 ] - origin [ 2 ] ;
2005-08-03 23:14:59 +00:00
result [ 0 ] = DotProduct ( offs , axis [ 0 ] ) ;
result [ 1 ] = DotProduct ( offs , axis [ 1 ] ) ;
result [ 2 ] = DotProduct ( offs , axis [ 2 ] ) ;
2004-12-09 23:45:14 +00:00
}
2012-01-01 02:26:42 +00:00
# if defined(RTLIGHTS)
2013-03-12 22:47:42 +00:00
/*
2012-01-01 02:26:42 +00:00
static void GL_LightMesh ( mesh_t * mesh , vec3_t lightpos , vec3_t colours , float radius )
2004-12-09 23:45:14 +00:00
{
vec3_t dir ;
int i ;
2005-08-03 23:14:59 +00:00
float dot , d , f , a ;
2009-11-04 21:16:50 +00:00
vecV_t * xyz = mesh - > xyz_array ;
2004-12-09 23:45:14 +00:00
vec3_t * normals = mesh - > normals_array ;
2009-11-04 21:16:50 +00:00
vec4_t * out = mesh - > colors4f_array ;
2005-08-03 23:14:59 +00:00
if ( ! out )
return ; //urm..
2004-12-09 23:45:14 +00:00
if ( normals )
{
for ( i = 0 ; i < mesh - > numvertexes ; i + + )
{
VectorSubtract ( lightpos , xyz [ i ] , dir ) ;
dot = DotProduct ( dir , normals [ i ] ) ;
2005-08-03 23:14:59 +00:00
if ( dot > 0 )
{
d = DotProduct ( dir , dir ) / radius ;
a = 1 / d ;
if ( a > 0 )
{
a * = dot / sqrt ( d ) ;
2009-11-04 21:16:50 +00:00
f = a * colours [ 0 ] ;
2005-08-03 23:14:59 +00:00
out [ i ] [ 0 ] = f ;
2009-11-04 21:16:50 +00:00
f = a * colours [ 1 ] ;
2005-08-03 23:14:59 +00:00
out [ i ] [ 1 ] = f ;
2009-11-04 21:16:50 +00:00
f = a * colours [ 2 ] ;
2005-08-03 23:14:59 +00:00
out [ i ] [ 2 ] = f ;
}
else
{
out [ i ] [ 0 ] = 0 ;
out [ i ] [ 1 ] = 0 ;
out [ i ] [ 2 ] = 0 ;
}
}
else
{
out [ i ] [ 0 ] = 0 ;
out [ i ] [ 1 ] = 0 ;
out [ i ] [ 2 ] = 0 ;
}
2009-11-04 21:16:50 +00:00
out [ i ] [ 3 ] = 1 ;
2004-12-09 23:45:14 +00:00
}
}
else
{
for ( i = 0 ; i < mesh - > numvertexes ; i + + )
{
VectorSubtract ( lightpos , xyz [ i ] , dir ) ;
2009-11-04 21:16:50 +00:00
out [ i ] [ 0 ] = colours [ 0 ] ;
out [ i ] [ 1 ] = colours [ 1 ] ;
out [ i ] [ 2 ] = colours [ 2 ] ;
out [ i ] [ 3 ] = 1 ;
2004-12-09 23:45:14 +00:00
}
}
}
2013-03-12 22:47:42 +00:00
*/
2004-12-09 23:45:14 +00:00
2005-09-08 02:02:09 +00:00
//courtesy of DP
2016-07-12 00:40:13 +00:00
static void R_BuildBumpVectors ( const float * v0 , const float * v1 , const float * v2 , const float * tc0 , const float * tc1 , const float * tc2 , float * fte_restrict svector3f , float * fte_restrict tvector3f , float * fte_restrict normal3f )
2005-09-08 02:02:09 +00:00
{
float f , tangentcross [ 3 ] , v10 [ 3 ] , v20 [ 3 ] , tc10 [ 2 ] , tc20 [ 2 ] ;
// 79 add/sub/negate/multiply (1 cycle), 1 compare (3 cycle?), total cycles not counting load/store/exchange roughly 82 cycles
// 6 add, 28 subtract, 39 multiply, 1 compare, 50% chance of 6 negates
// 6 multiply, 9 subtract
VectorSubtract ( v1 , v0 , v10 ) ;
VectorSubtract ( v2 , v0 , v20 ) ;
normal3f [ 0 ] = v10 [ 1 ] * v20 [ 2 ] - v10 [ 2 ] * v20 [ 1 ] ;
normal3f [ 1 ] = v10 [ 2 ] * v20 [ 0 ] - v10 [ 0 ] * v20 [ 2 ] ;
normal3f [ 2 ] = v10 [ 0 ] * v20 [ 1 ] - v10 [ 1 ] * v20 [ 0 ] ;
// 12 multiply, 10 subtract
tc10 [ 1 ] = tc1 [ 1 ] - tc0 [ 1 ] ;
tc20 [ 1 ] = tc2 [ 1 ] - tc0 [ 1 ] ;
svector3f [ 0 ] = tc10 [ 1 ] * v20 [ 0 ] - tc20 [ 1 ] * v10 [ 0 ] ;
svector3f [ 1 ] = tc10 [ 1 ] * v20 [ 1 ] - tc20 [ 1 ] * v10 [ 1 ] ;
svector3f [ 2 ] = tc10 [ 1 ] * v20 [ 2 ] - tc20 [ 1 ] * v10 [ 2 ] ;
tc10 [ 0 ] = tc1 [ 0 ] - tc0 [ 0 ] ;
tc20 [ 0 ] = tc2 [ 0 ] - tc0 [ 0 ] ;
tvector3f [ 0 ] = tc10 [ 0 ] * v20 [ 0 ] - tc20 [ 0 ] * v10 [ 0 ] ;
tvector3f [ 1 ] = tc10 [ 0 ] * v20 [ 1 ] - tc20 [ 0 ] * v10 [ 1 ] ;
tvector3f [ 2 ] = tc10 [ 0 ] * v20 [ 2 ] - tc20 [ 0 ] * v10 [ 2 ] ;
// 12 multiply, 4 add, 6 subtract
f = DotProduct ( svector3f , normal3f ) ;
svector3f [ 0 ] - = f * normal3f [ 0 ] ;
svector3f [ 1 ] - = f * normal3f [ 1 ] ;
svector3f [ 2 ] - = f * normal3f [ 2 ] ;
f = DotProduct ( tvector3f , normal3f ) ;
tvector3f [ 0 ] - = f * normal3f [ 0 ] ;
tvector3f [ 1 ] - = f * normal3f [ 1 ] ;
tvector3f [ 2 ] - = f * normal3f [ 2 ] ;
// if texture is mapped the wrong way (counterclockwise), the tangents
// have to be flipped, this is detected by calculating a normal from the
// two tangents, and seeing if it is opposite the surface normal
// 9 multiply, 2 add, 3 subtract, 1 compare, 50% chance of: 6 negates
CrossProduct ( tvector3f , svector3f , tangentcross ) ;
if ( DotProduct ( tangentcross , normal3f ) < 0 )
{
VectorNegate ( svector3f , svector3f ) ;
VectorNegate ( tvector3f , tvector3f ) ;
}
}
2016-07-12 00:40:13 +00:00
#if 0
2005-09-08 02:02:09 +00:00
//courtesy of DP
2016-07-12 00:40:13 +00:00
void R_AliasGenerateTextureVectors ( mesh_t * mesh , float * fte_restrict normal3f , float * fte_restrict svector3f , float * fte_restrict tvector3f )
2005-09-08 02:02:09 +00:00
{
int i ;
float sdir [ 3 ] , tdir [ 3 ] , normal [ 3 ] , * v ;
2007-05-25 22:16:29 +00:00
index_t * e ;
2005-09-08 02:02:09 +00:00
float * vertex3f = ( float * ) mesh - > xyz_array ;
float * texcoord2f = ( float * ) mesh - > st_array ;
// clear the vectors
// if (svector3f)
memset ( svector3f , 0 , mesh - > numvertexes * sizeof ( float [ 3 ] ) ) ;
// if (tvector3f)
memset ( tvector3f , 0 , mesh - > numvertexes * sizeof ( float [ 3 ] ) ) ;
// if (normal3f)
memset ( normal3f , 0 , mesh - > numvertexes * sizeof ( float [ 3 ] ) ) ;
// process each vertex of each triangle and accumulate the results
for ( e = mesh - > indexes ; e < mesh - > indexes + mesh - > numindexes ; e + = 3 )
{
R_BuildBumpVectors ( vertex3f + e [ 0 ] * 3 , vertex3f + e [ 1 ] * 3 , vertex3f + e [ 2 ] * 3 , texcoord2f + e [ 0 ] * 2 , texcoord2f + e [ 1 ] * 2 , texcoord2f + e [ 2 ] * 2 , sdir , tdir , normal ) ;
// if (!areaweighting)
// {
// VectorNormalize(sdir);
// VectorNormalize(tdir);
// VectorNormalize(normal);
// }
// if (svector3f)
for ( i = 0 ; i < 3 ; i + + )
VectorAdd ( svector3f + e [ i ] * 3 , sdir , svector3f + e [ i ] * 3 ) ;
// if (tvector3f)
for ( i = 0 ; i < 3 ; i + + )
VectorAdd ( tvector3f + e [ i ] * 3 , tdir , tvector3f + e [ i ] * 3 ) ;
// if (normal3f)
for ( i = 0 ; i < 3 ; i + + )
VectorAdd ( normal3f + e [ i ] * 3 , normal , normal3f + e [ i ] * 3 ) ;
}
// now we could divide the vectors by the number of averaged values on
// each vertex... but instead normalize them
// 4 assignments, 1 divide, 1 sqrt, 2 adds, 6 multiplies
if ( svector3f )
for ( i = 0 , v = svector3f ; i < mesh - > numvertexes ; i + + , v + = 3 )
VectorNormalize ( v ) ;
// 4 assignments, 1 divide, 1 sqrt, 2 adds, 6 multiplies
if ( tvector3f )
for ( i = 0 , v = tvector3f ; i < mesh - > numvertexes ; i + + , v + = 3 )
VectorNormalize ( v ) ;
// 4 assignments, 1 divide, 1 sqrt, 2 adds, 6 multiplies
if ( normal3f )
for ( i = 0 , v = normal3f ; i < mesh - > numvertexes ; i + + , v + = 3 )
VectorNormalize ( v ) ;
}
2016-07-12 00:40:13 +00:00
# endif
2005-09-08 02:02:09 +00:00
2016-07-12 00:40:13 +00:00
//calculate S+T vectors without also breaking the normals
void R_Generate_Mesh_ST_Vectors ( mesh_t * mesh )
2005-09-08 02:02:09 +00:00
{
int i ;
2016-07-12 00:40:13 +00:00
vec3_t sdir , tdir , normal , * s , * t , * n ;
index_t * e ;
vecV_t * vertex3f = mesh - > xyz_array ;
vec2_t * texcoord2f = mesh - > st_array ;
vec3_t * normal3f = mesh - > normals_array ;
vec3_t * fte_restrict svector3f = mesh - > snormals_array ;
vec3_t * fte_restrict tvector3f = mesh - > tnormals_array ;
float frac ;
// clear the vectors
memset ( svector3f , 0 , mesh - > numvertexes * sizeof ( float [ 3 ] ) ) ;
memset ( tvector3f , 0 , mesh - > numvertexes * sizeof ( float [ 3 ] ) ) ;
// process each vertex of each triangle and accumulate the results
for ( e = mesh - > indexes ; e < mesh - > indexes + mesh - > numindexes ; e + = 3 )
{
R_BuildBumpVectors ( vertex3f [ e [ 0 ] ] , vertex3f [ e [ 1 ] ] , vertex3f [ e [ 2 ] ] , texcoord2f [ e [ 0 ] ] , texcoord2f [ e [ 1 ] ] , texcoord2f [ e [ 2 ] ] , sdir , tdir , normal ) ;
// if (!areaweighting)
// {
// VectorNormalize(sdir);
// VectorNormalize(tdir);
// }
for ( i = 0 ; i < 3 ; i + + )
VectorAdd ( svector3f [ e [ i ] ] , sdir , svector3f [ e [ i ] ] ) ;
for ( i = 0 ; i < 3 ; i + + )
VectorAdd ( tvector3f [ e [ i ] ] , tdir , tvector3f [ e [ i ] ] ) ;
}
for ( i = 0 , s = svector3f , t = tvector3f , n = normal3f ; i < mesh - > numvertexes ; i + + , s + + , t + + , n + + )
2005-09-08 02:02:09 +00:00
{
2016-07-12 00:40:13 +00:00
frac = - DotProduct ( * s , * n ) ;
VectorMA ( * s , frac , * n , * s ) ;
VectorNormalize ( * s ) ;
frac = - DotProduct ( * t , * n ) ;
VectorMA ( * t , frac , * n , * t ) ;
VectorNormalize ( * t ) ;
2005-09-08 02:02:09 +00:00
}
}
2004-08-22 22:29:09 +00:00
//FIXME: Be less agressive.
//This function will have to be called twice (for geforce cards), with the same data, so do the building once and rendering twice.
void R_DrawGAliasShadowVolume ( entity_t * e , vec3_t lightpos , float radius )
{
model_t * clmodel = e - > model ;
galiasinfo_t * inf ;
mesh_t mesh ;
vec3_t lightorg ;
2011-07-30 14:14:56 +00:00
int surfnum = 0 ;
2004-08-22 22:29:09 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( qrenderer ! = QR_OPENGL )
return ;
2006-06-08 06:24:07 +00:00
if ( clmodel - > engineflags & ( MDLF_FLAME | MDLF_BOLT ) )
2004-08-22 22:29:09 +00:00
return ;
2009-11-04 21:16:50 +00:00
if ( r_noaliasshadows . ival )
2004-08-22 22:29:09 +00:00
return ;
2009-11-04 21:16:50 +00:00
// if (e->shaderRGBAf[3] < 0.5)
// return;
2006-02-27 00:42:25 +00:00
2011-05-19 13:34:07 +00:00
RotateLightVector ( ( void * ) e - > axis , e - > origin , lightpos , lightorg ) ;
2004-08-22 22:29:09 +00:00
if ( Length ( lightorg ) > radius + clmodel - > radius )
return ;
2010-08-28 17:14:38 +00:00
BE_SelectEntity ( e ) ;
2004-08-22 22:29:09 +00:00
2013-07-14 12:22:51 +00:00
inf = Mod_Extradata ( clmodel ) ;
2004-08-22 22:29:09 +00:00
while ( inf )
{
if ( inf - > ofs_trineighbours )
{
2013-04-06 03:36:00 +00:00
Alias_GAliasBuildMesh ( & mesh , NULL , inf , surfnum , e , false ) ;
2004-08-22 22:29:09 +00:00
R_CalcFacing ( & mesh , lightorg ) ;
R_ProjectShadowVolume ( & mesh , lightorg ) ;
R_DrawShadowVolume ( & mesh ) ;
}
2013-07-14 12:22:51 +00:00
inf = inf - > nextsurf ;
2011-07-30 14:14:56 +00:00
surfnum + + ;
2004-08-22 22:29:09 +00:00
}
}
2009-11-07 13:29:15 +00:00
# endif
2004-08-22 22:29:09 +00:00
2007-08-08 02:37:59 +00:00
#if 0
2007-05-25 22:16:29 +00:00
static int R_FindTriangleWithEdge ( index_t * indexes , int numtris , index_t start , index_t end , int ignore )
2004-08-22 22:29:09 +00:00
{
int i ;
int match , count ;
2005-11-26 03:02:55 +00:00
2004-08-22 22:29:09 +00:00
count = 0 ;
match = - 1 ;
2005-11-26 03:02:55 +00:00
2004-08-22 22:29:09 +00:00
for ( i = 0 ; i < numtris ; i + + , indexes + = 3 )
{
if ( ( indexes [ 0 ] = = start & & indexes [ 1 ] = = end )
| | ( indexes [ 1 ] = = start & & indexes [ 2 ] = = end )
| | ( indexes [ 2 ] = = start & & indexes [ 0 ] = = end ) ) {
if ( i ! = ignore )
match = i ;
count + + ;
} else if ( ( indexes [ 1 ] = = start & & indexes [ 0 ] = = end )
| | ( indexes [ 2 ] = = start & & indexes [ 1 ] = = end )
| | ( indexes [ 0 ] = = start & & indexes [ 2 ] = = end ) ) {
count + + ;
}
}
// detect edges shared by three triangles and make them seams
if ( count > 2 )
match = - 1 ;
return match ;
}
2007-08-08 02:37:59 +00:00
# endif
2004-08-22 22:29:09 +00:00
2007-08-08 02:37:59 +00:00
#if 0
2007-05-25 22:16:29 +00:00
static void R_BuildTriangleNeighbours ( int * neighbours , index_t * indexes , int numtris )
2004-08-22 22:29:09 +00:00
{
int i , * n ;
2007-05-25 22:16:29 +00:00
index_t * index ;
2004-08-22 22:29:09 +00:00
for ( i = 0 , index = indexes , n = neighbours ; i < numtris ; i + + , index + = 3 , n + = 3 )
{
n [ 0 ] = R_FindTriangleWithEdge ( indexes , numtris , index [ 1 ] , index [ 0 ] , i ) ;
n [ 1 ] = R_FindTriangleWithEdge ( indexes , numtris , index [ 2 ] , index [ 1 ] , i ) ;
n [ 2 ] = R_FindTriangleWithEdge ( indexes , numtris , index [ 0 ] , index [ 2 ] , i ) ;
}
}
2007-08-08 02:37:59 +00:00
# endif
2004-08-22 22:29:09 +00:00
2009-11-04 21:16:50 +00:00
#if 0
2004-08-22 22:29:09 +00:00
void GL_GenerateNormals ( float * orgs , float * normals , int * indicies , int numtris , int numverts )
{
vec3_t d1 , d2 ;
vec3_t norm ;
int t , i , v1 , v2 , v3 ;
int tricounts [ MD2MAX_VERTS ] ;
vec3_t combined [ MD2MAX_VERTS ] ;
int triremap [ MD2MAX_VERTS ] ;
if ( numverts > MD2MAX_VERTS )
return ; //not an issue, you just loose the normals.
memset ( triremap , 0 , numverts * sizeof ( triremap [ 0 ] ) ) ;
v2 = 0 ;
for ( i = 0 ; i < numverts ; i + + ) //weld points
{
for ( v1 = 0 ; v1 < v2 ; v1 + + )
{
if ( orgs [ i * 3 + 0 ] = = combined [ v1 ] [ 0 ] & &
orgs [ i * 3 + 1 ] = = combined [ v1 ] [ 1 ] & &
orgs [ i * 3 + 2 ] = = combined [ v1 ] [ 2 ] )
{
triremap [ i ] = v1 ;
break ;
}
}
if ( v1 = = v2 )
{
combined [ v1 ] [ 0 ] = orgs [ i * 3 + 0 ] ;
combined [ v1 ] [ 1 ] = orgs [ i * 3 + 1 ] ;
combined [ v1 ] [ 2 ] = orgs [ i * 3 + 2 ] ;
v2 + + ;
triremap [ i ] = v1 ;
}
}
memset ( tricounts , 0 , v2 * sizeof ( tricounts [ 0 ] ) ) ;
memset ( combined , 0 , v2 * sizeof ( * combined ) ) ;
for ( t = 0 ; t < numtris ; t + + )
{
v1 = triremap [ indicies [ t * 3 ] ] ;
v2 = triremap [ indicies [ t * 3 + 1 ] ] ;
v3 = triremap [ indicies [ t * 3 + 2 ] ] ;
VectorSubtract ( ( orgs + v2 * 3 ) , ( orgs + v1 * 3 ) , d1 ) ;
VectorSubtract ( ( orgs + v3 * 3 ) , ( orgs + v1 * 3 ) , d2 ) ;
CrossProduct ( d1 , d2 , norm ) ;
VectorNormalize ( norm ) ;
VectorAdd ( norm , combined [ v1 ] , combined [ v1 ] ) ;
VectorAdd ( norm , combined [ v2 ] , combined [ v2 ] ) ;
VectorAdd ( norm , combined [ v3 ] , combined [ v3 ] ) ;
tricounts [ v1 ] + + ;
tricounts [ v2 ] + + ;
tricounts [ v3 ] + + ;
}
for ( i = 0 ; i < numverts ; i + + )
{
if ( tricounts [ triremap [ i ] ] )
{
VectorScale ( combined [ triremap [ i ] ] , 1.0f / tricounts [ triremap [ i ] ] , normals + i * 3 ) ;
}
}
}
2005-07-16 00:53:08 +00:00
# endif
2009-11-04 21:16:50 +00:00
# endif
2005-08-03 23:14:59 +00:00
2011-04-23 20:37:20 +00:00
2015-05-03 19:57:46 +00:00
# if defined(Q2CLIENT) || defined(Q3CLIENT)
2014-10-05 20:04:11 +00:00
//q3 lightning gun / q3 railgun / q2 beams
static void R_Beam_GenerateTrisoup ( entity_t * e , int bemode )
2011-04-23 20:37:20 +00:00
{
2014-10-05 20:04:11 +00:00
float lightmap ;
unsigned int batchflags = 0 ;
vecV_t * xyz ;
vec2_t * st ;
vec4_t * rgba ;
scenetris_t * t ;
shader_t * shader = NULL ;
float scale , length ;
vec3_t dir , v , cr ;
2011-04-23 20:37:20 +00:00
2015-05-03 19:57:46 +00:00
shader = e - > forcedshader ;
if ( ! shader )
shader = R_RegisterShader ( " q2beam " , SUF_NONE ,
" { \n "
2014-10-05 20:04:11 +00:00
" { \n "
2015-05-03 19:57:46 +00:00
" map $whiteimage \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" blendfunc blend \n "
2014-10-05 20:04:11 +00:00
" } \n "
2015-05-03 19:57:46 +00:00
" } \n "
) ;
2011-04-30 17:21:10 +00:00
2014-10-05 20:04:11 +00:00
batchflags = 0 ;
// if (e->flags & RF_NOSHADOW)
batchflags | = BEF_NOSHADOWS ;
if ( e - > flags & RF_ADDITIVE )
batchflags | = BEF_FORCEADDITIVE ;
if ( e - > flags & RF_TRANSLUCENT )
batchflags | = BEF_FORCETRANSPARENT ;
if ( e - > flags & RF_NODEPTHTEST )
batchflags | = BEF_FORCENODEPTH ;
if ( e - > flags & RF_FORCECOLOURMOD )
batchflags | = BEF_FORCECOLOURMOD ;
if ( shader - > flags & SHADER_NODLIGHT )
batchflags | = BEF_NODLIGHT ;
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
if ( ( batchflags & BEF_NODLIGHT ) | | ( shader - > flags & SHADER_NODLIGHT ) | | bemode ! = BEM_STANDARD )
{
//unlit sprites are just fullbright
lightmap = 1 ;
}
else
{
2016-07-12 00:40:13 +00:00
# ifdef RTLIGHTS
2014-10-05 20:04:11 +00:00
extern cvar_t r_shadow_realtime_world_lightmaps ;
//lit sprites need to sample the world lighting. with rtlights that generally means they're 0.
if ( r_shadow_realtime_world . ival )
lightmap = r_shadow_realtime_world_lightmaps . value ;
else
# endif
lightmap = 1 ;
}
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
if ( cl_numstris & & cl_stris [ cl_numstris - 1 ] . shader = = shader & & cl_stris [ cl_numstris - 1 ] . flags = = batchflags )
t = & cl_stris [ cl_numstris - 1 ] ;
else
{
if ( cl_numstris = = cl_maxstris )
{
cl_maxstris + = 8 ;
cl_stris = BZ_Realloc ( cl_stris , sizeof ( * cl_stris ) * cl_maxstris ) ;
}
t = & cl_stris [ cl_numstris + + ] ;
t - > shader = shader ;
t - > numidx = 0 ;
t - > numvert = 0 ;
t - > firstidx = cl_numstrisidx ;
t - > firstvert = cl_numstrisvert ;
t - > flags = batchflags ;
}
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
if ( cl_numstrisidx + 6 > cl_maxstrisidx )
2011-04-30 17:21:10 +00:00
{
2014-10-05 20:04:11 +00:00
cl_maxstrisidx = cl_numstrisidx + 6 + 64 ;
cl_strisidx = BZ_Realloc ( cl_strisidx , sizeof ( * cl_strisidx ) * cl_maxstrisidx ) ;
}
if ( cl_numstrisvert + 4 > cl_maxstrisvert )
2019-02-19 06:49:03 +00:00
cl_stris_ExpandVerts ( cl_numstrisvert + 64 ) ;
2011-04-30 17:21:10 +00:00
2014-10-05 20:04:11 +00:00
xyz = & cl_strisvertv [ cl_numstrisvert ] ;
st = & cl_strisvertt [ cl_numstrisvert ] ;
rgba = & cl_strisvertc [ cl_numstrisvert ] ;
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 0 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 1 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 2 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 0 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 2 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 3 ;
t - > numidx + = 6 ;
t - > numvert + = 4 ;
cl_numstrisvert + = 4 ;
2015-05-03 19:57:46 +00:00
scale = e - > scale * 5 ;
2011-04-23 20:37:20 +00:00
if ( ! scale )
2015-05-03 19:57:46 +00:00
scale = 5 ;
if ( shader - > flags & SHADER_CULL_FRONT )
scale * = - 1 ;
2011-04-23 20:37:20 +00:00
VectorSubtract ( e - > origin , e - > oldorigin , dir ) ;
length = Length ( dir ) ;
2014-10-05 20:04:11 +00:00
Vector2Set ( st [ 0 ] , 0 , 1 ) ;
Vector2Set ( st [ 1 ] , 0 , 0 ) ;
Vector2Set ( st [ 2 ] , length / 128 , 0 ) ;
Vector2Set ( st [ 3 ] , length / 128 , 1 ) ;
2011-04-23 20:37:20 +00:00
VectorSubtract ( r_refdef . vieworg , e - > origin , v ) ;
CrossProduct ( v , dir , cr ) ;
VectorNormalize ( cr ) ;
2014-10-05 20:04:11 +00:00
VectorMA ( e - > origin , - scale / 2 , cr , xyz [ 0 ] ) ;
VectorMA ( e - > origin , scale / 2 , cr , xyz [ 1 ] ) ;
2011-04-23 20:37:20 +00:00
VectorSubtract ( r_refdef . vieworg , e - > oldorigin , v ) ;
CrossProduct ( v , dir , cr ) ;
VectorNormalize ( cr ) ;
2014-10-05 20:04:11 +00:00
VectorMA ( e - > oldorigin , scale / 2 , cr , xyz [ 2 ] ) ;
VectorMA ( e - > oldorigin , - scale / 2 , cr , xyz [ 3 ] ) ;
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
if ( e - > shaderRGBAf [ 0 ] ! = 0 | | e - > shaderRGBAf [ 1 ] ! = 0 | | e - > shaderRGBAf [ 2 ] ! = 0 | | ( batchflags & BEF_FORCECOLOURMOD ) )
{
if ( e - > shaderRGBAf [ 0 ] > 1 )
e - > shaderRGBAf [ 0 ] = 1 ;
if ( e - > shaderRGBAf [ 1 ] > 1 )
e - > shaderRGBAf [ 1 ] = 1 ;
if ( e - > shaderRGBAf [ 2 ] > 1 )
e - > shaderRGBAf [ 2 ] = 1 ;
}
else
{
e - > shaderRGBAf [ 0 ] = 1 ;
e - > shaderRGBAf [ 1 ] = 1 ;
e - > shaderRGBAf [ 2 ] = 1 ;
}
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
VectorScale ( e - > shaderRGBAf , lightmap , rgba [ 0 ] ) ;
rgba [ 0 ] [ 3 ] = e - > shaderRGBAf [ 3 ] ;
Vector4Copy ( rgba [ 0 ] , rgba [ 1 ] ) ;
Vector4Copy ( rgba [ 0 ] , rgba [ 2 ] ) ;
Vector4Copy ( rgba [ 0 ] , rgba [ 3 ] ) ;
2011-04-23 20:37:20 +00:00
}
# endif
2014-10-05 20:04:11 +00:00
static void R_Sprite_GenerateTrisoup ( entity_t * e , int bemode )
2011-04-23 20:37:20 +00:00
{
vec3_t point ;
2014-10-05 20:04:11 +00:00
mspriteframe_t genframe ;
2012-02-17 01:12:37 +00:00
vec3_t spraxis [ 3 ] ;
2011-04-23 20:37:20 +00:00
msprite_t * psprite ;
vec3_t sprorigin ;
unsigned int sprtype ;
2014-10-05 20:04:11 +00:00
float lightmap ;
unsigned int batchflags = 0 ;
vecV_t * xyz ;
vec2_t * st ;
vec4_t * rgba ;
scenetris_t * t ;
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
shader_t * shader = NULL ;
mspriteframe_t * frame ;
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
if ( ! e - > model | | e - > model - > type ! = mod_sprite | | e - > forcedshader )
2011-04-30 17:21:10 +00:00
{
2014-10-05 20:04:11 +00:00
frame = NULL ;
shader = e - > forcedshader ;
if ( ! shader )
shader = R_RegisterShader ( " q2beam " , SUF_NONE ,
" { \n "
" { \n "
" map $whiteimage \n "
" rgbgen vertex \n "
" alphagen vertex \n "
" blendfunc blend \n "
" } \n "
" } \n "
) ;
}
else
{
if ( ! ( e - > flags & RF_WEAPONMODEL ) )
{
if ( R_CullEntityBox ( e , e - > model - > mins , e - > model - > maxs ) )
return ;
# ifdef RTLIGHTS
if ( BE_LightCullModel ( e - > origin , e - > model ) )
return ;
}
else
{
if ( BE_LightCullModel ( r_origin , e - > model ) )
return ;
# endif
}
// don't even bother culling, because it's just a single
// polygon without a surface cache
frame = R_GetSpriteFrame ( e ) ;
shader = frame - > shader ;
2011-04-30 17:21:10 +00:00
}
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
batchflags = 0 ;
// if (e->flags & RF_NOSHADOW)
batchflags | = BEF_NOSHADOWS ;
if ( e - > flags & RF_ADDITIVE )
batchflags | = BEF_FORCEADDITIVE ;
if ( e - > flags & RF_TRANSLUCENT )
batchflags | = BEF_FORCETRANSPARENT ;
if ( e - > flags & RF_NODEPTHTEST )
batchflags | = BEF_FORCENODEPTH ;
if ( e - > flags & RF_FORCECOLOURMOD )
batchflags | = BEF_FORCECOLOURMOD ;
if ( shader - > flags & SHADER_NODLIGHT )
batchflags | = BEF_NODLIGHT ;
2015-08-10 18:28:23 +00:00
// if (shader->flags & RF_TWOSIDED)
// batchflags |= BEF_FORCETWOSIDED;
2014-10-05 20:04:11 +00:00
if ( ( batchflags & BEF_NODLIGHT ) | | ( shader - > flags & SHADER_NODLIGHT ) | | bemode ! = BEM_STANDARD )
{
//unlit sprites are just fullbright
lightmap = 1 ;
}
else
{
2016-02-15 06:01:17 +00:00
# ifdef RTLIGHTS
2014-10-05 20:04:11 +00:00
extern cvar_t r_shadow_realtime_world_lightmaps ;
//lit sprites need to sample the world lighting. with rtlights that generally means they're 0.
if ( r_shadow_realtime_world . ival )
lightmap = r_shadow_realtime_world_lightmaps . value ;
else
# endif
lightmap = 1 ;
}
if ( ( e - > flags & RF_WEAPONMODEL ) & & r_refdef . playerview - > viewentity > 0 )
2011-04-23 20:37:20 +00:00
{
2013-10-08 14:28:11 +00:00
sprorigin [ 0 ] = r_refdef . playerview - > vw_origin [ 0 ] ;
sprorigin [ 1 ] = r_refdef . playerview - > vw_origin [ 1 ] ;
sprorigin [ 2 ] = r_refdef . playerview - > vw_origin [ 2 ] ;
VectorMA ( sprorigin , e - > origin [ 0 ] , r_refdef . playerview - > vw_axis [ 0 ] , sprorigin ) ;
VectorMA ( sprorigin , e - > origin [ 1 ] , r_refdef . playerview - > vw_axis [ 1 ] , sprorigin ) ;
VectorMA ( sprorigin , e - > origin [ 2 ] , r_refdef . playerview - > vw_axis [ 2 ] , sprorigin ) ;
2019-02-01 08:29:14 +00:00
// VectorMA(sprorigin, 12, vpn, sprorigin);
2011-04-23 20:37:20 +00:00
2019-02-01 08:29:14 +00:00
// batchflags |= BEF_FORCENODEPTH;
2011-04-23 20:37:20 +00:00
}
else
VectorCopy ( e - > origin , sprorigin ) ;
2014-10-05 20:04:11 +00:00
if ( cl_numstris & & cl_stris [ cl_numstris - 1 ] . shader = = shader & & cl_stris [ cl_numstris - 1 ] . flags = = batchflags )
t = & cl_stris [ cl_numstris - 1 ] ;
else
{
if ( cl_numstris = = cl_maxstris )
{
cl_maxstris + = 8 ;
cl_stris = BZ_Realloc ( cl_stris , sizeof ( * cl_stris ) * cl_maxstris ) ;
}
t = & cl_stris [ cl_numstris + + ] ;
t - > shader = shader ;
t - > numidx = 0 ;
t - > numvert = 0 ;
t - > firstidx = cl_numstrisidx ;
t - > firstvert = cl_numstrisvert ;
t - > flags = batchflags ;
}
if ( cl_numstrisidx + 6 > cl_maxstrisidx )
{
cl_maxstrisidx = cl_numstrisidx + 6 + 64 ;
cl_strisidx = BZ_Realloc ( cl_strisidx , sizeof ( * cl_strisidx ) * cl_maxstrisidx ) ;
}
if ( cl_numstrisvert + 4 > cl_maxstrisvert )
2019-02-19 06:49:03 +00:00
cl_stris_ExpandVerts ( cl_numstrisvert + 64 ) ;
2014-10-05 20:04:11 +00:00
xyz = & cl_strisvertv [ cl_numstrisvert ] ;
st = & cl_strisvertt [ cl_numstrisvert ] ;
rgba = & cl_strisvertc [ cl_numstrisvert ] ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 0 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 1 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 2 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 0 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 2 ;
cl_strisidx [ cl_numstrisidx + + ] = t - > numvert + 3 ;
t - > numidx + = 6 ;
t - > numvert + = 4 ;
cl_numstrisvert + = 4 ;
if ( ! frame )
2011-04-23 20:37:20 +00:00
{
2015-08-10 18:28:23 +00:00
genframe . down = genframe . left = - 1 ;
genframe . up = genframe . right = 1 ;
2019-08-03 01:58:03 +00:00
genframe . xmirror = false ;
2011-04-23 20:37:20 +00:00
sprtype = SPR_VP_PARALLEL ;
frame = & genframe ;
}
else
{
// don't even bother culling, because it's just a single
// polygon without a surface cache
2013-07-14 12:22:51 +00:00
psprite = e - > model - > meshinfo ;
2011-04-23 20:37:20 +00:00
sprtype = psprite - > type ;
}
switch ( sprtype )
{
case SPR_ORIENTED :
// bullet marks on walls
2014-03-31 17:06:41 +00:00
if ( ( e - > flags & RF_WEAPONMODEL ) & & r_refdef . playerview - > viewentity > 0 )
2012-02-17 01:12:37 +00:00
{
vec3_t ea [ 3 ] ;
AngleVectors ( e - > angles , ea [ 0 ] , ea [ 1 ] , ea [ 2 ] ) ;
2013-10-08 14:28:11 +00:00
Matrix3_Multiply ( ea , r_refdef . playerview - > vw_axis , spraxis ) ;
2012-02-17 01:12:37 +00:00
}
else
AngleVectors ( e - > angles , spraxis [ 0 ] , spraxis [ 1 ] , spraxis [ 2 ] ) ;
2011-04-23 20:37:20 +00:00
break ;
case SPR_FACING_UPRIGHT :
2012-02-17 01:12:37 +00:00
spraxis [ 2 ] [ 0 ] = 0 ; spraxis [ 2 ] [ 1 ] = 0 ; spraxis [ 2 ] [ 2 ] = 1 ;
spraxis [ 1 ] [ 0 ] = sprorigin [ 1 ] - r_origin [ 1 ] ;
spraxis [ 1 ] [ 1 ] = - ( sprorigin [ 0 ] - r_origin [ 0 ] ) ;
spraxis [ 1 ] [ 2 ] = 0 ;
VectorNormalize ( spraxis [ 1 ] ) ;
2011-04-23 20:37:20 +00:00
break ;
case SPR_VP_PARALLEL_UPRIGHT :
2012-02-17 01:12:37 +00:00
spraxis [ 2 ] [ 0 ] = 0 ; spraxis [ 2 ] [ 1 ] = 0 ; spraxis [ 2 ] [ 2 ] = 1 ;
VectorCopy ( vright , spraxis [ 1 ] ) ;
2011-04-23 20:37:20 +00:00
break ;
default :
case SPR_VP_PARALLEL :
//normal sprite
2012-02-17 01:12:37 +00:00
VectorCopy ( vup , spraxis [ 2 ] ) ;
VectorCopy ( vright , spraxis [ 1 ] ) ;
2011-04-23 20:37:20 +00:00
break ;
}
2014-10-05 20:04:11 +00:00
if ( e - > scale )
{
spraxis [ 2 ] [ 0 ] * = e - > scale ;
spraxis [ 2 ] [ 1 ] * = e - > scale ;
spraxis [ 2 ] [ 2 ] * = e - > scale ;
spraxis [ 1 ] [ 0 ] * = e - > scale ;
spraxis [ 1 ] [ 1 ] * = e - > scale ;
spraxis [ 1 ] [ 2 ] * = e - > scale ;
}
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
if ( e - > shaderRGBAf [ 0 ] ! = 0 | | e - > shaderRGBAf [ 1 ] ! = 0 | | e - > shaderRGBAf [ 2 ] ! = 0 | | ( batchflags & BEF_FORCECOLOURMOD ) )
2012-07-05 19:42:36 +00:00
{
if ( e - > shaderRGBAf [ 0 ] > 1 )
e - > shaderRGBAf [ 0 ] = 1 ;
if ( e - > shaderRGBAf [ 1 ] > 1 )
e - > shaderRGBAf [ 1 ] = 1 ;
if ( e - > shaderRGBAf [ 2 ] > 1 )
e - > shaderRGBAf [ 2 ] = 1 ;
}
else
{
2011-04-23 20:37:20 +00:00
e - > shaderRGBAf [ 0 ] = 1 ;
e - > shaderRGBAf [ 1 ] = 1 ;
e - > shaderRGBAf [ 2 ] = 1 ;
2012-07-05 19:42:36 +00:00
}
2011-04-23 20:37:20 +00:00
2014-10-05 20:04:11 +00:00
VectorScale ( e - > shaderRGBAf , lightmap , rgba [ 0 ] ) ;
rgba [ 0 ] [ 3 ] = e - > shaderRGBAf [ 3 ] ;
Vector4Copy ( rgba [ 0 ] , rgba [ 1 ] ) ;
Vector4Copy ( rgba [ 0 ] , rgba [ 2 ] ) ;
Vector4Copy ( rgba [ 0 ] , rgba [ 3 ] ) ;
2011-04-23 20:37:20 +00:00
2017-07-13 10:44:54 +00:00
if ( frame - > xmirror )
{
Vector2Set ( st [ 0 ] , 1 , 1 ) ;
Vector2Set ( st [ 1 ] , 1 , 0 ) ;
Vector2Set ( st [ 2 ] , 0 , 0 ) ;
Vector2Set ( st [ 3 ] , 0 , 1 ) ;
}
else
{
Vector2Set ( st [ 0 ] , 0 , 1 ) ;
Vector2Set ( st [ 1 ] , 0 , 0 ) ;
Vector2Set ( st [ 2 ] , 1 , 0 ) ;
Vector2Set ( st [ 3 ] , 1 , 1 ) ;
}
2012-10-08 04:36:10 +00:00
2012-02-17 01:12:37 +00:00
VectorMA ( sprorigin , frame - > down , spraxis [ 2 ] , point ) ;
2014-10-05 20:04:11 +00:00
VectorMA ( point , frame - > left , spraxis [ 1 ] , xyz [ 0 ] ) ;
2011-04-23 20:37:20 +00:00
2012-02-17 01:12:37 +00:00
VectorMA ( sprorigin , frame - > up , spraxis [ 2 ] , point ) ;
2014-10-05 20:04:11 +00:00
VectorMA ( point , frame - > left , spraxis [ 1 ] , xyz [ 1 ] ) ;
2011-04-23 20:37:20 +00:00
2012-02-17 01:12:37 +00:00
VectorMA ( sprorigin , frame - > up , spraxis [ 2 ] , point ) ;
2014-10-05 20:04:11 +00:00
VectorMA ( point , frame - > right , spraxis [ 1 ] , xyz [ 2 ] ) ;
2011-04-23 20:37:20 +00:00
2012-02-17 01:12:37 +00:00
VectorMA ( sprorigin , frame - > down , spraxis [ 2 ] , point ) ;
2014-10-05 20:04:11 +00:00
VectorMA ( point , frame - > right , spraxis [ 1 ] , xyz [ 3 ] ) ;
2011-04-23 20:37:20 +00:00
}
static void R_DB_Poly ( batch_t * batch )
{
static mesh_t mesh ;
static mesh_t * meshptr = & mesh ;
2020-08-13 08:39:48 +00:00
unsigned int i = batch - > user . poly . surface ;
2011-04-23 20:37:20 +00:00
batch - > mesh = & meshptr ;
mesh . xyz_array = cl_strisvertv + cl_stris [ i ] . firstvert ;
mesh . st_array = cl_strisvertt + cl_stris [ i ] . firstvert ;
2019-02-19 06:49:03 +00:00
// mesh.normals_array = cl_strisvertn[0];// + cl_stris[i].firstvert;
// mesh.snormals_array = cl_strisvertn[1];// + cl_stris[i].firstvert;
// mesh.tnormals_array = cl_strisvertn[2];// + cl_stris[i].firstvert;
2013-08-27 13:18:09 +00:00
mesh . colors4f_array [ 0 ] = cl_strisvertc + cl_stris [ i ] . firstvert ;
2011-04-23 20:37:20 +00:00
mesh . indexes = cl_strisidx + cl_stris [ i ] . firstidx ;
mesh . numindexes = cl_stris [ i ] . numidx ;
mesh . numvertexes = cl_stris [ i ] . numvert ;
}
2014-10-05 20:04:11 +00:00
static void BE_GenPolyBatches ( batch_t * * batches )
2011-04-23 20:37:20 +00:00
{
shader_t * shader = NULL ;
batch_t * b ;
2014-09-20 04:11:39 +00:00
unsigned int i = cl_numstris , j ;
2014-10-05 20:04:11 +00:00
unsigned int sort ;
2011-04-23 20:37:20 +00:00
2013-12-17 22:45:37 +00:00
while ( i - - > 0 )
2011-04-23 20:37:20 +00:00
{
2012-02-13 09:24:01 +00:00
if ( ! cl_stris [ i ] . numidx )
continue ;
2011-04-23 20:37:20 +00:00
b = BE_GetTempBatch ( ) ;
if ( ! b )
return ;
shader = cl_stris [ i ] . shader ;
2014-06-12 23:08:42 +00:00
if ( ! shader )
continue ;
2011-04-23 20:37:20 +00:00
b - > buildmeshes = R_DB_Poly ;
b - > ent = & r_worldentity ;
b - > mesh = NULL ;
b - > firstmesh = 0 ;
b - > meshes = 1 ;
2015-05-03 19:57:46 +00:00
b - > skin = NULL ;
2011-04-23 20:37:20 +00:00
b - > texture = NULL ;
b - > shader = shader ;
2014-09-20 04:11:39 +00:00
for ( j = 0 ; j < MAXRLIGHTMAPS ; j + + )
b - > lightmap [ j ] = - 1 ;
2020-08-13 08:39:48 +00:00
b - > user . poly . surface = i ;
2014-10-05 20:04:11 +00:00
b - > flags = cl_stris [ i ] . flags ;
2011-04-23 20:37:20 +00:00
b - > vbo = 0 ;
2014-10-05 20:04:11 +00:00
sort = shader - > sort ;
if ( ( b - > flags & BEF_FORCEADDITIVE ) & & sort < SHADER_SORT_ADDITIVE )
sort = SHADER_SORT_ADDITIVE ;
if ( ( b - > flags & BEF_FORCETRANSPARENT ) & & SHADER_SORT_PORTAL < sort & & sort < SHADER_SORT_BLEND )
sort = SHADER_SORT_BLEND ;
if ( ( b - > flags & BEF_FORCENODEPTH ) & & sort < SHADER_SORT_BANNER )
sort = SHADER_SORT_BANNER ;
b - > next = batches [ sort ] ;
batches [ sort ] = b ;
2011-04-23 20:37:20 +00:00
}
}
2018-04-27 16:40:50 +00:00
void PR_Route_Visualise ( void ) ;
2019-07-02 04:12:20 +00:00
void BE_GenModelBatches ( batch_t * * batches , const dlight_t * dl , unsigned int bemode , const qbyte * worldpvs , const int * worldareas )
2011-04-23 20:37:20 +00:00
{
int i ;
entity_t * ent ;
2015-01-07 13:34:05 +00:00
model_t * emodel ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
unsigned int orig_numstris = cl_numstris ;
unsigned int orig_numvisedicts = cl_numvisedicts ;
2016-02-15 06:01:17 +00:00
// unsigned int orig_numstrisidx = cl_numstrisidx;
// unsigned int orig_numstrisvert = cl_numstrisvert;
2019-04-07 16:41:09 +00:00
extern cvar_t r_ignoreentpvs ; //legacy value is 1...
if ( r_ignoreentpvs . ival )
2019-07-02 04:12:20 +00:00
{
2019-04-07 16:41:09 +00:00
worldpvs = NULL ;
2019-07-02 04:12:20 +00:00
worldareas = NULL ;
}
2011-04-23 20:37:20 +00:00
/*clear the batch list*/
for ( i = 0 ; i < SHADER_SORT_COUNT ; i + + )
batches [ i ] = NULL ;
2011-05-20 04:10:46 +00:00
# if defined(TERRAIN)
2014-03-31 17:06:41 +00:00
if ( cl . worldmodel & & cl . worldmodel - > terrain & & ! ( r_refdef . flags & RDF_NOWORLDMODEL ) )
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
Terr_DrawTerrainModel ( batches , & r_worldentity ) ;
2011-05-20 04:10:46 +00:00
# endif
2015-03-03 00:14:43 +00:00
R_Clutter_Emit ( batches ) ;
2012-04-09 19:12:12 +00:00
if ( ! r_drawentities . ival )
return ;
2013-10-08 14:28:11 +00:00
if ( bemode = = BEM_STANDARD )
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
# ifndef CLIENTONLY
2013-10-08 14:28:11 +00:00
SV_AddDebugPolygons ( ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
# endif
2018-04-27 16:40:50 +00:00
# ifdef ENGINE_ROUTING
PR_Route_Visualise ( ) ;
# endif
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
2013-10-08 14:28:11 +00:00
//the alias cache is a backend thing that provides support for multiple entities using the same skeleton.
//thus it needs to be cleared so that it won't reuse the cache over multiple frames.
Alias_FlushCache ( ) ;
}
2012-04-09 19:12:12 +00:00
2011-04-23 20:37:20 +00:00
// draw sprites seperately, because of alpha blending
2019-07-19 02:13:19 +00:00
for ( i = r_refdef . firstvisedict ; i < cl_numvisedicts ; i + + )
2011-04-23 20:37:20 +00:00
{
ent = & cl_visedicts [ i ] ;
2020-12-25 03:20:48 +00:00
if ( ( r_refdef . externalview | | chase_active . ival ) & & ( ent - > flags & RF_FIRSTPERSON ) )
2020-12-25 03:07:07 +00:00
continue ;
2018-10-11 10:31:23 +00:00
if ( ! r_refdef . externalview & & ( ent - > flags & RF_EXTERNALMODEL ) & & ! chase_active . ival )
2011-04-23 20:37:20 +00:00
continue ;
2016-07-12 00:40:13 +00:00
# ifdef RTLIGHTS
2013-10-08 14:28:11 +00:00
if ( bemode = = BEM_STENCIL | | bemode = = BEM_DEPTHONLY )
{
2014-03-31 17:06:41 +00:00
if ( ent - > flags & ( RF_NOSHADOW | RF_ADDITIVE | RF_NODEPTHTEST | RF_TRANSLUCENT ) ) //noshadow often isn't enough for legacy content.
2013-10-08 14:28:11 +00:00
continue ;
2016-07-12 00:40:13 +00:00
if ( ent - > flags & RF_EXTERNALMODEL & & ! r_shadow_playershadows . ival ) //noshadow often isn't enough for legacy content.
continue ;
2013-10-08 14:28:11 +00:00
if ( ent - > keynum = = dl - > key & & ent - > keynum ) //shadows are not cast from the entity that owns the light. it is expected to be inside.
continue ;
if ( ent - > model & & ent - > model - > engineflags & MDLF_FLAME )
continue ;
}
2016-07-12 00:40:13 +00:00
# endif
2013-10-08 14:28:11 +00:00
2019-07-02 04:12:20 +00:00
if ( worldpvs & & ! cl . worldmodel - > funcs . EdictInFatPVS ( cl . worldmodel , & ent - > pvscache , worldpvs , worldareas ) )
2019-04-07 16:41:09 +00:00
continue ;
2011-04-23 20:37:20 +00:00
switch ( ent - > rtype )
{
case RT_MODEL :
default :
2015-01-07 13:34:05 +00:00
emodel = ent - > model ;
if ( ! emodel )
2011-04-23 20:37:20 +00:00
continue ;
2015-01-07 13:34:05 +00:00
if ( emodel - > loadstate = = MLS_NOTLOADED )
2013-10-29 17:38:22 +00:00
{
2015-01-07 13:34:05 +00:00
if ( ! Mod_LoadModel ( emodel , MLV_WARN ) )
2013-10-29 17:38:22 +00:00
continue ;
}
2015-01-07 13:34:05 +00:00
if ( emodel - > loadstate ! = MLS_LOADED )
2014-10-05 20:04:11 +00:00
continue ;
2011-04-23 20:37:20 +00:00
2012-07-20 01:46:05 +00:00
if ( cl . lerpents & & ( cls . allow_anyparticles ) ) //allowed or static
2011-04-23 20:37:20 +00:00
{
if ( gl_part_flame . value )
{
2018-11-28 05:41:39 +00:00
if ( emodel - > engineflags & MDLF_EMITREPLACE )
2011-04-23 20:37:20 +00:00
continue ;
}
}
2015-01-07 13:34:05 +00:00
if ( emodel - > engineflags & MDLF_NOTREPLACEMENTS )
2011-04-23 20:37:20 +00:00
{
2015-01-07 13:34:05 +00:00
if ( emodel - > fromgame ! = fg_quake | | emodel - > type ! = mod_alias )
2014-03-30 08:55:06 +00:00
if ( ! ruleset_allow_sensitive_texture_replacements . value )
2011-04-23 20:37:20 +00:00
continue ;
}
2015-01-07 13:34:05 +00:00
switch ( emodel - > type )
2011-04-23 20:37:20 +00:00
{
case mod_brush :
2020-04-19 01:23:32 +00:00
if ( r_drawentities . ival = = 2 & & cls . allow_cheats ) //2 is considered a cheat, because it can be used as a wallhack (whereas mdls are not normally considered as occluding).
2011-04-23 20:37:20 +00:00
continue ;
Surf_GenBrushBatches ( batches , ent ) ;
break ;
case mod_alias :
if ( r_drawentities . ival = = 3 )
continue ;
R_GAlias_GenerateBatches ( ent , batches ) ;
break ;
case mod_sprite :
2014-10-05 20:04:11 +00:00
R_Sprite_GenerateTrisoup ( ent , bemode ) ;
2011-04-23 20:37:20 +00:00
break ;
2012-07-05 19:42:36 +00:00
case mod_halflife :
# ifdef HALFLIFEMODELS
R_HalfLife_GenerateBatches ( ent , batches ) ;
# endif
break ;
2011-05-15 13:23:13 +00:00
case mod_dummy :
case mod_heightmap :
2015-01-07 13:34:05 +00:00
# if defined(TERRAIN)
if ( emodel - > terrain & & ! ( r_refdef . flags & RDF_NOWORLDMODEL ) )
Terr_DrawTerrainModel ( batches , ent ) ;
# endif
2011-05-15 13:23:13 +00:00
break ;
2011-04-23 20:37:20 +00:00
}
break ;
case RT_SPRITE :
2014-10-05 20:04:11 +00:00
R_Sprite_GenerateTrisoup ( ent , bemode ) ;
2011-04-23 20:37:20 +00:00
break ;
case RT_BEAM :
case RT_RAIL_RINGS :
case RT_LIGHTNING :
case RT_RAIL_CORE :
2015-05-03 19:57:46 +00:00
# if defined(Q2CLIENT) || defined(Q3CLIENT)
2014-10-05 20:04:11 +00:00
R_Beam_GenerateTrisoup ( ent , bemode ) ;
2011-04-23 20:37:20 +00:00
# endif
2015-05-03 19:57:46 +00:00
break ;
2011-04-23 20:37:20 +00:00
case RT_POLY :
/*not implemented*/
break ;
case RT_PORTALSURFACE :
/*nothing*/
break ;
}
}
2019-10-18 08:37:38 +00:00
if ( cl_numstris & & ! ( r_refdef . flags & RDF_DISABLEPARTICLES ) )
2011-04-23 20:37:20 +00:00
BE_GenPolyBatches ( batches ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
2014-10-05 20:04:11 +00:00
while ( orig_numstris < cl_numstris )
cl_stris [ orig_numstris + + ] . shader = NULL ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéíóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
cl_numstris = orig_numstris ;
2014-10-05 20:04:11 +00:00
/* cl_numstrisidx = orig_numstrisidx;
cl_numstrisvert = orig_numstrisvert ;
if ( cl_numstris )
{ //fix this up, in case they got merged.
cl_stris [ cl_numstris - 1 ] . numvert = cl_numstrisvert - cl_stris [ cl_numstris - 1 ] . firstvert ;
cl_stris [ cl_numstris - 1 ] . numidx = cl_numstrisidx - cl_stris [ cl_numstris - 1 ] . firstidx ;
}
*/ cl_numvisedicts = orig_numvisedicts ;
2011-04-23 20:57:06 +00:00
}
# endif // defined(GLQUAKE)