2004-08-22 22:29:09 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// models.c -- model loading and caching
// models are the only shared resource between a client and server running
// on the same machine.
# include "quakedef.h"
2021-05-28 07:07:48 +00:00
# include "fs.h"
2021-04-14 05:21:04 +00:00
# include "com_bih.h"
2014-05-10 13:42:13 +00:00
# if 1 //ndef SERVERONLY //FIXME
2004-08-22 22:29:09 +00:00
# include "glquake.h"
2008-12-23 02:55:20 +00:00
# include "com_mesh.h"
2005-01-18 21:03:46 +00:00
2005-08-03 23:14:59 +00:00
extern cvar_t r_shadow_bumpscale_basetexture ;
2007-09-13 22:27:56 +00:00
extern cvar_t r_replacemodels ;
2018-03-04 14:41:16 +00:00
extern cvar_t r_lightmap_average ;
2014-10-05 20:04:11 +00:00
cvar_t mod_loadentfiles = CVAR ( " sv_loadentfiles " , " 1 " ) ;
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
cvar_t mod_loadentfiles_dir = CVAR ( " sv_loadentfiles_dir " , " " ) ;
2014-09-08 23:47:19 +00:00
cvar_t mod_external_vis = CVARD ( " mod_external_vis " , " 1 " , " Attempt to load .vis patches for quake maps, allowing transparent water to work properly. " ) ;
2014-10-05 20:04:11 +00:00
cvar_t mod_warnmodels = CVARD ( " mod_warnmodels " , " 1 " , " Warn if any models failed to load. Set to 0 if your mod is likely to lack optional models (like its in development). " ) ; //set to 0 for hexen2 and its otherwise-spammy-as-heck demo.
2023-03-15 18:02:26 +00:00
cvar_t mod_litsprites_force = CVARFD ( " mod_litsprites_force " , " 0 " , CVAR_RENDERERLATCH , " If set to 1, sprites will be lit according to world lighting (including rtlights), like Tenebrae. Ideally use EF_ADDITIVE or EF_FULLBRIGHT to make emissive sprites instead. " ) ;
2021-06-01 10:56:08 +00:00
cvar_t mod_loadmappackages = CVARD ( " mod_loadmappackages " , " 1 " , " Load additional content embedded within bsp files. " ) ;
2021-07-01 01:16:29 +00:00
cvar_t mod_lightscale_broken = CVARFD ( " mod_lightscale_broken " , " 0 " , CVAR_RENDERERLATCH , " When active, replicates a bug from vanilla - the radius of r_dynamic lights is scaled by per-surface texture scale rather than using actual distance. " ) ;
2022-01-08 09:59:54 +00:00
cvar_t mod_lightpoint_distance = CVARD ( " mod_lightpoint_distance " , " 8192 " , " This is the maximum distance to trace when searching for a ground surface for lighting info on map formats without light more fancy lighting info. Use 2048 for full compat with Quake. " ) ;
2021-06-21 19:13:33 +00:00
# ifdef SPRMODELS
cvar_t r_sprite_backfacing = CVARD ( " r_sprite_backfacing " , " 0 " , " Make oriented sprites face backwards relative to their orientation, for compat with q1. " ) ;
# endif
2023-08-08 18:17:18 +00:00
cvar_t r_nolerp_list = CVARFD ( " r_nolerp_list " /*qs*/ , " " , CVAR_RENDERERLATCH , " Models in this list will not interpolate. Any models included here should be considered bad. " ) ;
2021-08-24 06:06:05 +00:00
# ifdef RTLIGHTS
2023-08-08 18:17:18 +00:00
cvar_t r_noshadow_list = CVARAFD ( " r_noshadow_list " /*qs*/ , " r_noEntityCastShadowList " , " progs/missile.mdl,progs/flame.mdl,progs/flame2.mdl,progs/lavaball.mdl,progs/grenade.mdl,progs/spike.mdl,progs/s_spike.mdl,progs/laser.mdl,progs/lspike.mdl,progs/candle.mdl " , CVAR_RENDERERLATCH , " Models in this list will not cast shadows. " ) ;
2021-08-24 06:06:05 +00:00
# endif
2014-05-10 13:42:13 +00:00
# ifdef SERVERONLY
cvar_t gl_overbright , gl_specular , gl_load24bit , r_replacemodels , gl_miptexLevel , r_fb_bmodels ; //all of these can/should default to 0
cvar_t r_noframegrouplerp = CVARF ( " r_noframegrouplerp " , " 0 " , CVAR_ARCHIVE ) ;
cvar_t dpcompat_psa_ungroup = CVAR ( " dpcompat_psa_ungroup " , " 0 " ) ;
texture_t r_notexture_mip_real ;
texture_t * r_notexture_mip = & r_notexture_mip_real ;
# endif
2004-08-22 22:29:09 +00:00
void CM_Init ( void ) ;
2014-10-05 20:04:11 +00:00
void Mod_LoadSpriteShaders ( model_t * spr ) ;
2014-03-30 08:55:06 +00:00
qboolean QDECL Mod_LoadSpriteModel ( model_t * mod , void * buffer , size_t fsize ) ;
qboolean QDECL Mod_LoadSprite2Model ( model_t * mod , void * buffer , size_t fsize ) ;
2017-01-13 00:39:50 +00:00
# ifdef Q1BSPS
static qboolean QDECL Mod_LoadBrushModel ( model_t * mod , void * buffer , size_t fsize ) ;
# endif
2017-02-19 00:15:42 +00:00
# if defined(Q2BSPS) || defined(Q3BSPS)
2014-03-30 08:55:06 +00:00
qboolean QDECL Mod_LoadQ2BrushModel ( model_t * mod , void * buffer , size_t fsize ) ;
2012-09-30 05:52:03 +00:00
# endif
2014-03-30 08:55:06 +00:00
model_t * Mod_LoadModel ( model_t * mod , enum mlverbosity_e verbose ) ;
2014-10-05 20:04:11 +00:00
static void Mod_PrintFormats_f ( void ) ;
2018-12-10 15:02:55 +00:00
static void Mod_ShowEnt_f ( void ) ;
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
static void Mod_SaveEntFile_f ( void ) ;
2004-08-22 22:29:09 +00:00
2010-07-25 15:12:12 +00:00
# ifdef MAP_DOOM
2015-06-14 01:28:01 +00:00
qboolean QDECL Mod_LoadDoomLevel ( model_t * mod , void * buffer , size_t fsize ) ;
2004-08-22 22:29:09 +00:00
# endif
2014-05-10 13:42:13 +00:00
# ifdef DSPMODELS
2013-07-14 12:22:51 +00:00
void Mod_LoadDoomSprite ( model_t * mod ) ;
2004-08-22 22:29:09 +00:00
# endif
2013-10-29 17:38:22 +00:00
# define MAX_MOD_KNOWN 8192
2014-08-25 07:35:41 +00:00
model_t * mod_known ;
2004-08-22 22:29:09 +00:00
int mod_numknown ;
2023-02-20 05:50:50 +00:00
char mod_modifier [ MAX_QPATH ] ; //postfix for ent files
2004-08-22 22:29:09 +00:00
extern cvar_t r_loadlits ;
2004-09-13 03:20:04 +00:00
# ifdef SPECULAR
extern cvar_t gl_specular ;
# endif
2004-08-22 22:29:09 +00:00
extern cvar_t r_fb_bmodels ;
2014-10-05 20:04:11 +00:00
void Mod_SortShaders ( model_t * mod ) ;
void Mod_LoadAliasShaders ( model_t * mod ) ;
2004-08-22 22:29:09 +00:00
# ifdef RUNTIMELIGHTING
2020-02-11 18:06:10 +00:00
extern model_t * lightmodel ;
2017-01-13 00:39:50 +00:00
# endif
2004-08-22 22:29:09 +00:00
2014-05-10 13:42:13 +00:00
static void Mod_MemList_f ( void )
2013-07-14 12:22:51 +00:00
{
int m ;
model_t * mod ;
int total = 0 ;
for ( m = 0 , mod = mod_known ; m < mod_numknown ; m + + , mod + + )
{
2020-01-09 15:35:40 +00:00
if ( mod - > memgroup . totalbytes )
Con_Printf ( " %s: %i bytes \n " , mod - > name , mod - > memgroup . totalbytes ) ;
total + = mod - > memgroup . totalbytes ;
2013-07-14 12:22:51 +00:00
}
Con_Printf ( " Total: %i bytes \n " , total ) ;
}
2015-06-14 08:16:15 +00:00
# ifndef SERVERONLY
2014-05-10 13:42:13 +00:00
static void Mod_BatchList_f ( void )
2012-07-05 19:42:36 +00:00
{
2015-07-14 14:47:00 +00:00
int m , i ;
2012-07-05 19:42:36 +00:00
model_t * mod ;
batch_t * batch ;
unsigned int count ;
for ( m = 0 , mod = mod_known ; m < mod_numknown ; m + + , mod + + )
{
2014-10-05 20:04:11 +00:00
if ( mod - > type = = mod_brush & & mod - > loadstate = = MLS_LOADED )
2012-07-05 19:42:36 +00:00
{
2015-03-03 00:14:43 +00:00
Con_Printf ( " ^1%s: \n " , mod - > name ) ;
2012-07-05 19:42:36 +00:00
count = 0 ;
for ( i = 0 ; i < SHADER_SORT_COUNT ; i + + )
{
for ( batch = mod - > batches [ i ] ; batch ; batch = batch - > next )
{
2019-01-13 16:51:50 +00:00
char editname [ MAX_QPATH ] ;
char * body = Shader_GetShaderBody ( batch - > texture - > shader , editname , sizeof ( editname ) ) ;
if ( ! body )
body = " SHADER NOT KNOWN " ;
else
{
char * cr ;
while ( ( cr = strchr ( body , ' \r ' ) ) )
* cr = ' ' ;
}
Con_Printf ( " ^[%s \\ tipimg \\ %s \\ tipimgtype \\ %i \\ tip \\ {%s^] " , batch - > texture - > shader - > name , batch - > texture - > shader - > name , batch - > texture - > shader - > usageflags , body ) ;
2013-10-08 14:28:11 +00:00
# if MAXRLIGHTMAPS > 1
2012-07-05 19:42:36 +00:00
if ( batch - > lightmap [ 3 ] > = 0 )
2019-01-13 16:51:50 +00:00
Con_Printf ( " ^2 lm=(%i:%i %i:%i %i:%i %i:%i) " , batch - > lightmap [ 0 ] , batch - > lmlightstyle [ 0 ] , batch - > lightmap [ 1 ] , batch - > lmlightstyle [ 1 ] , batch - > lightmap [ 2 ] , batch - > lmlightstyle [ 2 ] , batch - > lightmap [ 3 ] , batch - > lmlightstyle [ 3 ] ) ;
2012-07-05 19:42:36 +00:00
else if ( batch - > lightmap [ 2 ] > = 0 )
2019-01-13 16:51:50 +00:00
Con_Printf ( " ^2 lm=(%i:%i %i:%i %i:%i) " , batch - > lightmap [ 0 ] , batch - > lmlightstyle [ 0 ] , batch - > lightmap [ 1 ] , batch - > lmlightstyle [ 1 ] , batch - > lightmap [ 2 ] , batch - > lmlightstyle [ 2 ] ) ;
2012-07-05 19:42:36 +00:00
else if ( batch - > lightmap [ 1 ] > = 0 )
2019-01-13 16:51:50 +00:00
Con_Printf ( " ^2 lm=(%i:%i %i:%i) " , batch - > lightmap [ 0 ] , batch - > lmlightstyle [ 0 ] , batch - > lightmap [ 1 ] , batch - > lmlightstyle [ 1 ] ) ;
2013-10-08 14:28:11 +00:00
else
2017-10-31 22:52:58 +00:00
# endif
2020-01-10 12:23:25 +00:00
if ( batch - > lmlightstyle [ 0 ] ! = INVALID_LIGHTSTYLE )
2019-01-13 16:51:50 +00:00
Con_Printf ( " ^2 lm=(%i:%i) " , batch - > lightmap [ 0 ] , batch - > lmlightstyle [ 0 ] ) ;
2012-07-05 19:42:36 +00:00
else
2019-01-13 16:51:50 +00:00
Con_Printf ( " ^2 lm=%i " , batch - > lightmap [ 0 ] ) ;
2012-07-05 19:42:36 +00:00
count + + ;
2019-01-13 16:51:50 +00:00
if ( batch - > envmap )
Con_Printf ( " ^3 envmap=%s " , batch - > envmap - > ident ) ;
Con_Printf ( " surfs=%u \n " , batch - > maxmeshes ) ;
2012-07-05 19:42:36 +00:00
}
}
2015-03-03 00:14:43 +00:00
Con_Printf ( " ^h(%u batches, lm %i*%i, lux %s) \n " , count , mod - > lightmaps . width , mod - > lightmaps . height , mod - > lightmaps . deluxemapping ? " true " : " false " ) ;
2012-07-05 19:42:36 +00:00
}
}
}
2014-05-10 13:42:13 +00:00
static void Mod_TextureList_f ( void )
2004-08-22 22:29:09 +00:00
{
int m , i ;
texture_t * tx ;
model_t * mod ;
2012-07-05 19:42:36 +00:00
qboolean shownmodelname = false ;
int count = 0 ;
2016-07-12 00:40:13 +00:00
char * body ;
char editname [ MAX_OSPATH ] ;
2019-01-13 16:51:50 +00:00
int preview = ( Cmd_Argc ( ) = = 1 ) ? 8 : atoi ( Cmd_Argv ( 1 ) ) ;
2019-10-07 04:51:17 +00:00
int s ;
batch_t * batch ;
unsigned int batchcount ;
2004-08-22 22:29:09 +00:00
for ( m = 0 , mod = mod_known ; m < mod_numknown ; m + + , mod + + )
{
2012-07-05 19:42:36 +00:00
if ( shownmodelname )
2014-10-25 02:16:35 +00:00
Con_Printf ( " (%u textures) \n " , count ) ;
2012-07-05 19:42:36 +00:00
shownmodelname = false ;
2014-10-05 20:04:11 +00:00
if ( mod - > type = = mod_brush & & mod - > loadstate = = MLS_LOADED )
2004-08-22 22:29:09 +00:00
{
if ( * mod - > name = = ' * ' )
continue ; // inlines don't count
2012-07-05 19:42:36 +00:00
count = 0 ;
2004-08-22 22:29:09 +00:00
for ( i = 0 ; i < mod - > numtextures ; i + + )
{
tx = mod - > textures [ i ] ;
if ( ! tx )
continue ; //happens on e1m2
2019-10-07 04:51:17 +00:00
batchcount = 0 ;
for ( s = 0 ; s < SHADER_SORT_COUNT ; s + + )
{
for ( batch = mod - > batches [ s ] ; batch ; batch = batch - > next )
{
if ( batch - > texture = = tx )
batchcount + + ;
}
}
// if (!batchcount)
// continue; //not actually used...
2004-08-22 22:29:09 +00:00
if ( ! shownmodelname )
{
shownmodelname = true ;
Con_Printf ( " %s \n " , mod - > name ) ;
2012-07-05 19:42:36 +00:00
count = 0 ;
2004-08-22 22:29:09 +00:00
}
2016-07-12 00:40:13 +00:00
body = Shader_GetShaderBody ( tx - > shader , editname , sizeof ( editname ) ) ;
if ( ! body )
body = " SHADER NOT KNOWN " ;
else
{
char * cr ;
while ( ( cr = strchr ( body , ' \r ' ) ) )
* cr = ' ' ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( strlen ( body ) > 3000 )
body [ 3000 ] = 0 ; //arbitrary cut off, to avoid console glitches with big shaders.
2016-07-12 00:40:13 +00:00
}
2019-01-13 16:51:50 +00:00
if ( preview )
{
if ( * editname )
Con_Printf ( " ^[ \\ edit \\ %s \\ img \\ %s \\ imgtype \\ %i \\ s \\ %i \\ tip \\ {%s^] " , editname , tx - > name , tx - > shader - > usageflags , preview , body ) ;
else
Con_Printf ( " ^[ \\ img \\ %s \\ imgtype \\ %i \\ s \\ %i \\ tip \\ {%s^] " , tx - > shader - > name , tx - > shader - > usageflags , preview , body ) ;
}
2016-07-12 00:40:13 +00:00
if ( * editname )
2019-10-07 04:51:17 +00:00
Con_Printf ( " ^[%s \\ edit \\ %s \\ tipimg \\ %s \\ tipimgtype \\ %i \\ tip \\ {%s^] (%u batches) \n " , tx - > name , editname , tx - > name , tx - > shader - > usageflags , body , batchcount ) ;
2016-07-12 00:40:13 +00:00
else
2019-10-07 04:51:17 +00:00
Con_Printf ( " ^[%s \\ tipimg \\ %s \\ tipimgtype \\ %i \\ tip \\ {%s^] (%u batches) \n " , tx - > name , tx - > shader - > name , tx - > shader - > usageflags , body , batchcount ) ;
2012-07-05 19:42:36 +00:00
count + + ;
2004-08-22 22:29:09 +00:00
}
}
}
2012-07-05 19:42:36 +00:00
if ( shownmodelname )
2014-10-25 02:16:35 +00:00
Con_Printf ( " (%u textures) \n " , count ) ;
2004-08-22 22:29:09 +00:00
}
2014-05-10 13:42:13 +00:00
static void Mod_BlockTextureColour_f ( void )
2004-08-22 22:29:09 +00:00
{
char texname [ 64 ] ;
model_t * mod ;
texture_t * tx ;
2015-03-03 00:14:43 +00:00
// shader_t *s;
2004-08-22 22:29:09 +00:00
char * match = Cmd_Argv ( 1 ) ;
int i , m ;
2015-03-03 00:14:43 +00:00
// unsigned int colour[8*8];
2004-08-22 22:29:09 +00:00
unsigned int rgba ;
2009-11-04 21:16:50 +00:00
2017-12-09 22:10:51 +00:00
( ( qbyte * ) & rgba ) [ 0 ] = atoi ( Cmd_Argv ( 2 ) ) ;
( ( qbyte * ) & rgba ) [ 1 ] = atoi ( Cmd_Argv ( 3 ) ) ;
( ( qbyte * ) & rgba ) [ 2 ] = atoi ( Cmd_Argv ( 4 ) ) ;
( ( qbyte * ) & rgba ) [ 3 ] = 255 ;
2004-08-22 22:29:09 +00:00
2015-03-03 00:14:43 +00:00
sprintf ( texname , " purergb_%i_%i_%i " , ( int ) ( ( char * ) & rgba ) [ 0 ] , ( int ) ( ( char * ) & rgba ) [ 1 ] , ( int ) ( ( char * ) & rgba ) [ 2 ] ) ;
/* s = R_RegisterCustom(Cmd_Argv(2), SUF_LIGHTMAP, NULL, NULL);
2009-11-04 21:16:50 +00:00
if ( ! s )
{
2013-08-21 07:14:39 +00:00
s = R_RegisterCustom ( texname , SUF_LIGHTMAP , Shader_DefaultBSPQ1 , NULL ) ;
2009-11-04 21:16:50 +00:00
2014-10-05 20:04:11 +00:00
for ( i = 0 ; i < sizeof ( colour ) / sizeof ( colour [ 0 ] ) ; i + + )
colour [ i ] = rgba ;
2015-03-03 00:14:43 +00:00
s - > defaulttextures . base = GL_LoadTexture32 ( texname , 8 , 8 , colour , IF_NOMIPMAP ) ;
2014-10-05 20:04:11 +00:00
}
2015-03-03 00:14:43 +00:00
*/
2004-08-22 22:29:09 +00:00
for ( m = 0 , mod = mod_known ; m < mod_numknown ; m + + , mod + + )
{
2014-10-05 20:04:11 +00:00
if ( mod - > type = = mod_brush & & mod - > loadstate = = MLS_LOADED )
2004-08-22 22:29:09 +00:00
{
for ( i = 0 ; i < mod - > numtextures ; i + + )
{
tx = mod - > textures [ i ] ;
if ( ! tx )
continue ; //happens on e1m2
if ( ! stricmp ( tx - > name , match ) )
2015-05-03 19:57:46 +00:00
tx - > shader - > defaulttextures - > base = Image_GetTexture ( texname , NULL , IF_NOMIPMAP | IF_NEAREST , & rgba , NULL , 1 , 1 , TF_BGRA32 ) ;
2004-08-22 22:29:09 +00:00
}
}
}
}
2014-05-10 13:42:13 +00:00
# endif
2009-11-04 21:16:50 +00:00
2011-05-27 17:59:31 +00:00
void Mod_RebuildLightmaps ( void )
{
int i , j ;
msurface_t * surf ;
model_t * mod ;
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
{
2014-10-05 20:04:11 +00:00
if ( mod - > loadstate ! = MLS_LOADED )
2011-05-27 17:59:31 +00:00
continue ;
if ( mod - > type = = mod_brush )
{
for ( j = 0 , surf = mod - > surfaces ; j < mod - > numsurfaces ; j + + , surf + + )
surf - > cached_dlight = - 1 ; //force it
}
}
}
2009-11-04 21:16:50 +00:00
2021-07-06 00:12:20 +00:00
# ifdef HAVE_CLIENT
2013-07-14 12:22:51 +00:00
void Mod_ResortShaders ( void )
2013-03-12 23:10:44 +00:00
{
//called when some shader changed its sort key.
//this means we have to hunt down all models and update their batches.
//really its only bsps that need this.
batch_t * oldlists [ SHADER_SORT_COUNT ] , * b ;
int i , j , bs ;
model_t * mod ;
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
{
2014-10-05 20:04:11 +00:00
if ( mod - > loadstate ! = MLS_LOADED )
2013-03-12 23:10:44 +00:00
continue ;
memcpy ( oldlists , mod - > batches , sizeof ( oldlists ) ) ;
memset ( mod - > batches , 0 , sizeof ( oldlists ) ) ;
2016-07-12 00:40:13 +00:00
mod - > numbatches = 0 ; //this is a bit of a misnomer. clearing this will cause it to be recalculated, with everything renumbered as needed.
2013-03-12 23:10:44 +00:00
for ( j = 0 ; j < SHADER_SORT_COUNT ; j + + )
{
while ( ( b = oldlists [ j ] ) )
{
oldlists [ j ] = b - > next ;
bs = b - > shader ? b - > shader - > sort : j ;
b - > next = mod - > batches [ bs ] ;
mod - > batches [ bs ] = b ;
}
}
}
2021-07-06 00:12:20 +00:00
Surf_ClearSceneCache ( ) ; //make sure their caches are updated.
2013-03-12 23:10:44 +00:00
}
2021-07-06 00:12:20 +00:00
# endif
2016-11-25 08:14:54 +00:00
const char * Mod_GetEntitiesString ( model_t * mod )
{
2016-12-07 18:45:25 +00:00
size_t vl ;
size_t e ;
size_t sz ;
char * o ;
2016-11-25 08:14:54 +00:00
if ( ! mod )
return NULL ;
if ( mod - > entities_raw ) //still cached/correct
return mod - > entities_raw ;
if ( ! mod - > numentityinfo )
2021-04-14 05:21:04 +00:00
{
if ( mod - > loadstate ! = MLS_LOADED )
return NULL ;
mod - > entities_raw = FS_LoadMallocFile ( va ( " %s.ent " , mod - > name ) , NULL ) ;
if ( ! mod - > entities_raw )
mod - > entities_raw = FS_LoadMallocFile ( va ( " %s.ent " , mod - > name ) , NULL ) ;
return mod - > entities_raw ;
}
2016-12-07 18:45:25 +00:00
2016-11-25 08:14:54 +00:00
//reform the entities back into a full string now that we apparently need it
2016-12-07 18:45:25 +00:00
//find needed buffer size
for ( e = 0 , sz = 0 ; e < mod - > numentityinfo ; e + + )
{
if ( ! mod - > entityinfo [ e ] . keyvals )
continue ;
sz + = 2 ;
sz + = strlen ( mod - > entityinfo [ e ] . keyvals ) ;
sz + = 2 ;
}
sz + = 1 ;
o = BZ_Malloc ( sz ) ;
//splurge it out
for ( e = 0 , sz = 0 ; e < mod - > numentityinfo ; e + + )
{
if ( ! mod - > entityinfo [ e ] . keyvals )
continue ;
o [ sz + 0 ] = ' { ' ;
o [ sz + 1 ] = ' \n ' ;
sz + = 2 ;
vl = strlen ( mod - > entityinfo [ e ] . keyvals ) ;
memcpy ( & o [ sz ] , mod - > entityinfo [ e ] . keyvals , vl ) ;
sz + = vl ;
o [ sz + 0 ] = ' } ' ;
o [ sz + 1 ] = ' \n ' ;
sz + = 2 ;
}
o [ sz + 0 ] = 0 ;
mod - > entities_raw = o ;
2016-11-25 08:14:54 +00:00
return mod - > entities_raw ;
}
void Mod_SetEntitiesString ( model_t * mod , const char * str , qboolean docopy )
{
size_t j ;
for ( j = 0 ; j < mod - > numentityinfo ; j + + )
Z_Free ( mod - > entityinfo [ j ] . keyvals ) ;
mod - > numentityinfo = 0 ;
Z_Free ( mod - > entityinfo ) ;
mod - > entityinfo = NULL ;
Z_Free ( ( char * ) mod - > entities_raw ) ;
mod - > entities_raw = NULL ;
if ( str )
{
if ( docopy )
str = Z_StrDup ( str ) ;
mod - > entities_raw = str ;
}
}
void Mod_SetEntitiesStringLen ( model_t * mod , const char * str , size_t strsize )
{
if ( str )
{
char * cpy = BZ_Malloc ( strsize + 1 ) ;
memcpy ( cpy , str , strsize ) ;
cpy [ strsize ] = 0 ;
Mod_SetEntitiesString ( mod , cpy , false ) ;
}
else
Mod_SetEntitiesString ( mod , str , false ) ;
}
2016-12-07 18:45:25 +00:00
void Mod_ParseEntities ( model_t * mod )
{
char key [ 1024 ] ;
char value [ 4096 ] ;
const char * entstart ;
const char * entend ;
const char * entdata ;
size_t c , m ;
c = 0 ; m = 0 ;
while ( mod - > numentityinfo > 0 )
Z_Free ( mod - > entityinfo [ - - mod - > numentityinfo ] . keyvals ) ;
Z_Free ( mod - > entityinfo ) ;
mod - > entityinfo = NULL ;
2021-04-14 05:21:04 +00:00
entdata = Mod_GetEntitiesString ( mod ) ;
2016-12-07 18:45:25 +00:00
while ( 1 )
{
if ( ! ( entdata = COM_ParseOut ( entdata , key , sizeof ( key ) ) ) )
break ;
if ( strcmp ( key , " { " ) )
break ;
//skip whitespace to save space.
while ( * entdata = = ' ' | | * entdata = = ' \r ' | | * entdata = = ' \n ' | | * entdata = = ' \t ' )
entdata + + ;
entstart = entdata ;
while ( 1 )
{
entend = entdata ;
entdata = COM_ParseOut ( entdata , key , sizeof ( key ) ) ;
if ( ! strcmp ( key , " } " ) )
break ;
entdata = COM_ParseOut ( entdata , value , sizeof ( value ) ) ;
}
if ( ! entdata )
break ; //erk. eof
if ( c = = m )
{
if ( ! m )
m = 64 ;
else
m * = 2 ;
mod - > entityinfo = BZ_Realloc ( mod - > entityinfo , sizeof ( * mod - > entityinfo ) * m ) ;
}
2017-04-18 11:12:17 +00:00
mod - > entityinfo [ c ] . id = c + 1 ;
2016-12-07 18:45:25 +00:00
mod - > entityinfo [ c ] . keyvals = BZ_Malloc ( entend - entstart + 1 ) ;
memcpy ( mod - > entityinfo [ c ] . keyvals , entstart , entend - entstart ) ;
mod - > entityinfo [ c ] . keyvals [ entend - entstart ] = 0 ;
c + + ;
}
mod - > numentityinfo = c ;
}
2021-11-03 20:30:40 +00:00
void Mod_LoadMapArchive ( model_t * mod , void * archivedata , size_t archivesize )
{
if ( archivesize & & mod & & ! mod - > archive & & mod_loadmappackages . ival )
{
vfsfile_t * f = VFSPIPE_Open ( 1 , true ) ;
if ( f )
{
VFS_WRITE ( f , archivedata , archivesize ) ;
mod - > archive = FSZIP_LoadArchive ( f , NULL , mod - > name , mod - > name , NULL ) ;
if ( mod - > archive )
FS_LoadMapPackFile ( mod - > name , mod - > archive ) ; //give it to the filesystem to use.
else
VFS_CLOSE ( f ) ; //give up.
}
}
}
2009-11-04 21:16:50 +00:00
/*
= = = = = = = = = = = = = = = = = = =
Mod_ClearAll
= = = = = = = = = = = = = = = = = = =
2013-07-14 12:22:51 +00:00
called before new content is loaded .
2009-11-04 21:16:50 +00:00
*/
2013-07-14 12:22:51 +00:00
static int mod_datasequence ;
void Mod_ClearAll ( void )
2009-11-04 21:16:50 +00:00
{
# ifdef RUNTIMELIGHTING
2020-02-11 18:06:10 +00:00
RelightTerminate ( NULL ) ;
2009-11-04 21:16:50 +00:00
# endif
2013-07-14 12:22:51 +00:00
mod_datasequence + + ;
}
2017-05-23 07:03:07 +00:00
qboolean Mod_PurgeModel ( model_t * mod , enum mod_purge_e ptype )
{
if ( mod - > loadstate = = MLS_LOADING )
{
if ( ptype = = MP_MAPCHANGED & & ! mod - > submodelof )
return false ; //don't bother waiting for it on map changes.
COM_WorkerPartialSync ( mod , & mod - > loadstate , MLS_LOADING ) ;
}
# ifdef RUNTIMELIGHTING
2020-02-11 18:06:10 +00:00
RelightTerminate ( mod ) ;
2017-05-23 07:03:07 +00:00
# endif
# ifdef TERRAIN
//we can safely flush all terrain sections at any time
2021-06-21 13:46:06 +00:00
if ( mod - > terrain )
{
if ( ptype = = MP_MAPCHANGED )
return false ; //don't destroy any data there that the user might want to save. FIXME: handle better.
2017-05-23 07:03:07 +00:00
Terr_PurgeTerrainModel ( mod , false , true ) ;
2021-06-21 13:46:06 +00:00
}
2017-05-23 07:03:07 +00:00
# endif
//purge any vbos
if ( mod - > type = = mod_brush )
{
2021-06-21 13:46:06 +00:00
if ( ptype = = MP_FLUSH )
2017-05-23 07:03:07 +00:00
return false ;
# ifndef SERVERONLY
Surf_Clear ( mod ) ;
# endif
}
# ifdef TERRAIN
if ( mod - > type = = mod_brush | | mod - > type = = mod_heightmap )
Terr_FreeModel ( mod ) ;
# endif
if ( mod - > type = = mod_alias )
{
Mod_DestroyMesh ( mod - > meshinfo ) ;
mod - > meshinfo = NULL ;
}
Mod_SetEntitiesString ( mod , NULL , false ) ;
# ifdef PSET_SCRIPT
PScript_ClearSurfaceParticles ( mod ) ;
# endif
//and obliterate anything else remaining in memory.
mod - > meshinfo = NULL ;
2021-05-28 07:07:48 +00:00
if ( mod - > archive )
{
FS_CloseMapPackFile ( mod - > archive ) ;
mod - > archive = NULL ;
}
ZG_FreeGroup ( & mod - > memgroup ) ;
2017-05-23 07:03:07 +00:00
mod - > loadstate = MLS_NOTLOADED ;
mod - > submodelof = NULL ;
mod - > pvs = NULL ;
mod - > phs = NULL ;
2017-07-04 05:07:51 +00:00
# ifndef CLIENTONLY
sv . world . lastcheckpvs = NULL ; //if the server has that cached, flush it just in case.
# endif
2017-05-23 07:03:07 +00:00
return true ;
}
2013-10-29 17:38:22 +00:00
//can be called in one of two ways.
//force=true: explicit flush. everything goes, even if its still in use.
//force=false: map change. lots of stuff is no longer in use and can be freely flushed.
//certain models cannot be safely flushed while still in use. such models will not be flushed even if forced (they may still be partially flushed).
void Mod_Purge ( enum mod_purge_e ptype )
2013-07-14 12:22:51 +00:00
{
int i ;
model_t * mod ;
2013-10-29 17:38:22 +00:00
qboolean unused ;
2013-07-14 12:22:51 +00:00
2009-11-04 21:16:50 +00:00
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
{
2013-10-29 17:38:22 +00:00
unused = mod - > datasequence ! = mod_datasequence ;
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
if ( mod - > loadstate = = MLS_NOTLOADED )
continue ;
2013-07-14 12:22:51 +00:00
//this model isn't active any more.
2013-10-29 17:38:22 +00:00
if ( unused | | ptype ! = MP_MAPCHANGED )
2009-11-04 21:16:50 +00:00
{
2013-10-29 17:38:22 +00:00
if ( unused )
2017-03-04 19:36:06 +00:00
Con_DLPrintf ( 2 , " model \" %s \" no longer needed \n " , mod - > name ) ;
2017-05-23 07:03:07 +00:00
Mod_PurgeModel ( mod , ( ptype = = MP_FLUSH & & unused ) ? MP_RESET : ptype ) ;
2013-07-14 12:22:51 +00:00
}
2021-07-19 22:47:29 +00:00
# if defined(HALFLIFEMODELS) && defined(HAVE_CLIENT)
2021-07-23 19:11:38 +00:00
else if ( mod - > type = = mod_halflife )
2021-07-19 22:47:29 +00:00
R_HalfLife_TouchTextures ( mod ) ;
# endif
2009-11-04 21:16:50 +00:00
}
}
2023-02-20 05:50:50 +00:00
void Mod_SetModifier ( const char * modifier )
{
if ( ! modifier | | strlen ( modifier ) > = sizeof ( mod_modifier ) ) modifier = " " ;
if ( strcmp ( modifier , mod_modifier ) )
{ //if the modifier changed, force all models to reset.
COM_WorkerFullSync ( ) ; //sync all the workers, just in case.
strcpy ( mod_modifier , modifier ) ;
Mod_Purge ( MP_RESET ) ; //nuke it now
}
}
2018-08-04 07:05:20 +00:00
# ifndef SERVERONLY
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
void Mod_BSPX_Init ( void ) ;
2018-08-04 07:05:20 +00:00
# endif
2018-07-24 13:59:42 +00:00
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = =
Mod_Init
= = = = = = = = = = = = = = =
*/
2013-10-29 17:38:22 +00:00
void Mod_Init ( qboolean initial )
2004-08-22 22:29:09 +00:00
{
2015-06-14 08:16:15 +00:00
if ( ! mod_known )
mod_known = malloc ( MAX_MOD_KNOWN * sizeof ( * mod_known ) ) ;
2013-10-29 17:38:22 +00:00
if ( ! initial )
{
Mod_ClearAll ( ) ; //shouldn't be needed
Mod_Purge ( MP_RESET ) ; //shouldn't be needed
mod_numknown = 0 ;
2017-01-13 00:39:50 +00:00
# ifdef Q1BSPS
2013-10-29 17:38:22 +00:00
Q1BSP_Init ( ) ;
2017-01-13 00:39:50 +00:00
# endif
2013-10-29 17:38:22 +00:00
Cmd_AddCommand ( " mod_memlist " , Mod_MemList_f ) ;
2015-06-14 08:16:15 +00:00
# ifndef SERVERONLY
2013-10-29 17:38:22 +00:00
Cmd_AddCommand ( " mod_batchlist " , Mod_BatchList_f ) ;
Cmd_AddCommand ( " mod_texturelist " , Mod_TextureList_f ) ;
Cmd_AddCommand ( " mod_usetexture " , Mod_BlockTextureColour_f ) ;
2014-05-10 13:42:13 +00:00
# endif
2013-10-29 17:38:22 +00:00
}
2014-09-08 23:47:19 +00:00
else
2014-10-05 20:04:11 +00:00
{
2014-09-08 23:47:19 +00:00
Cvar_Register ( & mod_external_vis , " Graphical Nicaties " ) ;
2014-10-05 20:04:11 +00:00
Cvar_Register ( & mod_warnmodels , " Graphical Nicaties " ) ;
2016-07-12 00:40:13 +00:00
Cvar_Register ( & mod_litsprites_force , " Graphical Nicaties " ) ;
2014-10-05 20:04:11 +00:00
Cvar_Register ( & mod_loadentfiles , NULL ) ;
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
Cvar_Register ( & mod_loadentfiles_dir , NULL ) ;
2021-06-01 10:56:08 +00:00
Cvar_Register ( & mod_loadmappackages , NULL ) ;
2021-07-01 01:16:29 +00:00
Cvar_Register ( & mod_lightscale_broken , NULL ) ;
2022-01-08 09:59:54 +00:00
Cvar_Register ( & mod_lightpoint_distance , NULL ) ;
2018-12-28 00:04:36 +00:00
Cvar_Register ( & r_meshpitch , " Gamecode " ) ;
2020-10-06 03:17:28 +00:00
Cvar_Register ( & r_meshroll , " Gamecode " ) ;
2023-08-08 18:17:18 +00:00
Cvar_Register ( & r_nolerp_list , " Graphical Nicaties " ) ;
2021-08-24 06:06:05 +00:00
# ifdef RTLIGHTS
2023-08-08 18:17:18 +00:00
Cvar_Register ( & r_noshadow_list , " Graphical Nicaties " ) ;
2021-08-24 06:06:05 +00:00
# endif
2018-12-10 15:02:55 +00:00
Cmd_AddCommandD ( " sv_saveentfile " , Mod_SaveEntFile_f , " Dumps a copy of the map's entities to disk, so that it can be edited and used as a replacement for slightly customised maps. " ) ;
Cmd_AddCommandD ( " mod_showent " , Mod_ShowEnt_f , " Allows you to quickly search through a map's entities. " ) ;
2014-10-05 20:04:11 +00:00
Cmd_AddCommand ( " version_modelformats " , Mod_PrintFormats_f ) ;
2018-07-24 13:59:42 +00:00
2021-06-21 19:13:33 +00:00
# ifdef SPRMODELS
Cvar_Register ( & r_sprite_backfacing , NULL ) ;
# endif
2018-08-04 07:05:20 +00:00
# ifndef SERVERONLY
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Mod_BSPX_Init ( ) ;
2018-08-04 07:05:20 +00:00
# endif
2014-10-05 20:04:11 +00:00
}
2013-10-29 17:38:22 +00:00
if ( initial )
{
Alias_Register ( ) ;
2014-05-10 13:42:13 +00:00
# ifdef SPRMODELS
2013-10-29 17:38:22 +00:00
Mod_RegisterModelFormatMagic ( NULL , " Quake1 Sprite (spr) " , IDSPRITEHEADER , Mod_LoadSpriteModel ) ;
2014-05-10 13:42:13 +00:00
# endif
2013-10-29 17:38:22 +00:00
# ifdef SP2MODELS
Mod_RegisterModelFormatMagic ( NULL , " Quake2 Sprite (sp2) " , IDSPRITE2HEADER , Mod_LoadSprite2Model ) ;
# endif
//q2/q3bsps
2023-08-13 00:24:38 +00:00
# ifdef Q3BSPS
Mod_RegisterModelFormatMagic ( NULL , " RTCW Map (bsp) " , " IBSP \57 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Quake3 Map (bsp) " , " IBSP \56 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
2013-10-29 17:38:22 +00:00
# endif
2023-08-13 00:24:38 +00:00
# ifdef Q2BSPS
Mod_RegisterModelFormatMagic ( NULL , " Quake2 Map (bsp) " , " IBSP \46 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Quake2World Map (bsp) " , " IBSP \105 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Qbism (Quake2) Map (bsp) " , " QBSP \46 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
2018-08-04 19:00:19 +00:00
# endif
2017-02-19 00:15:42 +00:00
# ifdef RFBSPS
2023-08-13 00:24:38 +00:00
Mod_RegisterModelFormatMagic ( NULL , " Raven Map (bsp) " , " RBSP \1 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " QFusion Map (bsp) " , " FBSP \1 \0 \0 \0 " , 8 , Mod_LoadQ2BrushModel ) ;
2013-10-29 17:38:22 +00:00
# endif
//doom maps
# ifdef MAP_DOOM
2021-11-03 20:31:32 +00:00
Mod_RegisterModelFormatMagic ( NULL , " Doom IWad Map " , " IWAD " , 4 , Mod_LoadDoomLevel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Doom PWad Map " , " PWAD " , 4 , Mod_LoadDoomLevel ) ;
2013-10-29 17:38:22 +00:00
# endif
2013-12-07 00:30:48 +00:00
# ifdef MAP_PROC
Mod_RegisterModelFormatText ( NULL , " Doom3 (cm) " , " CM " , D3_LoadMap_CollisionMap ) ;
# endif
2017-01-13 00:39:50 +00:00
# ifdef Q1BSPS
2013-10-29 17:38:22 +00:00
//q1-based formats
2018-09-23 19:35:24 +00:00
Mod_RegisterModelFormatMagic ( NULL , " Quake1 2PSB Map (bsp) " , BSPVERSION_LONG1 , Mod_LoadBrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Quake1 BSP2 Map (bsp) " , BSPVERSION_LONG2 , Mod_LoadBrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Half-Life Map (bsp) " , BSPVERSIONHL , Mod_LoadBrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Quake1 Map (bsp) " , BSPVERSION , Mod_LoadBrushModel ) ;
Mod_RegisterModelFormatMagic ( NULL , " Quake1 Prerelease Map (bsp) " , BSPVERSIONPREREL , Mod_LoadBrushModel ) ;
2021-08-21 18:16:13 +00:00
Mod_RegisterModelFormatMagic ( NULL , " Quake 64 Remastered Map (bsp) " , BSPVERSIONQ64 , Mod_LoadBrushModel ) ;
2017-01-13 00:39:50 +00:00
# endif
2013-10-29 17:38:22 +00:00
}
2004-08-22 22:29:09 +00:00
}
2013-10-29 17:38:22 +00:00
void Mod_Shutdown ( qboolean final )
2004-08-22 22:29:09 +00:00
{
2013-10-29 17:38:22 +00:00
if ( final )
{
2015-06-14 08:16:15 +00:00
Mod_ClearAll ( ) ;
Mod_Purge ( MP_RESET ) ;
2013-10-29 17:38:22 +00:00
Mod_UnRegisterAllModelFormats ( NULL ) ;
}
else
{
Mod_ClearAll ( ) ;
Mod_Purge ( MP_RESET ) ;
2004-08-22 22:29:09 +00:00
2013-10-29 17:38:22 +00:00
Cmd_RemoveCommand ( " mod_memlist " ) ;
Cmd_RemoveCommand ( " mod_batchlist " ) ;
Cmd_RemoveCommand ( " mod_texturelist " ) ;
Cmd_RemoveCommand ( " mod_usetexture " ) ;
}
2014-08-25 07:35:41 +00:00
free ( mod_known ) ;
mod_known = NULL ;
mod_numknown = 0 ;
2014-08-29 04:50:49 +00:00
# ifndef SERVERONLY
2014-08-25 07:35:41 +00:00
r_worldentity . model = NULL ; //just in case.
2014-10-22 19:41:20 +00:00
cl_numvisedicts = 0 ; //make sure nothing gets cached.
2014-08-29 04:50:49 +00:00
# endif
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = =
Mod_Init
Caches the data if needed
= = = = = = = = = = = = = = =
*/
2013-07-14 12:22:51 +00:00
void * Mod_Extradata ( model_t * mod )
2004-08-22 22:29:09 +00:00
{
void * r ;
2013-07-14 12:22:51 +00:00
r = mod - > meshinfo ;
2004-08-22 22:29:09 +00:00
if ( r )
return r ;
2014-03-30 08:55:06 +00:00
Mod_LoadModel ( mod , MLV_ERROR ) ;
2004-08-22 22:29:09 +00:00
2013-07-14 12:22:51 +00:00
if ( ! mod - > meshinfo )
2004-08-22 22:29:09 +00:00
Sys_Error ( " Mod_Extradata: caching failed " ) ;
2013-07-14 12:22:51 +00:00
return mod - > meshinfo ;
2004-08-22 22:29:09 +00:00
}
2014-10-05 20:04:11 +00:00
const char * Mod_FixName ( const char * modname , const char * worldname )
{
if ( * modname = = ' * ' & & worldname & & * worldname )
{
//make sure that the value is an inline value with no existing extra postfix or anything.
char * e ;
if ( strtoul ( modname + 1 , & e , 10 ) ! = 0 )
if ( ! * e )
return va ( " %s:%s " , modname , worldname ) ;
}
return modname ;
}
2019-07-29 05:28:20 +00:00
//Called when the given file was (re)written.
//
void Mod_FileWritten ( const char * filename )
{
int i ;
model_t * mod ;
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
if ( ! strcmp ( mod - > publicname , filename ) )
{
if ( mod - > loadstate ! = MLS_NOTLOADED )
Mod_PurgeModel ( mod , MP_RESET ) ;
}
}
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = =
Mod_FindName
= = = = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
model_t * Mod_FindName ( const char * name )
2004-08-22 22:29:09 +00:00
{
int i ;
model_t * mod ;
// if (!name[0])
// Sys_Error ("Mod_ForName: NULL name");
//
// search the currently loaded models
//
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
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
if ( ! strcmp ( mod - > publicname , name ) )
2004-08-22 22:29:09 +00:00
break ;
if ( i = = mod_numknown )
{
2014-10-05 20:04:11 +00:00
# ifdef LOADERTHREAD
Sys_LockMutex ( com_resourcemutex ) ;
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
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
if ( ! strcmp ( mod - > publicname , name ) )
2014-10-05 20:04:11 +00:00
break ;
if ( i = = mod_numknown )
{
# endif
if ( mod_numknown = = MAX_MOD_KNOWN )
2021-11-03 20:30:40 +00:00
{
# ifdef LOADERTHREAD
Sys_UnlockMutex ( com_resourcemutex ) ;
# endif
2014-10-05 20:04:11 +00:00
Sys_Error ( " mod_numknown == MAX_MOD_KNOWN " ) ;
2021-11-03 20:30:40 +00:00
return NULL ;
}
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
if ( strlen ( name ) > = sizeof ( mod - > publicname ) )
2021-11-03 20:30:40 +00:00
{
# ifdef LOADERTHREAD
Sys_UnlockMutex ( com_resourcemutex ) ;
# endif
2014-10-05 20:04:11 +00:00
Sys_Error ( " model name is too long: %s " , name ) ;
2021-11-03 20:30:40 +00:00
return NULL ;
}
2014-10-05 20:04:11 +00:00
memset ( mod , 0 , sizeof ( model_t ) ) ; //clear the old model as the renderers use the same globals
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
Q_strncpyz ( mod - > publicname , name , sizeof ( mod - > publicname ) ) ;
2014-10-05 20:04:11 +00:00
Q_strncpyz ( mod - > name , name , sizeof ( mod - > name ) ) ;
mod - > loadstate = MLS_NOTLOADED ;
mod_numknown + + ;
mod - > particleeffect = - 1 ;
mod - > particletrail = - 1 ;
# ifdef LOADERTHREAD
}
Sys_UnlockMutex ( com_resourcemutex ) ;
# endif
2004-08-22 22:29:09 +00:00
}
2015-03-03 00:14:43 +00:00
// if (mod->loadstate == MLS_FAILED)
// mod->loadstate = MLS_NOTLOADED;
2013-10-29 17:38:22 +00:00
2013-07-14 12:22:51 +00:00
//mark it as active, so it doesn't get flushed prematurely
mod - > datasequence = mod_datasequence ;
2004-08-22 22:29:09 +00:00
return mod ;
}
/*
= = = = = = = = = = = = = = = = = =
Mod_TouchModel
= = = = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
void Mod_TouchModel ( const char * name )
2004-08-22 22:29:09 +00:00
{
2014-10-05 20:04:11 +00:00
//findname does this anyway.
Mod_FindName ( name ) ;
2004-08-22 22:29:09 +00:00
}
2013-10-29 17:38:22 +00:00
static struct
{
void * module ;
char * formatname ;
char * ident ;
2021-11-03 20:31:32 +00:00
qbyte * magic ;
size_t magicsize ;
2014-03-30 08:55:06 +00:00
qboolean ( QDECL * load ) ( model_t * mod , void * buffer , size_t buffersize ) ;
2013-10-29 17:38:22 +00:00
} modelloaders [ 64 ] ;
2014-10-05 20:04:11 +00:00
static void Mod_PrintFormats_f ( void )
{
int i ;
for ( i = 0 ; i < sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) ; i + + )
{
if ( modelloaders [ i ] . load & & modelloaders [ i ] . formatname )
Con_Printf ( " %s \n " , modelloaders [ i ] . formatname ) ;
}
}
2014-05-16 01:34:58 +00:00
int Mod_RegisterModelFormatText ( void * module , const char * formatname , char * magictext , qboolean ( QDECL * load ) ( model_t * mod , void * buffer , size_t fsize ) )
2013-10-29 17:38:22 +00:00
{
int i , free = - 1 ;
for ( i = 0 ; i < sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) ; i + + )
{
if ( modelloaders [ i ] . ident & & ! strcmp ( modelloaders [ i ] . ident , magictext ) )
{
free = i ;
break ; //extension match always replaces
}
else if ( ! modelloaders [ i ] . load & & free < 0 )
free = i ;
}
if ( free < 0 )
return 0 ;
modelloaders [ free ] . module = module ;
modelloaders [ free ] . formatname = Z_StrDup ( formatname ) ;
2021-11-03 20:31:32 +00:00
modelloaders [ free ] . magic = NULL ;
modelloaders [ free ] . magicsize = 0 ;
2013-10-29 17:38:22 +00:00
modelloaders [ free ] . ident = Z_StrDup ( magictext ) ;
modelloaders [ free ] . load = load ;
return free + 1 ;
}
2021-11-03 20:31:32 +00:00
int Mod_RegisterModelFormatMagic ( void * module , const char * formatname , qbyte * magic , size_t magicsize , qboolean ( QDECL * load ) ( model_t * mod , void * buffer , size_t fsize ) )
2013-10-29 17:38:22 +00:00
{
int i , free = - 1 ;
for ( i = 0 ; i < sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) ; i + + )
{
2021-11-03 20:31:32 +00:00
if ( modelloaders [ i ] . magic & & modelloaders [ i ] . magicsize = = magicsize & & ! memcmp ( modelloaders [ i ] . magic , magic , magicsize ) )
2013-10-29 17:38:22 +00:00
{
free = i ;
break ; //extension match always replaces
}
else if ( ! modelloaders [ i ] . load & & free < 0 )
free = i ;
}
if ( free < 0 )
return 0 ;
modelloaders [ free ] . module = module ;
if ( modelloaders [ free ] . formatname )
Z_Free ( modelloaders [ free ] . formatname ) ;
modelloaders [ free ] . formatname = Z_StrDup ( formatname ) ;
modelloaders [ free ] . magic = magic ;
2021-11-03 20:31:32 +00:00
modelloaders [ free ] . magicsize = magicsize ;
2013-10-29 17:38:22 +00:00
modelloaders [ free ] . ident = NULL ;
modelloaders [ free ] . load = load ;
return free + 1 ;
}
2014-05-16 01:34:58 +00:00
void Mod_UnRegisterModelFormat ( void * module , int idx )
2013-10-29 17:38:22 +00:00
{
2014-10-05 20:04:11 +00:00
2013-10-29 17:38:22 +00:00
idx - - ;
if ( ( unsigned int ) ( idx ) > = sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) )
return ;
2014-05-16 01:34:58 +00:00
if ( modelloaders [ idx ] . module ! = module )
return ;
2013-10-29 17:38:22 +00:00
2014-10-05 20:04:11 +00:00
COM_WorkerFullSync ( ) ;
2013-10-29 17:38:22 +00:00
Z_Free ( modelloaders [ idx ] . ident ) ;
modelloaders [ idx ] . ident = NULL ;
Z_Free ( modelloaders [ idx ] . formatname ) ;
modelloaders [ idx ] . formatname = NULL ;
modelloaders [ idx ] . magic = 0 ;
modelloaders [ idx ] . load = NULL ;
modelloaders [ idx ] . module = NULL ;
//FS_Restart will be needed
}
2014-05-16 01:34:58 +00:00
void Mod_UnRegisterAllModelFormats ( void * module )
2013-10-29 17:38:22 +00:00
{
int i ;
2014-10-05 20:04:11 +00:00
COM_WorkerFullSync ( ) ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) ; i + + )
{
if ( modelloaders [ i ] . module = = module )
2014-05-16 01:34:58 +00:00
Mod_UnRegisterModelFormat ( module , i + 1 ) ;
2013-10-29 17:38:22 +00:00
}
}
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
//main thread. :(
2014-10-05 20:04:11 +00:00
void Mod_ModelLoaded ( void * ctx , void * data , size_t a , size_t b )
{
2015-03-03 00:14:43 +00:00
qboolean previouslyfailed ;
2014-10-05 20:04:11 +00:00
model_t * mod = ctx ;
enum mlverbosity_e verbose = b ;
# ifndef SERVERONLY
P_LoadedModel ( mod ) ;
# endif
2015-03-03 00:14:43 +00:00
previouslyfailed = mod - > loadstate = = MLS_FAILED ;
2015-01-08 13:09:20 +00:00
mod - > loadstate = a ;
2014-10-05 20:04:11 +00:00
# ifdef TERRAIN
if ( mod - > terrain )
Terr_FinishTerrain ( mod ) ;
# endif
# ifndef SERVERONLY
if ( mod - > type = = mod_brush )
Surf_BuildModelLightmaps ( mod ) ;
if ( mod - > type = = mod_sprite )
{
Mod_LoadSpriteShaders ( mod ) ;
}
if ( mod - > type = = mod_alias )
{
if ( qrenderer ! = QR_NONE )
Mod_LoadAliasShaders ( mod ) ;
# ifdef RAGDOLL
{
int numbones = Mod_GetNumBones ( mod , false ) ;
if ( numbones )
{
size_t filesize ;
char * buf ;
char dollname [ MAX_QPATH ] ;
Q_snprintfz ( dollname , sizeof ( dollname ) , " %s.doll " , mod - > name ) ;
2018-07-05 16:21:44 +00:00
buf = FS_LoadMallocFile ( dollname , & filesize ) ;
2014-10-05 20:04:11 +00:00
if ( buf )
{
mod - > dollinfo = rag_createdollfromstring ( mod , dollname , numbones , buf ) ;
BZ_Free ( buf ) ;
}
}
}
# endif
}
# endif
switch ( verbose )
{
default :
case MLV_ERROR :
Host_EndGame ( " Mod_NumForName: %s not found or couldn't load " , mod - > name ) ;
break ;
2015-10-27 15:20:15 +00:00
case MLV_WARNSYNC :
2014-10-05 20:04:11 +00:00
case MLV_WARN :
2015-03-03 00:14:43 +00:00
if ( * mod - > name ! = ' * ' & & strcmp ( mod - > name , " null " ) & & mod_warnmodels . ival & & ! previouslyfailed )
2014-10-05 20:04:11 +00:00
Con_Printf ( CON_ERROR " Unable to load %s \n " , mod - > name ) ;
break ;
case MLV_SILENT :
2022-03-08 05:31:34 +00:00
case MLV_SILENTSYNC :
2014-10-05 20:04:11 +00:00
break ;
}
}
2021-11-03 20:31:52 +00:00
void Mod_SubmodelLoaded ( model_t * mod , int state )
{
COM_AddWork ( WG_MAIN , Mod_ModelLoaded , mod , NULL , MLS_LOADED , 0 ) ;
}
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = =
Mod_LoadModel
Loads a model into the cache
= = = = = = = = = = = = = = = = = =
*/
2017-01-13 00:39:50 +00:00
static void Mod_LoadModelWorker ( void * ctx , void * data , size_t a , size_t b )
2004-08-22 22:29:09 +00:00
{
2014-10-05 20:04:11 +00:00
model_t * mod = ctx ;
enum mlverbosity_e verbose = a ;
2004-08-22 22:29:09 +00:00
unsigned * buf = NULL ;
2007-09-13 22:27:56 +00:00
char mdlbase [ MAX_QPATH ] ;
char * replstr ;
2016-02-15 06:01:17 +00:00
# ifdef DSPMODELS
2014-10-05 20:04:11 +00:00
qboolean doomsprite = false ;
2016-02-15 06:01:17 +00:00
# endif
2021-11-03 20:31:32 +00:00
unsigned int i ;
2014-10-05 20:04:11 +00:00
size_t filesize ;
char ext [ 8 ] ;
2021-08-28 07:10:03 +00:00
int basedepth ;
2004-08-22 22:29:09 +00:00
2022-05-28 17:58:21 +00:00
//clear out any old state.
memset ( & mod - > loadstate + 1 , 0 , sizeof ( * mod ) - ( qintptr_t ) ( & ( ( model_t * ) NULL ) - > loadstate + 1 ) ) ;
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
if ( ! * mod - > publicname )
2004-08-22 22:29:09 +00:00
{
2012-09-30 05:52:03 +00:00
mod - > type = mod_dummy ;
mod - > mins [ 0 ] = - 16 ;
mod - > mins [ 1 ] = - 16 ;
mod - > mins [ 2 ] = - 16 ;
mod - > maxs [ 0 ] = 16 ;
mod - > maxs [ 1 ] = 16 ;
mod - > maxs [ 2 ] = 16 ;
mod - > engineflags = 0 ;
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , Mod_ModelLoaded , mod , NULL , MLS_LOADED , 0 ) ;
2014-10-05 20:04:11 +00:00
return ;
2004-08-22 22:29:09 +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
# ifdef RAGDOLL
if ( mod - > dollinfo )
{
rag_freedoll ( mod - > dollinfo ) ;
mod - > dollinfo = NULL ;
}
# endif
2014-10-05 20:04:11 +00:00
if ( mod - > loadstate = = MLS_FAILED )
return ;
2013-10-29 17:38:22 +00:00
2004-08-22 22:29:09 +00:00
//
// load the file
//
2006-03-06 00:19:46 +00:00
// set necessary engine flags for loading purposes
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
if ( ! strcmp ( mod - > publicname , " progs/player.mdl " ) )
2006-03-06 00:19:46 +00:00
mod - > engineflags | = MDLF_PLAYER | MDLF_DOCRC ;
2018-09-29 17:31:58 +00:00
else if ( ! strcmp ( mod - > publicname , " progs/flame.mdl " )
| | ! strcmp ( mod - > publicname , " progs/flame2.mdl " )
# ifdef HEXEN2
| | ! strcmp ( mod - > publicname , " models/flame1.mdl " ) //hexen2 small standing flame
| | ! strcmp ( mod - > publicname , " models/flame2.mdl " ) //hexen2 large standing flame
| | ! strcmp ( mod - > publicname , " models/cflmtrch.mdl " ) //hexen2 wall torch
# endif
)
2023-08-08 18:17:18 +00:00
mod - > engineflags | = MDLF_FLAME | MDLF_NOSHADOWS ;
2018-09-29 17:31:58 +00:00
else if ( ! strcmp ( mod - > publicname , " progs/bolt.mdl " )
| | ! strcmp ( mod - > publicname , " progs/bolt2.mdl " )
| | ! strcmp ( mod - > publicname , " progs/bolt3.mdl " )
| | ! strcmp ( mod - > publicname , " progs/beam.mdl " )
# ifdef HEXEN2
| | ! strcmp ( mod - > publicname , " models/stsunsf2.mdl " )
| | ! strcmp ( mod - > publicname , " models/stsunsf1.mdl " )
| | ! strcmp ( mod - > publicname , " models/stice.mdl " )
# endif
)
2023-08-08 18:17:18 +00:00
mod - > engineflags | = MDLF_NOSHADOWS ;
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
else if ( ! strcmp ( mod - > publicname , " progs/backpack.mdl " ) )
2008-02-01 15:21:14 +00:00
mod - > engineflags | = MDLF_NOTREPLACEMENTS ;
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
else if ( ! strcmp ( mod - > publicname , " progs/eyes.mdl " ) )
2008-02-01 15:21:14 +00:00
mod - > engineflags | = MDLF_NOTREPLACEMENTS | MDLF_DOCRC ;
2006-03-06 00:19:46 +00:00
2012-01-24 04:24:14 +00:00
/*handle ezquake-originated cheats that would feck over fte users if fte didn't support
these are the conditions required for r_fb_models on non - players */
mod - > engineflags | = MDLF_EZQUAKEFBCHEAT ;
if ( ( mod - > engineflags & MDLF_DOCRC ) | |
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
! strcmp ( mod - > publicname , " progs/backpack.mdl " ) | |
! strcmp ( mod - > publicname , " progs/gib1.mdl " ) | |
! strcmp ( mod - > publicname , " progs/gib2.mdl " ) | |
! strcmp ( mod - > publicname , " progs/gib3.mdl " ) | |
! strcmp ( mod - > publicname , " progs/h_player.mdl " ) | |
! strncmp ( mod - > publicname , " progs/v_ " , 8 ) )
2012-01-24 04:24:14 +00:00
mod - > engineflags & = ~ MDLF_EZQUAKEFBCHEAT ;
2016-10-22 07:06:51 +00:00
mod - > engineflags | = MDLF_RECALCULATERAIN ;
2007-09-13 22:27:56 +00:00
// get string used for replacement tokens
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
COM_FileExtension ( mod - > publicname , ext , sizeof ( ext ) ) ;
2007-09-13 22:27:56 +00:00
if ( ! Q_strcasecmp ( ext , " spr " ) | | ! Q_strcasecmp ( ext , " sp2 " ) )
2008-11-09 22:29:28 +00:00
replstr = " " ; // sprite
2016-02-15 06:01:17 +00:00
# ifdef DSPMODELS
2007-09-13 22:27:56 +00:00
else if ( ! Q_strcasecmp ( ext , " dsp " ) ) // doom sprite
2004-08-22 22:29:09 +00:00
{
2008-11-09 22:29:28 +00:00
replstr = " " ;
2007-09-13 22:27:56 +00:00
doomsprite = true ;
}
2016-02-15 06:01:17 +00:00
# endif
2007-09-13 22:27:56 +00:00
else // assume models
replstr = r_replacemodels . string ;
// gl_load24bit 0 disables all replacements
2007-10-23 03:14:25 +00:00
if ( ! gl_load24bit . value )
2021-08-28 07:10:03 +00:00
{
2008-11-09 22:29:28 +00:00
replstr = " " ;
2021-08-28 07:10:03 +00:00
basedepth = FDEPTH_MISSING ;
}
else
basedepth = COM_FDepthFile ( mod - > publicname , true ) ;
2007-09-13 22:27:56 +00:00
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
COM_StripExtension ( mod - > publicname , mdlbase , sizeof ( mdlbase ) ) ;
2007-09-13 22:27:56 +00:00
2008-11-09 22:29:28 +00:00
while ( replstr )
2007-09-13 22:27:56 +00:00
{
2014-10-05 20:04:11 +00:00
char token [ 256 ] ;
replstr = COM_ParseStringSet ( replstr , token , sizeof ( token ) ) ;
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
2008-11-09 22:29:28 +00:00
if ( replstr )
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
{
2023-08-25 06:17:56 +00:00
char altname [ MAX_QPATH ] , * sl ;
sl = strchr ( token , ' / ' ) ;
if ( sl )
{ //models/name.mdl -> path/preslash/name.postslash
char * p = COM_SkipPath ( mdlbase ) ;
size_t ofs = ( p - mdlbase ) + ( sl + 1 - token ) ;
memcpy ( altname , mdlbase , p - mdlbase ) ;
memcpy ( altname + ( p - mdlbase ) , token , sl + 1 - token ) ;
if ( ofs + strlen ( p ) + strlen ( sl + 1 ) + 2 > sizeof ( altname ) )
continue ; //erk
Q_snprintfz ( altname + ofs , sizeof ( altname ) - ofs , " %s.%s " , p , sl + 1 ) ;
}
else
Q_snprintfz ( altname , sizeof ( altname ) , " %s.%s " , mdlbase , token ) ;
2021-08-28 07:10:03 +00:00
if ( COM_FDepthFile ( altname , true ) > basedepth )
continue ;
2014-10-05 20:04:11 +00:00
TRACE ( ( " Mod_LoadModel: Trying to load (replacement) model \" %s \" \n " , altname ) ) ;
2020-03-25 21:29:30 +00:00
buf = ( unsigned * ) FS_LoadMallocGroupFile ( NULL , altname , & filesize , true ) ;
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
if ( buf )
Q_strncpyz ( mod - > name , altname , sizeof ( mod - > name ) ) ;
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
}
2008-11-09 22:29:28 +00:00
else
2007-09-13 22:27:56 +00:00
{
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
TRACE ( ( " Mod_LoadModel: Trying to load model \" %s \" \n " , mod - > publicname ) ) ;
2020-03-25 21:29:30 +00:00
buf = ( unsigned * ) FS_LoadMallocGroupFile ( NULL , mod - > publicname , & filesize , true ) ;
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
if ( buf )
Q_strncpyz ( mod - > name , mod - > publicname , sizeof ( mod - > name ) ) ;
else if ( ! buf )
2007-09-13 22:27:56 +00:00
{
2014-05-10 13:42:13 +00:00
# ifdef DSPMODELS
2007-09-13 22:27:56 +00:00
if ( doomsprite ) // special case needed for doom sprites
{
2013-07-14 12:22:51 +00:00
TRACE ( ( " Mod_LoadModel: doomsprite: \" %s \" \n " , mod - > name ) ) ;
Mod_LoadDoomSprite ( mod ) ;
2014-10-05 20:04:11 +00:00
BZ_Free ( buf ) ;
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , Mod_ModelLoaded , mod , NULL , MLS_LOADED , 0 ) ;
2014-10-05 20:04:11 +00:00
return ;
2007-09-13 22:27:56 +00:00
}
# endif
2017-04-18 11:12:17 +00:00
# ifdef TERRAIN
if ( ! Q_strcasecmp ( ext , " map " ) )
{
const char * dummymap =
" { \n "
" classname worldspawn \n "
" wad \" base.wad \" \n " //we ARE a quake engine after all, and default.wad is generally wrong
" message \" Unnamed map \" \n "
" { \n "
" (-128 128 0) ( 128 128 0) ( 128 -128 0) \" WBRICK1_5 \" 0 0 0 1 1 \n "
" ( 128 -128 -16)( 128 128 -16) (-128 128 -16) \" WBRICK1_5 \" 0 0 0 1 1 \n "
" ( 128 128 0) (-128 128 0) (-128 128 -16) \" WBRICK1_5 \" 0 0 0 1 1 \n "
" (-128 -128 0) ( 128 -128 0) ( 128 -128 -16) \" WBRICK1_5 \" 0 0 0 1 1 \n "
" (-128 128 0) (-128 -128 0) (-128 -128 -16) \" WBRICK1_5 \" 0 0 0 1 1 \n "
" ( 128 -128 0) ( 128 128 0) ( 128 128 -16) \" WBRICK1_5 \" 0 0 0 1 1 \n "
" } \n "
" } \n "
" { \n "
" classname info_player_start \n "
" origin \" 0 0 24 \" \n "
" } \n "
" { \n "
" classname light \n "
" origin \" 0 0 64 \" \n "
" } \n " ;
buf = ( unsigned * ) Z_StrDup ( dummymap ) ;
filesize = strlen ( dummymap ) ;
}
else
# endif
break ; // failed to load unreplaced file and nothing left
2007-09-13 22:27:56 +00:00
}
}
2008-11-09 22:29:28 +00:00
if ( ! buf )
continue ;
2016-09-09 18:46:08 +00:00
if ( filesize < 4 )
{
BZ_Free ( buf ) ;
continue ;
}
2007-09-13 22:27:56 +00:00
//
// fill it in
//
2021-04-14 05:21:04 +00:00
if ( ! Mod_DoCRC ( mod , ( char * ) buf , filesize ) )
{
BZ_Free ( buf ) ;
continue ;
}
memset ( & mod - > funcs , 0 , sizeof ( mod - > funcs ) ) ; //just in case...
2010-05-01 22:47:47 +00:00
2018-06-02 08:55:57 +00:00
//look for known extensions first, to try to avoid issues with specific formats
for ( i = 0 ; i < countof ( modelloaders ) ; i + + )
2007-09-13 22:27:56 +00:00
{
2019-09-15 15:20:20 +00:00
if ( modelloaders [ i ] . load & & modelloaders [ i ] . ident & & * modelloaders [ i ] . ident = = ' . ' & & ! Q_strcasecmp ( modelloaders [ i ] . ident , COM_GetFileExtension ( mod - > name , NULL ) ) )
2013-10-29 17:38:22 +00:00
break ;
}
2018-06-02 08:55:57 +00:00
//now look to see if we can find one with the right magic header
if ( i = = countof ( modelloaders ) )
{
for ( i = 0 ; i < countof ( modelloaders ) ; i + + )
{
2021-11-03 20:31:32 +00:00
if ( modelloaders [ i ] . load & & modelloaders [ i ] . magic & & filesize > = modelloaders [ i ] . magicsize & & ! memcmp ( buf , modelloaders [ i ] . magic , modelloaders [ i ] . magicsize ) & & ! modelloaders [ i ] . ident )
2018-06-02 08:55:57 +00:00
break ;
}
}
if ( i < countof ( modelloaders ) )
2013-10-29 17:38:22 +00:00
{
2014-10-05 20:04:11 +00:00
if ( ! modelloaders [ i ] . load ( mod , buf , filesize ) )
{
BZ_Free ( buf ) ;
2007-09-13 22:27:56 +00:00
continue ;
2014-10-05 20:04:11 +00:00
}
2013-10-29 17:38:22 +00:00
}
else
{
2014-10-05 20:04:11 +00:00
COM_ParseOut ( ( char * ) buf , token , sizeof ( token ) ) ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) ; i + + )
2007-09-13 22:27:56 +00:00
{
2014-10-05 20:04:11 +00:00
if ( modelloaders [ i ] . load & & modelloaders [ i ] . ident & & ! strcmp ( modelloaders [ i ] . ident , token ) )
2013-10-29 17:38:22 +00:00
break ;
2007-09-13 22:27:56 +00:00
}
2013-10-29 17:38:22 +00:00
if ( i < sizeof ( modelloaders ) / sizeof ( modelloaders [ 0 ] ) )
2007-09-13 22:27:56 +00:00
{
2014-10-05 20:04:11 +00:00
if ( ! modelloaders [ i ] . load ( mod , buf , filesize ) )
{
BZ_Free ( buf ) ;
2007-09-13 22:27:56 +00:00
continue ;
2014-10-05 20:04:11 +00:00
}
2007-09-13 22:27:56 +00:00
}
2013-10-29 17:38:22 +00:00
else
{
2021-11-03 20:31:32 +00:00
Con_Printf ( CON_WARNING " Unrecognised model format %c%c%c%c \n " , ( ( char * ) buf ) [ 0 ] , ( ( char * ) buf ) [ 1 ] , ( ( char * ) buf ) [ 2 ] , ( ( char * ) buf ) [ 3 ] ) ;
2014-10-05 20:04:11 +00:00
BZ_Free ( buf ) ;
2013-10-29 17:38:22 +00:00
continue ;
}
}
2013-07-14 12:22:51 +00:00
TRACE ( ( " Mod_LoadModel: Loaded \n " ) ) ;
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
2014-10-05 20:04:11 +00:00
BZ_Free ( buf ) ;
------------------------------------------------------------------------
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
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , Mod_ModelLoaded , mod , NULL , MLS_LOADED , 0 ) ;
2014-10-05 20:04:11 +00:00
return ;
2004-08-22 22:29:09 +00:00
}
2007-09-13 22:27:56 +00:00
mod - > type = mod_dummy ;
mod - > mins [ 0 ] = - 16 ;
mod - > mins [ 1 ] = - 16 ;
mod - > mins [ 2 ] = - 16 ;
mod - > maxs [ 0 ] = 16 ;
mod - > maxs [ 1 ] = 16 ;
mod - > maxs [ 2 ] = 16 ;
mod - > engineflags = 0 ;
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , Mod_ModelLoaded , mod , NULL , MLS_FAILED , verbose ) ;
2014-10-05 20:04:11 +00:00
}
model_t * Mod_LoadModel ( model_t * mod , enum mlverbosity_e verbose )
{
if ( mod - > loadstate = = MLS_NOTLOADED & & * mod - > name ! = ' * ' )
{
2023-08-08 18:17:18 +00:00
const char * s = strstr ( r_nolerp_list . string , mod - > publicname ) ;
2021-08-24 06:06:05 +00:00
COM_AssertMainThread ( " Mod_LoadModel " ) ;
if ( s )
{
size_t l = strlen ( mod - > publicname ) ;
2023-08-08 18:17:18 +00:00
if ( ( s = = r_nolerp_list . string | | s [ - 1 ] = = ' , ' ) & & ( s [ l ] = = 0 | | s [ l ] = = ' , ' ) )
mod - > engineflags | = MDLF_NOLERP ;
}
# ifdef RTLIGHTS
s = strstr ( r_noshadow_list . string , mod - > publicname ) ;
if ( s )
{
size_t l = strlen ( mod - > publicname ) ;
if ( ( s = = r_noshadow_list . string | | s [ - 1 ] = = ' , ' ) & & ( s [ l ] = = 0 | | s [ l ] = = ' , ' ) )
2021-08-24 06:06:05 +00:00
mod - > engineflags | = MDLF_NOSHADOWS ;
}
# endif
2014-10-05 20:04:11 +00:00
mod - > loadstate = MLS_LOADING ;
2020-05-14 15:50:26 +00:00
if ( verbose = = MLV_ERROR | | verbose = = MLV_WARNSYNC )
COM_InsertWork ( WG_LOADER , Mod_LoadModelWorker , mod , NULL , verbose , 0 ) ;
else
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_LOADER , Mod_LoadModelWorker , mod , NULL , verbose , 0 ) ;
2014-10-05 20:04:11 +00:00
}
2022-03-08 05:31:34 +00:00
//block until its loaded, if we care.
if ( mod - > loadstate = = MLS_LOADING & & ( verbose = = MLV_ERROR | | verbose = = MLV_WARNSYNC | | verbose = = MLV_SILENTSYNC ) )
COM_WorkerPartialSync ( mod , & mod - > loadstate , MLS_LOADING ) ;
2014-10-05 20:04:11 +00:00
if ( verbose = = MLV_ERROR )
{
//someone already tried to load it without caring if it failed or not. make sure its loaded.
//fixme: this is a spinloop.
if ( mod - > loadstate ! = MLS_LOADED )
Host_EndGame ( " Mod_NumForName: %s not found or couldn't load " , mod - > name ) ;
}
2004-08-22 22:29:09 +00:00
return mod ;
}
/*
= = = = = = = = = = = = = = = = = =
Mod_ForName
Loads in a model for the given name
= = = = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
model_t * Mod_ForName ( const char * name , enum mlverbosity_e verbosity )
2004-08-22 22:29:09 +00:00
{
model_t * mod ;
2013-07-14 12:22:51 +00:00
mod = Mod_FindName ( name ) ;
2004-08-22 22:29:09 +00:00
2014-03-30 08:55:06 +00:00
return Mod_LoadModel ( mod , verbosity ) ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
BRUSHMODEL LOADING
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2017-02-19 00:15:42 +00:00
# if !defined(SERVERONLY)
2015-04-14 23:12:17 +00:00
static const struct
{
const char * oldname ;
unsigned int chksum ; //xor-compacted md4
const char * newname ;
} buggytextures [ ] =
{
//FIXME: we should load this table from disk or something.
//old sum new
{ " metal5_2 " , 0x45d110ec , " metal5_2_arc " } ,
{ " metal5_2 " , 0x0d275f87 , " metal5_2_x " } ,
{ " metal5_4 " , 0xf8e27da8 , " metal5_4_arc " } ,
{ " metal5_4 " , 0xa301c52e , " metal5_4_double " } ,
{ " metal5_8 " , 0xfaa8bf77 , " metal5_8_back " } ,
{ " metal5_8 " , 0x88792923 , " metal5_8_rune " } ,
{ " plat_top1 " , 0xfe4f9f5a , " plat_top1_bolt " } ,
{ " plat_top1 " , 0x9ac3fccf , " plat_top1_cable " } ,
{ " sky4 " , 0xde688b77 , " sky1 " } ,
// {"sky4", 0x8a010dc0, "sky4"},
// {"window03", ?, "window03_?"},
// {"window03", ?, "window03_?"},
//FIXME: hexen2 has the same issue.
} ;
static const char * Mod_RemapBuggyTexture ( const char * name , const qbyte * data , unsigned int datalen )
{
unsigned int i ;
2015-11-18 07:37:39 +00:00
if ( ! data )
return NULL ;
2015-04-14 23:12:17 +00:00
for ( i = 0 ; i < sizeof ( buggytextures ) / sizeof ( buggytextures [ 0 ] ) ; i + + )
{
if ( ! strcmp ( name , buggytextures [ i ] . oldname ) )
{
2023-02-20 06:13:40 +00:00
unsigned int sum = CalcHashInt ( & hash_md4 , data , datalen ) ;
2015-04-14 23:12:17 +00:00
for ( ; i < sizeof ( buggytextures ) / sizeof ( buggytextures [ 0 ] ) ; i + + )
{
if ( strcmp ( name , buggytextures [ i ] . oldname ) )
break ;
if ( sum = = buggytextures [ i ] . chksum )
return buggytextures [ i ] . newname ;
}
break ;
}
}
return NULL ;
}
2021-06-22 14:40:53 +00:00
static void Mod_FinishTexture ( model_t * mod , texture_t * tx , const char * loadname , qboolean safetoloadfromwads )
2017-01-13 00:39:50 +00:00
{
2009-11-04 21:16:50 +00:00
extern cvar_t gl_shadeq1_name ;
char altname [ MAX_QPATH ] ;
char * star ;
2015-04-14 23:12:17 +00:00
const char * origname = NULL ;
const char * shadername = tx - > name ;
2021-11-03 20:30:40 +00:00
if ( ! safetoloadfromwads | | ! tx - > shader )
2009-11-04 21:16:50 +00:00
{
2017-08-29 02:29:06 +00:00
//remap to avoid bugging out on textures with the same name and different images (vanilla content sucks)
2020-03-07 09:00:40 +00:00
shadername = Mod_RemapBuggyTexture ( shadername , tx - > srcdata , tx - > srcwidth * tx - > srcheight ) ;
2017-08-29 02:29:06 +00:00
if ( shadername )
origname = tx - > name ;
else
shadername = tx - > name ;
2015-04-14 23:12:17 +00:00
2017-08-29 02:29:06 +00:00
//find the *
if ( ! * gl_shadeq1_name . string | | ! strcmp ( gl_shadeq1_name . string , " * " ) )
;
else if ( ! ( star = strchr ( gl_shadeq1_name . string , ' * ' ) ) | | ( strlen ( gl_shadeq1_name . string ) + strlen ( tx - > name ) + 1 > = sizeof ( altname ) ) ) //it's got to fit.
shadername = gl_shadeq1_name . string ;
2015-04-14 23:12:17 +00:00
else
{
2017-08-29 02:29:06 +00:00
strncpy ( altname , gl_shadeq1_name . string , star - gl_shadeq1_name . string ) ; //copy the left
altname [ star - gl_shadeq1_name . string ] = ' \0 ' ;
strcat ( altname , shadername ) ; //insert the *
strcat ( altname , star + 1 ) ; //add any final text.
shadername = altname ;
2015-04-14 23:12:17 +00:00
}
2021-06-22 14:40:53 +00:00
tx - > shader = R_RegisterCustom ( mod , shadername , SUF_LIGHTMAP , Shader_DefaultBSPQ1 , NULL ) ;
2017-08-29 02:29:06 +00:00
2020-03-07 09:00:40 +00:00
if ( ! tx - > srcdata & & ! safetoloadfromwads )
2015-10-11 11:34:58 +00:00
return ;
}
else
{ //already loaded. don't waste time / crash (this will be a dead pointer).
2020-03-07 09:00:40 +00:00
if ( tx - > srcdata )
2015-10-11 11:34:58 +00:00
return ;
2009-11-04 21:16:50 +00:00
}
2015-03-03 00:14:43 +00:00
if ( ! strncmp ( tx - > name , " sky " , 3 ) )
2020-03-07 09:00:40 +00:00
R_InitSky ( tx - > shader , shadername , tx - > srcfmt , tx - > srcdata , tx - > srcwidth , tx - > srcheight ) ;
2015-03-03 00:14:43 +00:00
else
{
unsigned int maps = 0 ;
2015-03-03 07:54:10 +00:00
maps | = SHADER_HASPALETTED ;
maps | = SHADER_HASDIFFUSE ;
2015-03-03 00:14:43 +00:00
if ( r_fb_bmodels . ival )
maps | = SHADER_HASFULLBRIGHT ;
2016-07-12 00:40:13 +00:00
if ( r_loadbumpmapping | | ( ( r_waterstyle . ival > 1 | | r_telestyle . ival > 1 ) & & * tx - > name = = ' * ' ) | | tx - > shader - > defaulttextures - > reflectcube )
2015-03-03 00:14:43 +00:00
maps | = SHADER_HASNORMALMAP ;
if ( gl_specular . ival )
maps | = SHADER_HASGLOSS ;
2016-12-09 09:09:12 +00:00
2020-03-07 09:00:40 +00:00
R_BuildLegacyTexnums ( tx - > shader , origname , loadname , maps , 0 , tx - > srcfmt , tx - > srcwidth , tx - > srcheight , tx - > srcdata , tx - > palette ) ;
2015-03-03 00:14:43 +00:00
}
2020-03-07 09:00:40 +00:00
BZ_Free ( tx - > srcdata ) ;
tx - > srcdata = NULL ;
2004-09-01 22:59:56 +00:00
}
2015-04-14 23:12:17 +00:00
# endif
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
void Mod_NowLoadExternal ( model_t * loadmodel )
2004-08-22 22:29:09 +00:00
{
2015-03-03 00:14:43 +00:00
//for halflife bsps where wads are loaded after the map.
2017-02-19 00:15:42 +00:00
# if !defined(SERVERONLY)
2015-03-03 00:14:43 +00:00
int i ;
2004-08-22 22:29:09 +00:00
texture_t * tx ;
2014-10-05 20:04:11 +00:00
char loadname [ 32 ] ;
COM_FileBase ( cl . worldmodel - > name , loadname , sizeof ( loadname ) ) ;
2015-03-03 00:14:43 +00:00
if ( ! strncmp ( loadname , " b_ " , 2 ) )
Q_strncpyz ( loadname , " bmodels " , sizeof ( loadname ) ) ;
2004-09-30 22:45:08 +00:00
2004-08-22 22:29:09 +00:00
for ( i = 0 ; i < loadmodel - > numtextures ; i + + )
{
tx = loadmodel - > textures [ i ] ;
if ( ! tx ) //e1m2, this happens
continue ;
2020-03-07 09:00:40 +00:00
if ( tx - > srcdata )
2009-11-04 21:16:50 +00:00
continue ;
2021-06-22 14:40:53 +00:00
Mod_FinishTexture ( loadmodel , tx , loadname , true ) ;
2004-08-22 22:29:09 +00:00
}
2014-05-10 13:42:13 +00:00
# endif
2004-08-22 22:29:09 +00:00
}
qbyte lmgamma [ 256 ] ;
void BuildLightMapGammaTable ( float g , float c )
{
int i , inf ;
// g = bound (0.1, g, 3);
// c = bound (1, c, 3);
if ( g = = 1 & & c = = 1 )
{
for ( i = 0 ; i < 256 ; i + + )
lmgamma [ i ] = i ;
return ;
}
for ( i = 0 ; i < 256 ; i + + )
{
inf = 255 * pow ( ( i + 0.5 ) / 255.5 * c , g ) + 0.5 ;
if ( inf < 0 )
inf = 0 ;
else if ( inf > 255 )
inf = 255 ;
lmgamma [ i ] = inf ;
}
}
2015-05-03 19:57:46 +00:00
typedef struct
{
unsigned int magic ; //"QLIT"
unsigned int version ; //2
unsigned int numsurfs ;
unsigned int lmsize ; //samples, not bytes (same size as vanilla lighting lump in a q1 bsp).
//uint lmoffsets[numsurfs]; //completely overrides the bsp lightmap info
//ushort lmextents[numsurfs*2]; //only to avoid precision issues. width+height pairs, actual lightmap sizes on disk (so +1).
//byte lmstyles[numsurfs*4]; //completely overrides the bsp lightmap info
//byte lmshifts[numsurfs]; //default is 4 (1<<4=16), for 1/16th lightmap-to-texel ratio
//byte litdata[lmsize*3]; //rgb data
//byte luxdata[lmsize*3]; //stn light dirs (unsigned bytes
} qlit2_t ;
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadLighting
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
void Mod_LoadLighting ( model_t * loadmodel , bspx_header_t * bspx , qbyte * mod_base , lump_t * l , qboolean interleaveddeluxe , lightmapoverrides_t * overrides , subbsp_t subbsp )
2012-02-27 12:23:15 +00:00
{
qboolean luxtmp = true ;
2018-03-04 14:41:16 +00:00
qboolean exptmp = true ;
2012-02-27 12:23:15 +00:00
qboolean littmp = true ;
2018-03-04 14:41:16 +00:00
qbyte * luxdata = NULL ; //rgb8
qbyte * expdata = NULL ; //e5bgr9 (hdr!)
qbyte * litdata = NULL ; //xyz8
qbyte * lumdata = NULL ; //l8
2012-02-27 12:23:15 +00:00
qbyte * out ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t samples ;
2020-02-11 18:06:10 +00:00
# ifdef RUNTIMELIGHTING
qboolean relighting = false ;
# endif
2012-02-27 12:23:15 +00:00
2011-10-27 16:16:29 +00:00
extern cvar_t gl_overbright ;
2023-08-12 12:17:03 +00:00
# ifdef HAVE_CLIENT
BSPX_LightGridLoad ( loadmodel , bspx , mod_base ) ;
# endif
2018-03-04 14:41:16 +00:00
loadmodel - > lightmaps . fmt = LM_L8 ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
//q3 maps have built in 4-fold overbright.
//if we're not rendering with that, we need to brighten the lightmaps in order to keep the darker parts the same brightness. we loose the 2 upper bits. those bright areas become uniform and indistinct.
if ( loadmodel - > fromgame = = fg_quake3 )
{
2016-07-12 00:40:13 +00:00
gl_overbright . flags | = CVAR_RENDERERLATCH ;
2011-10-27 16:16:29 +00:00
BuildLightMapGammaTable ( 1 , ( 1 < < ( 2 - gl_overbright . ival ) ) ) ;
}
2018-03-04 14:41:16 +00:00
else //lit file light intensity is made to match the world's light intensity.
BuildLightMapGammaTable ( 1 , 1 ) ;
2004-08-22 22:29:09 +00:00
2004-10-07 13:16:43 +00:00
loadmodel - > lightdata = NULL ;
2004-08-22 22:29:09 +00:00
loadmodel - > deluxdata = NULL ;
2012-02-27 12:23:15 +00:00
if ( loadmodel - > fromgame = = fg_halflife | | loadmodel - > fromgame = = fg_quake2 | | loadmodel - > fromgame = = fg_quake3 )
2004-10-07 13:16:43 +00:00
{
2012-02-27 12:23:15 +00:00
litdata = mod_base + l - > fileofs ;
samples = l - > filelen / 3 ;
2004-10-07 13:16:43 +00:00
}
2021-08-21 18:16:13 +00:00
else if ( subbsp = = sb_quake64 )
{
qbyte * q64l = mod_base + l - > fileofs ;
qbyte * newl ;
int i ;
samples = l - > filelen / 2 ;
litdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 3 ) ;
littmp = false ;
// q64 lightmap format: byte 0 RRRR RGGG byte 1 GGBB BBBA
for ( i = 0 , newl = litdata ; i < samples ; + + i , q64l + = 2 , newl + = 3 )
{
newl [ 0 ] = ( q64l [ 0 ] & 0xF8 ) | ( ( q64l [ 0 ] & 0xF8 ) > > 5 ) ;
newl [ 1 ] = ( ( q64l [ 0 ] & 0x07 ) < < 5 ) | ( ( q64l [ 1 ] & 0xC0 ) > > 3 ) | ( q64l [ 0 ] & 0x07 ) ;
newl [ 2 ] = ( ( q64l [ 1 ] & 0x3E ) < < 2 ) | ( ( q64l [ 1 ] & 0x3E ) > > 3 ) ;
}
}
2012-02-27 12:23:15 +00:00
else
{
lumdata = mod_base + l - > fileofs ;
samples = l - > filelen ;
}
2015-03-03 00:14:43 +00:00
if ( interleaveddeluxe )
samples > > = 1 ;
2012-02-27 12:23:15 +00:00
if ( ! samples )
2015-12-12 19:25:15 +00:00
{
2018-07-24 13:59:42 +00:00
expdata = BSPX_FindLump ( bspx , mod_base , " LIGHTING_E5BGR9 " , & samples ) ; //expressed as a big-endian packed int - 0xEBGR type thing, except misaligned and 32bit.
2018-03-04 14:41:16 +00:00
samples / = 4 ;
2015-12-12 19:25:15 +00:00
if ( ! samples )
2018-03-04 14:41:16 +00:00
{
2018-07-24 13:59:42 +00:00
litdata = BSPX_FindLump ( bspx , mod_base , " RGBLIGHTING " , & samples ) ; //RGB packed data
2018-03-04 14:41:16 +00:00
samples / = 3 ;
if ( ! samples )
return ;
}
2015-12-12 19:25:15 +00:00
}
2004-10-07 13:16:43 +00:00
2014-05-10 13:42:13 +00:00
# ifndef SERVERONLY
2019-01-13 16:51:50 +00:00
#if 0 //def Q2BSPS //Q2XP's alternative to lit files, for higher res lightmaps (that seem to have light coming from the wrong directions...)
if ( loadmodel - > fromgame = = fg_quake2 & & overrides & & ! interleaveddeluxe )
{
char litname [ MAX_QPATH ] ;
size_t litsize ;
qbyte * xplm ;
COM_StripExtension ( loadmodel - > name , litname , sizeof ( litname ) ) ;
Q_strncatz ( litname , " .xplm " , sizeof ( litname ) ) ;
xplm = FS_LoadMallocGroupFile ( & loadmodel - > memgroup , litname , & litsize ) ;
if ( litdata )
{
int scale ;
size_t numsurfs = LittleLong ( * ( int * ) & xplm [ 0 ] ) ;
unsigned int * offsets = ( unsigned int * ) ( xplm + 4 ) ;
scale = xplm [ ( numsurfs + 1 ) * 4 ] ;
for ( overrides - > defaultshift = 0 ; scale & & ! ( scale & 1 ) ; scale > > = 1 )
overrides - > defaultshift + + ;
if ( scale = = 1 )
{ //its a supported shift
litdata = xplm + ( numsurfs + 1 ) * 4 + 1 ;
samples = ( litsize - ( numsurfs + 1 ) * 4 + 1 ) / 3 ;
overrides - > offsets = offsets ;
}
}
}
# endif
2018-03-04 14:41:16 +00:00
if ( ! expdata & & ! litdata & & r_loadlits . value )
2004-08-22 22:29:09 +00:00
{
2019-01-13 16:51:50 +00:00
struct
{
char * pattern ;
} litnames [ ] = {
2022-02-07 14:34:11 +00:00
{ " %s.hdr " } ,
{ " %s.lit " } ,
# ifdef HAVE_LEGACY
{ " lits/%s.lit " } ,
# endif
2015-05-14 03:06:58 +00:00
} ;
2015-10-11 11:34:58 +00:00
char litbasep [ MAX_QPATH ] ;
2015-05-14 03:06:58 +00:00
char litbase [ MAX_QPATH ] ;
int depth ;
int bestdepth = 0x7fffffff ;
int best = - 1 ;
int i ;
char litname [ MAX_QPATH ] ;
2014-10-05 20:04:11 +00:00
size_t litsize ;
2015-05-03 19:57:46 +00:00
qboolean inhibitvalidation = false ;
2015-05-14 03:06:58 +00:00
2015-10-11 11:34:58 +00:00
COM_StripExtension ( loadmodel - > name , litbasep , sizeof ( litbasep ) ) ;
COM_FileBase ( loadmodel - > name , litbase , sizeof ( litbase ) ) ;
2019-01-13 16:51:50 +00:00
for ( i = 0 ; i < countof ( litnames ) ; i + + )
2015-05-14 03:06:58 +00:00
{
2019-01-13 16:51:50 +00:00
if ( strchr ( litnames [ i ] . pattern , ' / ' ) )
Q_snprintfz ( litname , sizeof ( litname ) , litnames [ i ] . pattern , litbase ) ;
2015-10-11 11:34:58 +00:00
else
2019-01-13 16:51:50 +00:00
Q_snprintfz ( litname , sizeof ( litname ) , litnames [ i ] . pattern , litbasep ) ;
2015-05-14 03:06:58 +00:00
depth = COM_FDepthFile ( litname , false ) ;
if ( depth < bestdepth )
{
bestdepth = depth ;
best = i ;
}
2004-08-22 22:29:09 +00:00
}
2015-05-14 03:06:58 +00:00
if ( best > = 0 )
2004-08-22 22:29:09 +00:00
{
2019-01-13 16:51:50 +00:00
if ( strchr ( litnames [ best ] . pattern , ' / ' ) )
Q_snprintfz ( litname , sizeof ( litname ) , litnames [ best ] . pattern , litbase ) ;
2015-10-11 11:34:58 +00:00
else
2019-01-13 16:51:50 +00:00
Q_snprintfz ( litname , sizeof ( litname ) , litnames [ best ] . pattern , litbasep ) ;
2020-03-25 21:29:30 +00:00
litdata = FS_LoadMallocGroupFile ( & loadmodel - > memgroup , litname , & litsize , false ) ;
2004-09-30 23:02:52 +00:00
}
else
2015-05-14 03:06:58 +00:00
{
litdata = NULL ;
litsize = 0 ;
}
2004-09-30 23:02:52 +00:00
2019-08-03 01:58:03 +00:00
if ( litdata )
2015-04-14 23:12:17 +00:00
{ //validate it, if we loaded one.
2018-03-04 14:41:16 +00:00
int litver = LittleLong ( * ( int * ) & litdata [ 4 ] ) ;
2019-08-03 01:58:03 +00:00
if ( litsize < 8 | | litdata [ 0 ] ! = ' Q ' | | litdata [ 1 ] ! = ' L ' | | litdata [ 2 ] ! = ' I ' | | litdata [ 3 ] ! = ' T ' )
2015-04-14 23:12:17 +00:00
{
2012-02-27 12:23:15 +00:00
litdata = NULL ;
2015-04-14 23:12:17 +00:00
Con_Printf ( " lit \" %s \" isn't a lit \n " , litname ) ;
}
2018-03-04 14:41:16 +00:00
else if ( litver = = 1 )
------------------------------------------------------------------------
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
{
2018-03-04 14:41:16 +00:00
if ( l - > filelen & & samples * 3 ! = ( litsize - 8 ) )
{
litdata = NULL ;
Con_Printf ( " lit \" %s \" doesn't match level. Ignored. \n " , litname ) ;
}
else
litdata + = 8 ; //header+version
------------------------------------------------------------------------
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
}
2018-03-04 14:41:16 +00:00
else if ( litver = = 0x10001 )
2019-01-13 16:51:50 +00:00
{ //hdr lighting, e5bgr9 format
2018-03-04 14:41:16 +00:00
if ( l - > filelen & & samples * 4 ! = ( litsize - 8 ) )
Con_Printf ( " lit \" %s \" doesn't match level. Ignored. \n " , litname ) ;
else
expdata = litdata + 8 ; //header+version
litdata = NULL ;
2015-05-03 19:57:46 +00:00
}
2019-08-03 01:58:03 +00:00
else if ( litver = = 2 & & overrides & & litsize > sizeof ( qlit2_t ) )
2015-05-03 19:57:46 +00:00
{
qlit2_t * ql2 = ( qlit2_t * ) litdata ;
unsigned int * offsets = ( unsigned int * ) ( ql2 + 1 ) ;
unsigned short * extents = ( unsigned short * ) ( offsets + ql2 - > numsurfs ) ;
unsigned char * styles = ( unsigned char * ) ( extents + ql2 - > numsurfs * 2 ) ;
unsigned char * shifts = ( unsigned char * ) ( styles + ql2 - > numsurfs * 4 ) ;
2022-02-07 14:34:11 +00:00
if ( loadmodel - > numsurfaces ! = ql2 - > numsurfs )
2015-05-03 19:57:46 +00:00
{
litdata = NULL ;
Con_Printf ( " lit \" %s \" doesn't match level. Ignored. \n " , litname ) ;
}
2019-08-03 01:58:03 +00:00
else if ( litsize ! = sizeof ( qlit2_t ) + ql2 - > numsurfs * 4 + ql2 - > lmsize * 6 )
{
litdata = NULL ;
Con_Printf ( " lit \" %s \" is truncated. Ignored. \n " , litname ) ;
}
2015-05-03 19:57:46 +00:00
else
{
2022-02-07 14:34:11 +00:00
Con_Printf ( " %s: lit2 support is unstandardised and may change in future. \n " , litname ) ;
2015-05-03 19:57:46 +00:00
inhibitvalidation = true ;
//surface code needs to know the overrides.
overrides - > offsets = offsets ;
overrides - > extents = extents ;
2019-09-10 15:40:04 +00:00
overrides - > styles8 = styles ;
overrides - > stylesperface = 4 ;
2015-05-03 19:57:46 +00:00
overrides - > shifts = shifts ;
//we're now using this amount of data.
samples = ql2 - > lmsize ;
litdata = shifts + ql2 - > numsurfs ;
2018-07-05 16:21:44 +00:00
if ( r_deluxemapping )
2015-05-03 19:57:46 +00:00
luxdata = litdata + samples * 3 ;
}
}
else
------------------------------------------------------------------------
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
{
2015-05-03 19:57:46 +00:00
Con_Printf ( " lit \" %s \" isn't version 1 or 2. \n " , litname ) ;
------------------------------------------------------------------------
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
litdata = NULL ;
}
2015-04-14 23:12:17 +00:00
}
2018-03-04 14:41:16 +00:00
exptmp = littmp = false ;
2019-08-03 01:58:03 +00:00
if ( ! litdata & & ! expdata )
2015-04-14 23:12:17 +00:00
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2015-05-03 19:57:46 +00:00
/*FIXME: bspx support for extents+lmscale, may require style+offset lumps too, not sure what to do here*/
2018-07-24 13:59:42 +00:00
expdata = BSPX_FindLump ( bspx , mod_base , " LIGHTING_E5BGR9 " , & size ) ;
2018-03-04 14:41:16 +00:00
exptmp = true ;
if ( size ! = samples * 4 )
{
expdata = NULL ;
2018-07-24 13:59:42 +00:00
litdata = BSPX_FindLump ( bspx , mod_base , " RGBLIGHTING " , & size ) ;
2018-03-04 14:41:16 +00:00
littmp = true ;
if ( size ! = samples * 3 )
litdata = NULL ;
}
2015-04-14 23:12:17 +00:00
}
2015-05-03 19:57:46 +00:00
else if ( ! inhibitvalidation )
2015-04-14 23:12:17 +00:00
{
2019-08-03 01:58:03 +00:00
if ( lumdata & & litdata )
2004-08-22 22:29:09 +00:00
{
float prop ;
int i ;
2012-02-27 12:23:15 +00:00
qbyte * lum ;
qbyte * lit ;
2004-08-22 22:29:09 +00:00
//now some cheat protection.
2012-02-27 12:23:15 +00:00
lum = lumdata ;
lit = litdata ;
2004-08-22 22:29:09 +00:00
2012-02-27 12:23:15 +00:00
for ( i = 0 ; i < samples ; i + + ) //force it to the same intensity. (or less, depending on how you see it...)
2004-08-22 22:29:09 +00:00
{
# define m(a, b, c) (a>(b>c?b:c)?a:(b>c?b:c))
2012-02-27 12:23:15 +00:00
prop = ( float ) m ( lit [ 0 ] , lit [ 1 ] , lit [ 2 ] ) ;
2004-08-22 22:29:09 +00:00
if ( ! prop )
{
2012-02-27 12:23:15 +00:00
lit [ 0 ] = * lum ;
lit [ 1 ] = * lum ;
lit [ 2 ] = * lum ;
2004-08-22 22:29:09 +00:00
}
else
{
2012-02-27 12:23:15 +00:00
prop = * lum / prop ;
lit [ 0 ] * = prop ;
lit [ 1 ] * = prop ;
lit [ 2 ] * = prop ;
2004-08-22 22:29:09 +00:00
}
2012-02-27 12:23:15 +00:00
lum + + ;
lit + = 3 ;
2004-08-22 22:29:09 +00:00
}
//end anti-cheat
}
}
}
2015-05-03 19:57:46 +00:00
2018-07-05 16:21:44 +00:00
if ( ! luxdata & & r_loadlits . ival & & r_deluxemapping )
2015-05-03 19:57:46 +00:00
{ //the map util has a '-scalecos X' parameter. use 0 if you're going to use only just lux. without lux scalecos 0 is hideous.
char luxname [ MAX_QPATH ] ;
size_t luxsz = 0 ;
* luxname = 0 ;
if ( ! luxdata )
{
Q_strncpyz ( luxname , loadmodel - > name , sizeof ( luxname ) ) ;
COM_StripExtension ( loadmodel - > name , luxname , sizeof ( luxname ) ) ;
COM_DefaultExtension ( luxname , " .lux " , sizeof ( luxname ) ) ;
2020-03-25 21:29:30 +00:00
luxdata = FS_LoadMallocGroupFile ( & loadmodel - > memgroup , luxname , & luxsz , false ) ;
2015-05-03 19:57:46 +00:00
luxtmp = false ;
}
if ( ! luxdata )
{
Q_strncpyz ( luxname , " luxs/ " , sizeof ( luxname ) ) ;
COM_StripExtension ( COM_SkipPath ( loadmodel - > name ) , luxname + 5 , sizeof ( luxname ) - 5 ) ;
Q_strncatz ( luxname , " .lux " , sizeof ( luxname ) ) ;
2020-03-25 21:29:30 +00:00
luxdata = FS_LoadMallocGroupFile ( & loadmodel - > memgroup , luxname , & luxsz , false ) ;
2015-05-03 19:57:46 +00:00
luxtmp = false ;
}
if ( ! luxdata ) //dp...
{
COM_StripExtension ( loadmodel - > name , luxname , sizeof ( luxname ) ) ;
COM_DefaultExtension ( luxname , " .dlit " , sizeof ( luxname ) ) ;
2020-03-25 21:29:30 +00:00
luxdata = FS_LoadMallocGroupFile ( & loadmodel - > memgroup , luxname , & luxsz , false ) ;
2015-05-03 19:57:46 +00:00
luxtmp = false ;
}
//make sure the .lux has the correct size
if ( luxdata & & l - > filelen & & l - > filelen ! = ( luxsz - 8 ) / 3 )
{
Con_Printf ( " deluxmap \" %s \" doesn't match level. Ignored. \n " , luxname ) ;
luxdata = NULL ;
}
if ( ! luxdata )
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2018-07-24 13:59:42 +00:00
luxdata = BSPX_FindLump ( bspx , mod_base , " LIGHTINGDIR " , & size ) ;
2015-05-03 19:57:46 +00:00
if ( size ! = samples * 3 )
luxdata = NULL ;
luxtmp = true ;
}
else
{
2019-08-03 01:58:03 +00:00
if ( luxsz < 8 | | ( luxdata [ 0 ] = = ' Q ' & & luxdata [ 1 ] = = ' L ' & & luxdata [ 2 ] = = ' I ' & & luxdata [ 3 ] = = ' T ' ) )
2015-05-03 19:57:46 +00:00
{
if ( LittleLong ( * ( int * ) & luxdata [ 4 ] ) = = 1 )
luxdata + = 8 ;
else
{
Con_Printf ( " \" %s \" isn't a version 1 deluxmap \n " , luxname ) ;
luxdata = NULL ;
}
}
else
{
Con_Printf ( " lit \" %s \" isn't a deluxmap \n " , luxname ) ;
luxdata = NULL ;
}
}
}
2014-05-10 13:42:13 +00:00
# endif
2004-08-22 22:29:09 +00:00
# ifdef RUNTIMELIGHTING
2018-11-19 06:37:25 +00:00
if ( ( loadmodel - > type = = mod_brush & & loadmodel - > fromgame = = fg_quake ) | | loadmodel - > type = = mod_heightmap )
{ //we only support a couple of formats. :(
2020-02-11 18:06:10 +00:00
if ( r_loadlits . value > = 2 & & ( ( ! litdata & & ! expdata ) | | ( ! luxdata & & r_deluxemapping ) ) )
2018-11-19 06:37:25 +00:00
{
2020-02-11 18:06:10 +00:00
relighting = RelightSetup ( loadmodel , l - > filelen , ! litdata & & ! expdata ) ;
2018-11-19 06:37:25 +00:00
}
2020-02-11 18:06:10 +00:00
else if ( r_deluxemapping_cvar . value > 1 & & r_deluxemapping & & ! luxdata
2017-03-26 01:46:08 +00:00
# ifdef RTLIGHTS
2018-11-19 06:37:25 +00:00
& & ! ( r_shadow_realtime_world . ival & & r_shadow_realtime_world_lightmaps . value < = 0 )
2017-03-26 01:46:08 +00:00
# endif
2018-11-19 06:37:25 +00:00
)
{ //if deluxemapping is on, generate missing lux files a little more often, but don't bother if we have rtlights on anyway.
2020-02-11 18:06:10 +00:00
relighting = RelightSetup ( loadmodel , l - > filelen , false ) ;
2018-11-19 06:37:25 +00:00
}
2004-08-22 22:29:09 +00:00
}
2012-02-27 12:23:15 +00:00
/*if we're relighting, make sure there's the proper lit data to be updated*/
2020-02-11 18:06:10 +00:00
if ( relighting & & ! litdata & & ! expdata )
2005-05-18 01:40:01 +00:00
{
2012-02-27 12:23:15 +00:00
int i ;
2019-08-03 01:58:03 +00:00
unsigned int * ergb ;
if ( r_loadlits . ival > = 3 )
{
ergb = ZG_Malloc ( & loadmodel - > memgroup , samples * 4 ) ;
expdata = ( qbyte * ) ergb ;
littmp = false ;
if ( lumdata )
{
for ( i = 0 ; i < samples ; i + + )
2021-08-09 23:06:23 +00:00
ergb [ i ] = ( 17u < < 27 ) | ( lumdata [ i ] < < 18 ) | ( lumdata [ i ] < < 9 ) | ( lumdata [ i ] < < 0 ) ;
2019-08-03 01:58:03 +00:00
lumdata = NULL ;
}
}
else
2005-05-18 01:40:01 +00:00
{
2019-08-03 01:58:03 +00:00
litdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 3 ) ;
littmp = false ;
if ( lumdata )
2012-02-27 12:23:15 +00:00
{
2019-08-03 01:58:03 +00:00
for ( i = 0 ; i < samples ; i + + )
{
litdata [ i * 3 + 0 ] = lumdata [ i ] ;
litdata [ i * 3 + 1 ] = lumdata [ i ] ;
litdata [ i * 3 + 2 ] = lumdata [ i ] ;
}
lumdata = NULL ;
2012-02-27 12:23:15 +00:00
}
2005-05-18 01:40:01 +00:00
}
}
2012-02-27 12:23:15 +00:00
/*if we're relighting, make sure there's the proper lux data to be updated*/
2020-02-11 18:06:10 +00:00
if ( relighting & & r_deluxemapping & & ! luxdata )
2004-08-22 22:29:09 +00:00
{
int i ;
2013-07-14 12:22:51 +00:00
luxdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 3 ) ;
2012-02-27 12:23:15 +00:00
for ( i = 0 ; i < samples ; i + + )
2004-08-22 22:29:09 +00:00
{
2012-11-27 03:23:19 +00:00
luxdata [ i * 3 + 0 ] = 0.5f * 255 ;
luxdata [ i * 3 + 1 ] = 0.5f * 255 ;
luxdata [ i * 3 + 2 ] = 255 ;
2004-08-22 22:29:09 +00:00
}
2012-02-27 12:23:15 +00:00
}
# endif
2015-11-18 07:37:39 +00:00
2015-12-12 19:25:15 +00:00
if ( overrides & & ! overrides - > shifts )
2015-11-18 07:37:39 +00:00
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2015-11-18 07:37:39 +00:00
//if we have shifts, then we probably also have legacy data in the surfaces that we want to override
if ( ! overrides - > offsets )
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2018-07-24 13:59:42 +00:00
overrides - > offsets = BSPX_FindLump ( bspx , mod_base , " LMOFFSET " , & size ) ;
2015-11-18 07:37:39 +00:00
if ( size ! = loadmodel - > numsurfaces * sizeof ( int ) )
2021-11-14 00:35:13 +00:00
{
if ( size )
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Con_Printf ( CON_ERROR " BSPX LMOFFSET lump is wrong size, expected %u entries, found % " PRIuSIZE " \n " , loadmodel - > numsurfaces , size / ( unsigned int ) sizeof ( int ) ) ;
2015-11-18 07:37:39 +00:00
overrides - > offsets = NULL ;
2021-11-14 00:35:13 +00:00
}
2015-11-18 07:37:39 +00:00
}
2019-09-10 15:40:04 +00:00
if ( ! overrides - > styles8 & & ! overrides - > styles16 )
{ //16bit per-face lightmap styles index
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2019-09-10 15:40:04 +00:00
overrides - > styles16 = BSPX_FindLump ( bspx , mod_base , " LMSTYLE16 " , & size ) ;
overrides - > stylesperface = size / ( sizeof ( * overrides - > styles16 ) * loadmodel - > numsurfaces ) ; //rounding issues will be caught on the next line...
if ( ! overrides - > stylesperface | | size ! = loadmodel - > numsurfaces * sizeof ( * overrides - > styles16 ) * overrides - > stylesperface )
2021-11-14 00:35:13 +00:00
{
if ( size )
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Con_Printf ( CON_ERROR " BSPX LMSTYLE16 lump is wrong size, expected %u*%u entries, found % " PRIuSIZE " \n " , loadmodel - > numsurfaces , overrides - > stylesperface , size / ( unsigned int ) sizeof ( * overrides - > styles16 ) ) ;
2019-09-10 15:40:04 +00:00
overrides - > styles16 = NULL ;
2021-11-14 00:35:13 +00:00
}
2020-03-25 21:29:30 +00:00
else if ( overrides - > stylesperface > MAXCPULIGHTMAPS )
Con_Printf ( CON_WARNING " LMSTYLE16 lump provides %i styles, only the first %i will be used. \n " , overrides - > stylesperface , MAXCPULIGHTMAPS ) ;
2019-09-10 15:40:04 +00:00
}
if ( ! overrides - > styles8 & & ! overrides - > styles16 )
{ //16bit per-face lightmap styles index
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2019-09-10 15:40:04 +00:00
overrides - > styles8 = BSPX_FindLump ( bspx , mod_base , " LMSTYLE " , & size ) ;
overrides - > stylesperface = size / ( sizeof ( * overrides - > styles8 ) * loadmodel - > numsurfaces ) ; //rounding issues will be caught on the next line...
if ( ! overrides - > stylesperface | | size ! = loadmodel - > numsurfaces * sizeof ( * overrides - > styles8 ) * overrides - > stylesperface )
2021-11-14 00:35:13 +00:00
{
if ( size )
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Con_Printf ( CON_ERROR " BSPX LMSTYLE16 lump is wrong size, expected %u*%u entries, found % " PRIuSIZE " \n " , loadmodel - > numsurfaces , overrides - > stylesperface , size / ( unsigned int ) sizeof ( * overrides - > styles8 ) ) ;
2019-09-10 15:40:04 +00:00
overrides - > styles8 = NULL ;
2021-11-14 00:35:13 +00:00
}
2020-03-25 21:29:30 +00:00
else if ( overrides - > stylesperface > MAXCPULIGHTMAPS )
Con_Printf ( CON_WARNING " LMSTYLE lump provides %i styles, only the first %i will be used. \n " , overrides - > stylesperface , MAXCPULIGHTMAPS ) ;
2015-11-18 07:37:39 +00:00
}
2021-11-14 00:35:13 +00:00
overrides - > shifts = BSPX_FindLump ( bspx , mod_base , " LMSHIFT " , & size ) ;
if ( size ! = loadmodel - > numsurfaces )
{
if ( size )
{ //ericw-tools is screwing up again. don't leave things screwed.
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Con_Printf ( CON_ERROR " BSPX LMSHIFT lump is wrong size, expected %u entries, found % " PRIuSIZE " \n " , loadmodel - > numsurfaces , size ) ;
2021-11-14 00:35:13 +00:00
overrides - > styles16 = NULL ;
overrides - > styles8 = NULL ;
overrides - > offsets = NULL ;
}
overrides - > shifts = NULL ;
}
2015-11-18 07:37:39 +00:00
}
2018-03-04 14:41:16 +00:00
2012-02-27 12:23:15 +00:00
if ( luxdata & & luxtmp )
{
2013-07-14 12:22:51 +00:00
loadmodel - > deluxdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 3 ) ;
2012-02-27 12:23:15 +00:00
memcpy ( loadmodel - > deluxdata , luxdata , samples * 3 ) ;
}
else if ( luxdata )
loadmodel - > deluxdata = luxdata ;
2015-03-03 00:14:43 +00:00
else if ( interleaveddeluxe )
loadmodel - > deluxdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 3 ) ;
2012-02-27 12:23:15 +00:00
2018-03-04 14:41:16 +00:00
if ( expdata )
2012-02-27 12:23:15 +00:00
{
2018-03-04 14:41:16 +00:00
loadmodel - > lightmaps . fmt = LM_E5BGR9 ;
loadmodel - > lightdatasize = samples * 4 ;
if ( exptmp )
{
loadmodel - > lightdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 4 ) ;
memcpy ( loadmodel - > lightdata , expdata , samples * 4 ) ;
}
else
loadmodel - > lightdata = expdata ;
2019-01-13 16:51:50 +00:00
//FIXME: no desaturation/gamma logic.
2018-03-04 14:41:16 +00:00
return ;
2012-02-27 12:23:15 +00:00
}
else if ( litdata )
{
2018-03-04 14:41:16 +00:00
loadmodel - > lightmaps . fmt = LM_RGB8 ;
if ( littmp )
loadmodel - > lightdata = ZG_Malloc ( & loadmodel - > memgroup , samples * 3 ) ; /*the memcpy is below*/
else
loadmodel - > lightdata = litdata ;
2012-02-27 12:23:15 +00:00
samples * = 3 ;
}
else if ( lumdata )
{
2018-03-04 14:41:16 +00:00
loadmodel - > lightmaps . fmt = LM_L8 ;
2013-07-14 12:22:51 +00:00
loadmodel - > lightdata = ZG_Malloc ( & loadmodel - > memgroup , samples ) ;
2012-02-27 12:23:15 +00:00
litdata = lumdata ;
}
2005-05-18 01:40:01 +00:00
2012-02-27 12:23:15 +00:00
/*apply lightmap gamma to the entire lightmap*/
2015-05-03 19:57:46 +00:00
loadmodel - > lightdatasize = samples ;
2012-02-27 12:23:15 +00:00
out = loadmodel - > lightdata ;
2015-03-03 00:14:43 +00:00
if ( interleaveddeluxe )
2012-02-27 12:23:15 +00:00
{
2015-03-03 00:14:43 +00:00
qbyte * luxout = loadmodel - > deluxdata ;
samples / = 3 ;
while ( samples - - > 0 )
{
* out + + = lmgamma [ * litdata + + ] ;
* out + + = lmgamma [ * litdata + + ] ;
* out + + = lmgamma [ * litdata + + ] ;
* luxout + + = * litdata + + ;
* luxout + + = * litdata + + ;
* luxout + + = * litdata + + ;
}
}
else
{
while ( samples - - > 0 )
{
* out + + = lmgamma [ * litdata + + ] ;
}
2004-08-22 22:29:09 +00:00
}
2012-02-27 12:23:15 +00:00
2014-05-10 13:42:13 +00:00
# ifndef SERVERONLY
2018-03-04 14:41:16 +00:00
if ( ( loadmodel - > lightmaps . fmt = = LM_RGB8 ) & & r_lightmap_saturation . value ! = 1.0f )
2012-02-27 12:23:15 +00:00
SaturateR8G8B8 ( loadmodel - > lightdata , l - > filelen , r_lightmap_saturation . value ) ;
2014-05-10 13:42:13 +00:00
# endif
2004-08-22 22:29:09 +00:00
}
2016-10-22 07:06:51 +00:00
//scans through the worldspawn for a single specific key.
2016-11-25 08:14:54 +00:00
const char * Mod_ParseWorldspawnKey ( model_t * mod , const char * key , char * buffer , size_t sizeofbuffer )
2015-03-03 00:14:43 +00:00
{
char keyname [ 64 ] ;
char value [ 1024 ] ;
2016-11-25 08:14:54 +00:00
const char * ents = Mod_GetEntitiesString ( mod ) ;
2015-04-14 23:12:17 +00:00
while ( ents & & * ents )
2015-03-03 00:14:43 +00:00
{
2015-03-08 12:11:02 +00:00
ents = COM_ParseOut ( ents , keyname , sizeof ( keyname ) ) ;
if ( * keyname = = ' { ' ) //an entity
2015-03-03 00:14:43 +00:00
{
while ( ents & & * ents )
{
ents = COM_ParseOut ( ents , keyname , sizeof ( keyname ) ) ;
if ( * keyname = = ' } ' )
break ;
ents = COM_ParseOut ( ents , value , sizeof ( value ) ) ;
if ( ! strcmp ( keyname , key ) | | ( * keyname = = ' _ ' & & ! strcmp ( keyname + 1 , key ) ) )
{
Q_strncpyz ( buffer , value , sizeofbuffer ) ;
return buffer ;
}
}
return " " ; //worldspawn only.
}
}
return " " ; //err...
}
2004-08-22 22:29:09 +00:00
2018-12-10 15:02:55 +00:00
static void Mod_ShowEnt_f ( void )
{
model_t * mod = NULL ;
size_t idx = atoi ( Cmd_Argv ( 1 ) ) ;
char * n = Cmd_Argv ( 2 ) ;
if ( * n )
mod = Mod_ForName ( n , MLV_WARN ) ;
# ifndef CLIENTONLY
if ( sv . state & & ! mod )
mod = sv . world . worldmodel ;
# endif
# ifndef SERVERONLY
if ( cls . state & & ! mod )
mod = cl . worldmodel ;
# endif
if ( mod & & mod - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( mod , & mod - > loadstate , MLS_LOADING ) ;
if ( ! mod | | mod - > loadstate ! = MLS_LOADED )
{
Con_Printf ( " Map not loaded \n " ) ;
return ;
}
if ( ! mod - > numentityinfo )
Mod_ParseEntities ( mod ) ;
if ( ! idx & & strcmp ( Cmd_Argv ( 1 ) , " 0 " ) )
{
char * match = Cmd_Argv ( 1 ) ;
unsigned count = 0 ;
for ( idx = 0 ; idx < mod - > numentityinfo ; idx + + )
{
if ( strstr ( mod - > entityinfo [ idx ] . keyvals , match ) )
{
Con_Printf ( " { \t //%u \n %s \n } \n " , ( unsigned ) idx , mod - > entityinfo [ idx ] . keyvals ) ;
count + + ;
}
}
Con_Printf ( " %u of %u ents match \n " , ( unsigned ) count , ( unsigned ) mod - > numentityinfo ) ;
}
else if ( idx > = mod - > numentityinfo )
Con_Printf ( " Invalid entity index (max %u). \n " , ( unsigned ) mod - > numentityinfo ) ;
else if ( ! mod - > entityinfo [ idx ] . keyvals )
Con_Printf ( " Entity index was cleared... \n " ) ;
else
Con_Printf ( " { \n %s \n } \n " , mod - > entityinfo [ idx ] . keyvals ) ;
}
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
static void Mod_SaveEntFile_f ( void )
{
char fname [ MAX_QPATH ] ;
2019-07-29 05:28:20 +00:00
char nname [ MAX_OSPATH ] ;
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
model_t * mod = NULL ;
char * n = Cmd_Argv ( 1 ) ;
2016-11-25 08:14:54 +00:00
const char * ents ;
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 ( * n )
mod = Mod_ForName ( n , MLV_WARN ) ;
# ifndef CLIENTONLY
if ( sv . state & & ! mod )
mod = sv . world . worldmodel ;
# endif
# ifndef SERVERONLY
if ( cls . state & & ! mod )
mod = cl . worldmodel ;
# endif
if ( mod & & mod - > loadstate = = MLS_LOADING )
COM_WorkerPartialSync ( mod , & mod - > loadstate , MLS_LOADING ) ;
if ( ! mod | | mod - > loadstate ! = MLS_LOADED )
{
Con_Printf ( " Map not loaded \n " ) ;
return ;
}
2016-11-25 08:14:54 +00:00
ents = Mod_GetEntitiesString ( mod ) ;
if ( ! ents )
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
{
Con_Printf ( " Map is not a map, and has no entities \n " ) ;
return ;
}
if ( * mod_loadentfiles_dir . string & & ! strncmp ( mod - > name , " maps/ " , 5 ) )
{
Q_snprintfz ( fname , sizeof ( fname ) , " maps/%s/%s " , mod_loadentfiles_dir . string , mod - > name + 5 ) ;
COM_StripExtension ( fname , fname , sizeof ( fname ) ) ;
2023-02-20 05:50:50 +00:00
Q_strncatz ( fname , mod_modifier , sizeof ( fname ) ) ;
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
Q_strncatz ( fname , " .ent " , sizeof ( fname ) ) ;
}
else
{
COM_StripExtension ( mod - > name , fname , sizeof ( fname ) ) ;
2023-02-20 05:50:50 +00:00
Q_strncatz ( fname , mod_modifier , sizeof ( fname ) ) ;
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
Q_strncatz ( fname , " .ent " , sizeof ( fname ) ) ;
}
2019-11-04 17:24:11 +00:00
if ( COM_WriteFile ( fname , FS_GAMEONLY , ents , strlen ( ents ) ) )
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( FS_DisplayPath ( fname , FS_GAMEONLY , nname , sizeof ( nname ) ) )
2019-11-04 17:24:11 +00:00
Con_Printf ( " Wrote %s \n " , nname ) ;
}
else
Con_Printf ( " Write failed \n " ) ;
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
}
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadEntities
= = = = = = = = = = = = = = = = =
*/
2021-11-03 20:30:40 +00:00
qboolean Mod_LoadEntitiesBlob ( struct model_s * mod , const char * entdata , size_t entdatasize )
2004-08-22 22:29:09 +00:00
{
2014-10-05 20:04:11 +00:00
char fname [ MAX_QPATH ] ;
size_t sz ;
2016-10-22 07:06:51 +00:00
char keyname [ 64 ] ;
char value [ 1024 ] ;
2016-11-25 08:14:54 +00:00
char * ents = NULL , * k ;
2016-10-22 07:06:51 +00:00
int t ;
2021-11-03 20:30:40 +00:00
Mod_SetEntitiesString ( mod , NULL , false ) ;
if ( ! entdatasize )
return false ;
2014-10-05 20:04:11 +00:00
2016-11-25 08:14:54 +00:00
if ( mod_loadentfiles . value & & ! ents & & * mod_loadentfiles_dir . string )
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
{
2021-11-03 20:30:40 +00:00
if ( ! strncmp ( mod - > name , " maps/ " , 5 ) )
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
{
2021-11-03 20:30:40 +00:00
Q_snprintfz ( fname , sizeof ( fname ) , " maps/%s/%s " , mod_loadentfiles_dir . string , mod - > name + 5 ) ;
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
COM_StripExtension ( fname , fname , sizeof ( fname ) ) ;
2023-02-20 05:50:50 +00:00
Q_strncatz ( fname , mod_modifier , sizeof ( fname ) ) ;
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
Q_strncatz ( fname , " .ent " , sizeof ( fname ) ) ;
2016-11-25 08:14:54 +00:00
ents = FS_LoadMallocFile ( fname , & sz ) ;
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
}
}
2016-11-25 08:14:54 +00:00
if ( mod_loadentfiles . value & & ! ents )
2014-10-05 20:04:11 +00:00
{
2021-11-03 20:30:40 +00:00
COM_StripExtension ( mod - > name , fname , sizeof ( fname ) ) ;
2023-02-20 05:50:50 +00:00
Q_strncatz ( fname , mod_modifier , sizeof ( fname ) ) ;
2014-10-05 20:04:11 +00:00
Q_strncatz ( fname , " .ent " , sizeof ( fname ) ) ;
2016-11-25 08:14:54 +00:00
ents = FS_LoadMallocFile ( fname , & sz ) ;
2014-10-05 20:04:11 +00:00
}
2016-11-25 08:14:54 +00:00
if ( mod_loadentfiles . value & & ! ents )
2014-10-05 20:04:11 +00:00
{ //tenebrae compat
2021-11-03 20:30:40 +00:00
COM_StripExtension ( mod - > name , fname , sizeof ( fname ) ) ;
2023-02-20 05:50:50 +00:00
Q_strncatz ( fname , mod_modifier , sizeof ( fname ) ) ;
2014-10-05 20:04:11 +00:00
Q_strncatz ( fname , " .edo " , sizeof ( fname ) ) ;
2016-11-25 08:14:54 +00:00
ents = FS_LoadMallocFile ( fname , & sz ) ;
2014-10-05 20:04:11 +00:00
}
2016-11-25 08:14:54 +00:00
if ( ! ents )
2014-10-05 20:04:11 +00:00
{
2021-11-03 20:30:40 +00:00
ents = Z_Malloc ( entdatasize + 1 ) ;
memcpy ( ents , entdata , entdatasize ) ;
ents [ entdatasize ] = 0 ;
mod - > entitiescrc = 0 ;
2004-08-22 22:29:09 +00:00
}
2014-10-05 20:04:11 +00:00
else
2021-11-03 20:30:40 +00:00
mod - > entitiescrc = CalcHashInt ( & hash_crc16 , ents , strlen ( ents ) ) ;
2016-11-25 08:14:54 +00:00
2021-11-03 20:30:40 +00:00
Mod_SetEntitiesString ( mod , ents , false ) ;
2016-10-22 07:06:51 +00:00
while ( ents & & * ents )
{
ents = COM_ParseOut ( ents , keyname , sizeof ( keyname ) ) ;
if ( * keyname = = ' { ' ) //an entity
{
while ( ents & & * ents )
{
ents = COM_ParseOut ( ents , keyname , sizeof ( keyname ) ) ;
if ( * keyname = = ' } ' )
break ;
ents = COM_ParseOut ( ents , value , sizeof ( value ) ) ;
if ( ! strncmp ( keyname , " _texpart_ " , 9 ) | | ! strncmp ( keyname , " texpart_ " , 8 ) )
{
k = keyname + ( ( * keyname = = ' _ ' ) ? 9 : 8 ) ;
2021-11-03 20:30:40 +00:00
for ( t = 0 ; t < mod - > numtextures ; t + + )
2016-10-22 07:06:51 +00:00
{
2021-11-03 20:30:40 +00:00
if ( ! strcmp ( k , mod - > textures [ t ] - > name ) )
2016-10-22 07:06:51 +00:00
{
2021-11-03 20:30:40 +00:00
mod - > textures [ t ] - > partname = ZG_Malloc ( & mod - > memgroup , strlen ( value ) + 1 ) ;
strcpy ( mod - > textures [ t ] - > partname , value ) ;
2016-10-22 07:06:51 +00:00
break ;
}
}
2021-11-03 20:30:40 +00:00
if ( t = = mod - > numtextures )
Con_Printf ( " \" %s \" is not valid for %s \n " , keyname , mod - > name ) ;
2016-10-22 07:06:51 +00:00
}
}
}
}
2021-11-03 20:30:40 +00:00
return true ;
}
void Mod_LoadEntities ( model_t * loadmodel , qbyte * mod_base , lump_t * l )
{
Mod_LoadEntitiesBlob ( loadmodel , mod_base + l - > fileofs , l - > filelen ) ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadVertexes
= = = = = = = = = = = = = = = = =
*/
2014-10-05 20:04:11 +00:00
qboolean Mod_LoadVertexes ( model_t * loadmodel , qbyte * mod_base , lump_t * l )
2004-08-22 22:29:09 +00:00
{
dvertex_t * in ;
mvertex_t * out ;
int i , count ;
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2006-03-12 22:01:49 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
2006-03-12 22:01:49 +00:00
return false ;
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
loadmodel - > vertexes = out ;
loadmodel - > numvertexes = count ;
for ( i = 0 ; i < count ; i + + , in + + , out + + )
{
out - > position [ 0 ] = LittleFloat ( in - > point [ 0 ] ) ;
out - > position [ 1 ] = LittleFloat ( in - > point [ 1 ] ) ;
out - > position [ 2 ] = LittleFloat ( in - > point [ 2 ] ) ;
}
2006-03-12 22:01:49 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
2018-07-24 13:59:42 +00:00
qboolean Mod_LoadVertexNormals ( model_t * loadmodel , bspx_header_t * bspx , qbyte * mod_base , lump_t * l )
2015-03-03 00:14:43 +00:00
{
float * in ;
float * out ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t i , count ;
2015-03-03 00:14:43 +00:00
2018-04-27 16:40:50 +00:00
if ( l )
2015-03-03 00:14:43 +00:00
{
2018-04-27 16:40:50 +00:00
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( vec3_t ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( vec3_t ) )
2018-04-27 16:40:50 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
2023-07-12 17:05:21 +00:00
if ( count ! = loadmodel - > numvertexes )
return false ; //invalid number of verts there, can't use this.
2018-04-27 16:40:50 +00:00
}
else
2023-07-12 17:05:21 +00:00
{ //ericw's thing
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t size ;
2023-07-12 17:05:21 +00:00
quint32_t t ;
int * normcount ;
struct surfedgenormals_s * sen ;
normcount = BSPX_FindLump ( bspx , mod_base , " FACENORMALS " , & size ) ;
if ( normcount & & size > = sizeof ( * normcount ) )
{
count = LittleLong ( * normcount ) ;
if ( count < 1 )
return false ;
in = ( void * ) ( normcount + 1 ) ; //now the normals table.
sen = ( void * ) ( in + count * 3 ) ;
if ( ( qbyte * ) ( sen + loadmodel - > numsurfedges ) - ( qbyte * ) normcount ! = size )
return false ; //bad size.
loadmodel - > surfedgenormals = ZG_Malloc ( & loadmodel - > memgroup , loadmodel - > numsurfedges * sizeof ( * loadmodel - > surfedgenormals ) ) ;
for ( i = 0 ; i < loadmodel - > numsurfedges ; i + + , sen + + )
{
t = LittleLong ( sen - > n ) ; loadmodel - > surfedgenormals [ i ] . n = bound ( 0 , t , count - 1 ) ;
t = LittleLong ( sen - > s ) ; loadmodel - > surfedgenormals [ i ] . s = bound ( 0 , t , count - 1 ) ;
t = LittleLong ( sen - > t ) ; loadmodel - > surfedgenormals [ i ] . t = bound ( 0 , t , count - 1 ) ;
}
}
2018-04-27 16:40:50 +00:00
else
2023-07-12 17:05:21 +00:00
{
//quake2world's thing
in = BSPX_FindLump ( bspx , mod_base , " VERTEXNORMALS " , & count ) ;
if ( in )
count / = sizeof ( vec3_t ) ;
else
count = 0 ;
if ( count ! = loadmodel - > numvertexes )
return false ; //invalid number of verts there, can't use this.
}
2015-03-03 00:14:43 +00:00
}
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( vec3_t ) ) ;
loadmodel - > normals = ( vec3_t * ) out ;
for ( i = 0 ; i < count ; i + + , in + = 3 , out + = 3 )
{
out [ 0 ] = LittleFloat ( in [ 0 ] ) ;
out [ 1 ] = LittleFloat ( in [ 1 ] ) ;
out [ 2 ] = LittleFloat ( in [ 2 ] ) ;
}
return true ;
}
2017-02-19 00:15:42 +00:00
# if defined(Q1BSPS) || defined(Q2BSPS)
void ModQ1_Batches_BuildQ1Q2Poly ( model_t * mod , msurface_t * surf , builddata_t * cookie )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
unsigned int vertidx ;
int i , lindex , edgevert ;
mesh_t * mesh = surf - > mesh ;
float * vec ;
float s , t , d ;
int sty ;
// int w,h;
2023-08-01 11:08:51 +00:00
struct facelmvecs_s * flmv = mod - > facelmvecs ? mod - > facelmvecs + ( surf - mod - > surfaces ) : NULL ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
if ( ! mesh )
{
mesh = surf - > mesh = ZG_Malloc ( & mod - > memgroup , sizeof ( mesh_t ) + ( sizeof ( vecV_t ) + sizeof ( vec2_t ) * ( 1 + 1 ) + sizeof ( vec3_t ) * 3 + sizeof ( vec4_t ) * 1 ) * surf - > numedges + sizeof ( index_t ) * ( surf - > numedges - 2 ) * 3 ) ;
mesh - > numvertexes = surf - > numedges ;
mesh - > numindexes = ( mesh - > numvertexes - 2 ) * 3 ;
mesh - > xyz_array = ( vecV_t * ) ( mesh + 1 ) ;
mesh - > st_array = ( vec2_t * ) ( mesh - > xyz_array + mesh - > numvertexes ) ;
mesh - > lmst_array [ 0 ] = ( vec2_t * ) ( mesh - > st_array + mesh - > numvertexes ) ;
mesh - > normals_array = ( vec3_t * ) ( mesh - > lmst_array [ 0 ] + mesh - > numvertexes ) ;
mesh - > snormals_array = ( vec3_t * ) ( mesh - > normals_array + mesh - > numvertexes ) ;
mesh - > tnormals_array = ( vec3_t * ) ( mesh - > snormals_array + mesh - > numvertexes ) ;
mesh - > colors4f_array [ 0 ] = ( vec4_t * ) ( mesh - > tnormals_array + mesh - > numvertexes ) ;
mesh - > indexes = ( index_t * ) ( mesh - > colors4f_array [ 0 ] + mesh - > numvertexes ) ;
}
mesh - > istrifan = true ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
//output the mesh's indicies
for ( i = 0 ; i < mesh - > numvertexes - 2 ; i + + )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
mesh - > indexes [ i * 3 ] = 0 ;
mesh - > indexes [ i * 3 + 1 ] = i + 1 ;
mesh - > indexes [ i * 3 + 2 ] = i + 2 ;
}
//output the renderable verticies
for ( i = 0 ; i < mesh - > numvertexes ; i + + )
{
lindex = mod - > surfedges [ surf - > firstedge + i ] ;
edgevert = lindex < = 0 ;
if ( edgevert )
lindex = - lindex ;
if ( lindex < 0 | | lindex > = mod - > numedges )
vertidx = 0 ;
else
vertidx = mod - > edges [ lindex ] . v [ edgevert ] ;
vec = mod - > vertexes [ vertidx ] . position ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
s = DotProduct ( vec , surf - > texinfo - > vecs [ 0 ] ) + surf - > texinfo - > vecs [ 0 ] [ 3 ] ;
t = DotProduct ( vec , surf - > texinfo - > vecs [ 1 ] ) + surf - > texinfo - > vecs [ 1 ] [ 3 ] ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
VectorCopy ( vec , mesh - > xyz_array [ i ] ) ;
/* if (R_GetShaderSizes(surf->texinfo->texture->shader, &w, &h, false) > 0)
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
mesh - > st_array [ i ] [ 0 ] = s / w ;
mesh - > st_array [ i ] [ 1 ] = t / h ;
2004-08-22 22:29:09 +00:00
}
2017-02-19 00:15:42 +00:00
else
*/
2006-03-12 22:01:49 +00:00
{
2017-02-19 00:15:42 +00:00
mesh - > st_array [ i ] [ 0 ] = s ;
mesh - > st_array [ i ] [ 1 ] = t ;
2020-03-07 09:00:40 +00:00
if ( surf - > texinfo - > texture - > vwidth )
mesh - > st_array [ i ] [ 0 ] / = surf - > texinfo - > texture - > vwidth ;
if ( surf - > texinfo - > texture - > vheight )
mesh - > st_array [ i ] [ 1 ] / = surf - > texinfo - > texture - > vheight ;
2023-09-02 05:42:06 +00:00
if ( surf - > texinfo - > flags & TI_N64_UV )
{
mesh - > st_array [ i ] [ 0 ] / = 2 ;
mesh - > st_array [ i ] [ 1 ] / = 2 ;
}
2006-03-12 22:01:49 +00:00
}
2004-08-22 22:29:09 +00:00
2023-08-01 11:08:51 +00:00
if ( flmv )
2004-08-22 22:29:09 +00:00
{
2023-08-01 11:08:51 +00:00
s = DotProduct ( vec , flmv - > lmvecs [ 0 ] ) + flmv - > lmvecs [ 0 ] [ 3 ] ;
t = DotProduct ( vec , flmv - > lmvecs [ 1 ] ) + flmv - > lmvecs [ 1 ] [ 3 ] ;
# ifndef SERVERONLY
if ( r_lightmap_average . ival )
s = surf - > extents [ 0 ] * 0.5 , t = surf - > extents [ 1 ] * 0.5 ;
# endif
//s+t are now in luxels... need to convert those to normalised texcoords though.
2017-02-19 00:15:42 +00:00
for ( sty = 0 ; sty < 1 ; sty + + )
2004-08-22 22:29:09 +00:00
{
2023-08-01 11:08:51 +00:00
mesh - > lmst_array [ sty ] [ i ] [ 0 ] = ( surf - > light_s [ sty ] + s ) / mod - > lightmaps . width ;
mesh - > lmst_array [ sty ] [ i ] [ 1 ] = ( surf - > light_t [ sty ] + t ) / mod - > lightmaps . height ;
2004-08-22 22:29:09 +00:00
}
}
2017-02-19 00:15:42 +00:00
else
2011-10-27 16:16:29 +00:00
{
2023-08-01 11:08:51 +00:00
# ifndef SERVERONLY
if ( r_lightmap_average . ival )
2017-02-19 00:15:42 +00:00
{
2023-08-01 11:08:51 +00:00
for ( sty = 0 ; sty < 1 ; sty + + )
{
mesh - > lmst_array [ sty ] [ i ] [ 0 ] = ( surf - > extents [ 0 ] * 0.5 + ( surf - > light_s [ sty ] < < surf - > lmshift ) + ( 1 < < surf - > lmshift ) * 0.5 ) / ( mod - > lightmaps . width < < surf - > lmshift ) ;
mesh - > lmst_array [ sty ] [ i ] [ 1 ] = ( surf - > extents [ 1 ] * 0.5 + ( surf - > light_t [ sty ] < < surf - > lmshift ) + ( 1 < < surf - > lmshift ) * 0.5 ) / ( mod - > lightmaps . height < < surf - > lmshift ) ;
}
}
else
# endif
{
for ( sty = 0 ; sty < 1 ; sty + + )
{
mesh - > lmst_array [ sty ] [ i ] [ 0 ] = ( s - surf - > texturemins [ 0 ] + ( surf - > light_s [ sty ] < < surf - > lmshift ) + ( 1 < < surf - > lmshift ) * 0.5 ) / ( mod - > lightmaps . width < < surf - > lmshift ) ;
mesh - > lmst_array [ sty ] [ i ] [ 1 ] = ( t - surf - > texturemins [ 1 ] + ( surf - > light_t [ sty ] < < surf - > lmshift ) + ( 1 < < surf - > lmshift ) * 0.5 ) / ( mod - > lightmaps . height < < surf - > lmshift ) ;
}
2017-02-19 00:15:42 +00:00
}
2011-10-27 16:16:29 +00:00
}
2004-08-22 22:29:09 +00:00
2023-07-12 17:05:21 +00:00
if ( mod - > surfedgenormals )
2011-10-27 16:16:29 +00:00
{
2023-07-12 17:05:21 +00:00
struct surfedgenormals_s * pv = mod - > surfedgenormals + surf - > firstedge + i ;
VectorCopy ( mod - > normals [ pv - > n ] , mesh - > normals_array [ i ] ) ;
VectorCopy ( mod - > normals [ pv - > s ] , mesh - > snormals_array [ i ] ) ;
VectorCopy ( mod - > normals [ pv - > t ] , mesh - > tnormals_array [ i ] ) ;
2011-10-27 16:16:29 +00:00
}
2017-02-19 00:15:42 +00:00
else
2011-10-27 16:16:29 +00:00
{
2023-07-12 17:05:21 +00:00
//figure out the texture directions, for bumpmapping and stuff
if ( mod - > normals & & ( surf - > texinfo - > flags & 0x800 ) & & ( mod - > normals [ vertidx ] [ 0 ] | | mod - > normals [ vertidx ] [ 1 ] | | mod - > normals [ vertidx ] [ 2 ] ) )
{
//per-vertex normals - used for smoothing groups and stuff.
VectorCopy ( mod - > normals [ vertidx ] , mesh - > normals_array [ i ] ) ;
}
2017-02-19 00:15:42 +00:00
else
2023-07-12 17:05:21 +00:00
{
if ( surf - > flags & SURF_PLANEBACK )
VectorNegate ( surf - > plane - > normal , mesh - > normals_array [ i ] ) ;
else
VectorCopy ( surf - > plane - > normal , mesh - > normals_array [ i ] ) ;
}
VectorCopy ( surf - > texinfo - > vecs [ 0 ] , mesh - > snormals_array [ i ] ) ;
VectorNegate ( surf - > texinfo - > vecs [ 1 ] , mesh - > tnormals_array [ i ] ) ;
//for q1bsp the s+t vectors are usually axis-aligned, so fiddle them so they're normal aligned instead
d = - DotProduct ( mesh - > normals_array [ i ] , mesh - > snormals_array [ i ] ) ;
VectorMA ( mesh - > snormals_array [ i ] , d , mesh - > normals_array [ i ] , mesh - > snormals_array [ i ] ) ;
d = - DotProduct ( mesh - > normals_array [ i ] , mesh - > tnormals_array [ i ] ) ;
VectorMA ( mesh - > tnormals_array [ i ] , d , mesh - > normals_array [ i ] , mesh - > tnormals_array [ i ] ) ;
VectorNormalize ( mesh - > snormals_array [ i ] ) ;
VectorNormalize ( mesh - > tnormals_array [ i ] ) ;
2011-10-27 16:16:29 +00:00
}
2017-02-19 00:15:42 +00:00
//q1bsp has no colour information (fixme: sample from the lightmap?)
for ( sty = 0 ; sty < 1 ; sty + + )
2011-10-27 16:16:29 +00:00
{
2017-02-19 00:15:42 +00:00
mesh - > colors4f_array [ sty ] [ i ] [ 0 ] = 1 ;
mesh - > colors4f_array [ sty ] [ i ] [ 1 ] = 1 ;
mesh - > colors4f_array [ sty ] [ i ] [ 2 ] = 1 ;
mesh - > colors4f_array [ sty ] [ i ] [ 3 ] = 1 ;
2011-10-27 16:16:29 +00:00
}
2004-08-22 22:29:09 +00:00
}
}
2017-02-19 00:15:42 +00:00
# endif
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
# ifndef SERVERONLY
static void Mod_Batches_BuildModelMeshes ( model_t * mod , int maxverts , int maxindicies , void ( * build ) ( model_t * mod , msurface_t * surf , builddata_t * bd ) , builddata_t * bd , int lmmerge )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
batch_t * batch ;
msurface_t * surf ;
mesh_t * mesh ;
int numverts = 0 ;
int numindicies = 0 ;
int j , i ;
int sortid ;
int sty ;
vbo_t vbo ;
int styles = mod - > lightmaps . surfstyles ;
char * ptr ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
memset ( & vbo , 0 , sizeof ( vbo ) ) ;
vbo . indicies . sysptr = ZG_Malloc ( & mod - > memgroup , sizeof ( index_t ) * maxindicies ) ;
ptr = ZG_Malloc ( & mod - > memgroup , ( sizeof ( vecV_t ) + sizeof ( vec2_t ) * ( 1 + styles ) + sizeof ( vec3_t ) * 3 + sizeof ( vec4_t ) * styles ) * maxverts ) ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
vbo . coord . sysptr = ptr ;
ptr + = sizeof ( vecV_t ) * maxverts ;
for ( sty = 0 ; sty < styles ; sty + + )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
vbo . colours [ sty ] . sysptr = ptr ;
ptr + = sizeof ( vec4_t ) * maxverts ;
}
for ( ; sty < MAXRLIGHTMAPS ; sty + + )
vbo . colours [ sty ] . sysptr = NULL ;
vbo . texcoord . sysptr = ptr ;
ptr + = sizeof ( vec2_t ) * maxverts ;
sty = 0 ;
for ( ; sty < styles ; sty + + )
{
vbo . lmcoord [ sty ] . sysptr = ptr ;
ptr + = sizeof ( vec2_t ) * maxverts ;
}
for ( ; sty < MAXRLIGHTMAPS ; sty + + )
vbo . lmcoord [ sty ] . sysptr = NULL ;
vbo . normals . sysptr = ptr ;
ptr + = sizeof ( vec3_t ) * maxverts ;
vbo . svector . sysptr = ptr ;
ptr + = sizeof ( vec3_t ) * maxverts ;
vbo . tvector . sysptr = ptr ;
ptr + = sizeof ( vec3_t ) * maxverts ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
numindicies = 0 ;
numverts = 0 ;
//build each mesh
for ( sortid = 0 ; sortid < SHADER_SORT_COUNT ; sortid + + )
{
for ( batch = mod - > batches [ sortid ] ; batch ; batch = batch - > next )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
for ( j = 0 ; j < batch - > maxmeshes ; j + + )
{
surf = ( msurface_t * ) batch - > mesh [ j ] ;
mesh = surf - > mesh ;
batch - > mesh [ j ] = mesh ;
2006-03-12 22:01:49 +00:00
2017-02-19 00:15:42 +00:00
mesh - > vbofirstvert = numverts ;
mesh - > vbofirstelement = numindicies ;
numverts + = mesh - > numvertexes ;
numindicies + = mesh - > numindexes ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
//set up the arrays. the arrangement is required for the backend to optimise vbos
mesh - > xyz_array = ( vecV_t * ) vbo . coord . sysptr + mesh - > vbofirstvert ;
mesh - > st_array = ( vec2_t * ) vbo . texcoord . sysptr + mesh - > vbofirstvert ;
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
{
if ( vbo . lmcoord [ sty ] . sysptr )
mesh - > lmst_array [ sty ] = ( vec2_t * ) vbo . lmcoord [ sty ] . sysptr + mesh - > vbofirstvert ;
else
mesh - > lmst_array [ sty ] = NULL ;
if ( vbo . colours [ sty ] . sysptr )
mesh - > colors4f_array [ sty ] = ( vec4_t * ) vbo . colours [ sty ] . sysptr + mesh - > vbofirstvert ;
else
mesh - > colors4f_array [ sty ] = NULL ;
}
mesh - > normals_array = ( vec3_t * ) vbo . normals . sysptr + mesh - > vbofirstvert ;
mesh - > snormals_array = ( vec3_t * ) vbo . svector . sysptr + mesh - > vbofirstvert ;
mesh - > tnormals_array = ( vec3_t * ) vbo . tvector . sysptr + mesh - > vbofirstvert ;
mesh - > indexes = ( index_t * ) vbo . indicies . sysptr + mesh - > vbofirstelement ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
mesh - > vbofirstvert = 0 ;
mesh - > vbofirstelement = 0 ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
build ( mod , surf , bd ) ;
if ( lmmerge ! = 1 )
{
2017-10-31 22:52:58 +00:00
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
2017-02-19 00:15:42 +00:00
{
2017-10-31 22:52:58 +00:00
if ( surf - > lightmaptexturenums [ sty ] > = 0 )
2017-02-19 00:15:42 +00:00
{
2017-10-31 22:52:58 +00:00
if ( mod - > lightmaps . deluxemapping )
surf - > lightmaptexturenums [ sty ] / = 2 ;
if ( mesh - > lmst_array [ sty ] )
2017-02-19 00:15:42 +00:00
{
2020-02-26 00:37:52 +00:00
int soffset = surf - > lightmaptexturenums [ sty ] % mod - > lightmaps . mergew ;
int toffset = surf - > lightmaptexturenums [ sty ] / mod - > lightmaps . mergew ;
float smul = 1.0 / mod - > lightmaps . mergew ;
float tmul = 1.0 / mod - > lightmaps . mergeh ;
2017-10-31 22:52:58 +00:00
for ( i = 0 ; i < mesh - > numvertexes ; i + + )
{
2020-02-26 00:37:52 +00:00
mesh - > lmst_array [ sty ] [ i ] [ 0 ] + = soffset ;
mesh - > lmst_array [ sty ] [ i ] [ 0 ] * = smul ;
mesh - > lmst_array [ sty ] [ i ] [ 1 ] + = toffset ;
mesh - > lmst_array [ sty ] [ i ] [ 1 ] * = tmul ;
2017-10-31 22:52:58 +00:00
}
2017-02-19 00:15:42 +00:00
}
2017-10-31 22:52:58 +00:00
surf - > lightmaptexturenums [ sty ] / = lmmerge ;
if ( mod - > lightmaps . deluxemapping )
surf - > lightmaptexturenums [ sty ] * = 2 ;
2017-02-19 00:15:42 +00:00
}
}
}
}
batch - > meshes = 0 ;
batch - > firstmesh = 0 ;
}
}
}
# ifdef Q1BSPS
//q1 autoanimates. if the frame is set, it uses the alternate animation.
static void Mod_UpdateBatchShader_Q1 ( struct batch_s * batch )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
texture_t * base = batch - > texture ;
2019-12-10 14:50:47 +00:00
unsigned int relative ;
int count ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
if ( batch - > ent - > framestate . g [ FS_REG ] . frame [ 0 ] )
{
if ( base - > alternate_anims )
base = base - > alternate_anims ;
}
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
if ( base - > anim_total )
2004-08-22 22:29:09 +00:00
{
2019-12-10 14:50:47 +00:00
relative = ( unsigned int ) ( cl . time * 10 ) % base - > anim_total ;
2017-02-19 00:15:42 +00:00
count = 0 ;
2019-12-10 14:50:47 +00:00
while ( base - > anim_min > relative | | base - > anim_max < = relative )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
base = base - > anim_next ;
if ( ! base )
Sys_Error ( " R_TextureAnimation: broken cycle " ) ;
if ( + + count > 100 )
Sys_Error ( " R_TextureAnimation: infinite cycle " ) ;
2004-08-22 22:29:09 +00:00
}
}
2017-02-19 00:15:42 +00:00
batch - > shader = base - > shader ;
}
2022-01-03 01:57:23 +00:00
// copy of Q1s, but with a different framerate
static void Mod_UpdateBatchShader_HL ( struct batch_s * batch )
{
texture_t * base = batch - > texture ;
unsigned int relative ;
int count ;
if ( batch - > ent - > framestate . g [ FS_REG ] . frame [ 0 ] )
{
if ( base - > alternate_anims )
base = base - > alternate_anims ;
}
if ( base - > anim_total )
{
relative = ( unsigned int ) ( cl . time * 20 ) % base - > anim_total ;
count = 0 ;
while ( base - > anim_min > relative | | base - > anim_max < = relative )
{
base = base - > anim_next ;
if ( ! base )
Sys_Error ( " R_TextureAnimation: broken cycle " ) ;
if ( + + count > 100 )
Sys_Error ( " R_TextureAnimation: infinite cycle " ) ;
}
}
batch - > shader = base - > shader ;
}
2017-02-19 00:15:42 +00:00
# endif
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
# ifdef Q2BSPS
//q2 has direct control over the texture frames used, but typically has the client generate the frame (different flags autogenerate different ranges).
static void Mod_UpdateBatchShader_Q2 ( struct batch_s * batch )
{
texture_t * base = batch - > texture ;
int reletive ;
int frame = batch - > ent - > framestate . g [ FS_REG ] . frame [ 0 ] ;
if ( batch - > ent = = & r_worldentity )
frame = cl . time * 2 ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
if ( base - > anim_total )
{
reletive = frame % base - > anim_total ;
while ( reletive - - > 0 )
{
base = base - > anim_next ;
if ( ! base )
Sys_Error ( " R_TextureAnimation: broken cycle " ) ;
}
2004-08-22 22:29:09 +00:00
}
2017-02-19 00:15:42 +00:00
batch - > shader = base - > shader ;
2004-08-22 22:29:09 +00:00
}
2017-02-19 00:15:42 +00:00
# endif
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
# define lmmerge(i) ((i>=0)?i / merge:i)
2004-08-22 22:29:09 +00:00
/*
2017-02-19 00:15:42 +00:00
batch - > firstmesh is set only in and for this function , its cleared out elsewhere
2004-08-22 22:29:09 +00:00
*/
2017-02-19 00:15:42 +00:00
static int Mod_Batches_Generate ( model_t * mod )
2004-08-22 22:29:09 +00:00
{
2021-06-25 18:50:53 +00:00
//#define NOBATCH //define this to force each surface into its own batch...
2017-02-19 00:15:42 +00:00
int i ;
msurface_t * surf ;
shader_t * shader ;
int sortid ;
batch_t * batch , * lbatch = NULL ;
vec4_t plane ;
2019-10-07 04:51:17 +00:00
image_t * envmap ;
2004-08-22 22:29:09 +00:00
2020-02-26 00:37:52 +00:00
int merge = mod - > lightmaps . mergew * mod - > lightmaps . mergeh ;
2017-02-19 00:15:42 +00:00
if ( ! merge )
2020-02-26 00:37:52 +00:00
merge = mod - > lightmaps . mergew = mod - > lightmaps . mergeh = 1 ; //no division by 0 please...
2019-11-04 17:24:11 +00:00
if ( mod - > lightmaps . deluxemapping )
{
mod - > lightmaps . count = ( ( mod - > lightmaps . count + 1 ) / 2 + merge - 1 ) & ~ ( merge - 1 ) ;
mod - > lightmaps . count / = merge ;
mod - > lightmaps . count * = 2 ;
}
else
{
mod - > lightmaps . count = ( mod - > lightmaps . count + merge - 1 ) & ~ ( merge - 1 ) ;
mod - > lightmaps . count / = merge ;
}
2020-02-26 00:37:52 +00:00
mod - > lightmaps . width * = mod - > lightmaps . mergew ;
mod - > lightmaps . height * = mod - > lightmaps . mergeh ;
2015-03-03 00:14:43 +00:00
2017-02-19 00:15:42 +00:00
mod - > numbatches = 0 ;
2015-03-03 00:14:43 +00:00
2017-02-19 00:15:42 +00:00
//for each surface, find a suitable batch to insert it into.
//we use 'firstmesh' to avoid chucking out too many verts in a single vbo (gl2 hardware tends to have a 16bit limit)
for ( i = 0 ; i < mod - > nummodelsurfaces ; i + + )
2006-03-12 22:01:49 +00:00
{
2017-02-19 00:15:42 +00:00
surf = mod - > surfaces + mod - > firstmodelsurface + i ;
shader = surf - > texinfo - > texture - > shader ;
2019-10-07 04:51:17 +00:00
envmap = surf - > envmap ;
2017-02-19 00:15:42 +00:00
if ( surf - > flags & SURF_NODRAW )
2011-10-27 16:16:29 +00:00
{
2017-02-19 00:15:42 +00:00
shader = R_RegisterShader ( " nodraw " , SUF_NONE , " { \n surfaceparm nodraw \n } " ) ;
sortid = shader - > sort ;
VectorClear ( plane ) ;
plane [ 3 ] = 0 ;
2019-10-07 04:51:17 +00:00
envmap = NULL ;
2011-10-27 16:16:29 +00:00
}
2017-02-19 00:15:42 +00:00
else if ( shader )
2011-10-27 16:16:29 +00:00
{
2017-02-19 00:15:42 +00:00
sortid = shader - > sort ;
//shaders that are portals need to be split into separate batches to have the same surface planes
if ( sortid = = SHADER_SORT_PORTAL | | ( shader - > flags & ( SHADER_HASREFLECT | SHADER_HASREFRACT ) ) )
{
if ( surf - > flags & SURF_PLANEBACK )
{
VectorNegate ( surf - > plane - > normal , plane ) ;
plane [ 3 ] = - surf - > plane - > dist ;
}
else
{
VectorCopy ( surf - > plane - > normal , plane ) ;
plane [ 3 ] = surf - > plane - > dist ;
}
}
else
{
VectorClear ( plane ) ;
plane [ 3 ] = 0 ;
}
2019-10-07 04:51:17 +00:00
if ( ! ( shader - > flags & SHADER_HASREFLECTCUBE ) )
envmap = NULL ;
2011-10-27 16:16:29 +00:00
}
2017-02-19 00:15:42 +00:00
else
{
sortid = SHADER_SORT_OPAQUE ;
VectorClear ( plane ) ;
plane [ 3 ] = 0 ;
}
2021-06-25 18:50:53 +00:00
# ifdef NOBATCH
batch = NULL ;
( void ) lbatch ;
# else
2017-02-19 00:15:42 +00:00
if ( lbatch & & (
lbatch - > texture = = surf - > texinfo - > texture & &
lbatch - > shader = = shader & &
lbatch - > lightmap [ 0 ] = = lmmerge ( surf - > lightmaptexturenums [ 0 ] ) & &
2020-08-13 08:39:48 +00:00
Vector4Compare ( plane , lbatch - > user . bmodel . plane ) & &
2017-06-22 10:29:06 +00:00
lbatch - > firstmesh + surf - > mesh - > numvertexes < = MAX_INDICIES & &
2021-06-25 18:50:53 +00:00
# if MAXRLIGHTMAPS > 1
2017-02-19 00:15:42 +00:00
lbatch - > lightmap [ 1 ] = = lmmerge ( surf - > lightmaptexturenums [ 1 ] ) & &
lbatch - > lightmap [ 2 ] = = lmmerge ( surf - > lightmaptexturenums [ 2 ] ) & &
lbatch - > lightmap [ 3 ] = = lmmerge ( surf - > lightmaptexturenums [ 3 ] ) & &
2021-06-25 18:50:53 +00:00
# endif
2018-07-22 11:49:37 +00:00
lbatch - > fog = = surf - > fog & &
2019-10-07 04:51:17 +00:00
lbatch - > envmap = = envmap ) )
2017-02-19 00:15:42 +00:00
batch = lbatch ;
else
{
for ( batch = mod - > batches [ sortid ] ; batch ; batch = batch - > next )
{
if (
batch - > texture = = surf - > texinfo - > texture & &
batch - > shader = = shader & &
batch - > lightmap [ 0 ] = = lmmerge ( surf - > lightmaptexturenums [ 0 ] ) & &
2020-08-13 08:39:48 +00:00
Vector4Compare ( plane , batch - > user . bmodel . plane ) & &
2017-02-19 00:15:42 +00:00
batch - > firstmesh + surf - > mesh - > numvertexes < = MAX_INDICIES & &
2021-06-25 18:50:53 +00:00
# if MAXRLIGHTMAPS > 1
2017-02-19 00:15:42 +00:00
batch - > lightmap [ 1 ] = = lmmerge ( surf - > lightmaptexturenums [ 1 ] ) & &
batch - > lightmap [ 2 ] = = lmmerge ( surf - > lightmaptexturenums [ 2 ] ) & &
batch - > lightmap [ 3 ] = = lmmerge ( surf - > lightmaptexturenums [ 3 ] ) & &
2021-06-25 18:50:53 +00:00
# endif
2018-07-22 11:49:37 +00:00
batch - > fog = = surf - > fog & &
2019-10-07 04:51:17 +00:00
batch - > envmap = = envmap )
2017-02-19 00:15:42 +00:00
break ;
}
}
2021-06-25 18:50:53 +00:00
# endif
2017-02-19 00:15:42 +00:00
if ( ! batch )
{
batch = ZG_Malloc ( & mod - > memgroup , sizeof ( * batch ) ) ;
batch - > lightmap [ 0 ] = lmmerge ( surf - > lightmaptexturenums [ 0 ] ) ;
# if MAXRLIGHTMAPS > 1
batch - > lightmap [ 1 ] = lmmerge ( surf - > lightmaptexturenums [ 1 ] ) ;
batch - > lightmap [ 2 ] = lmmerge ( surf - > lightmaptexturenums [ 2 ] ) ;
batch - > lightmap [ 3 ] = lmmerge ( surf - > lightmaptexturenums [ 3 ] ) ;
# endif
batch - > texture = surf - > texinfo - > texture ;
batch - > shader = shader ;
if ( surf - > texinfo - > texture - > alternate_anims | | surf - > texinfo - > texture - > anim_total )
{
switch ( mod - > fromgame )
{
# ifdef Q2BSPS
case fg_quake2 :
batch - > buildmeshes = Mod_UpdateBatchShader_Q2 ;
break ;
# endif
# ifdef Q1BSPS
case fg_quake :
batch - > buildmeshes = Mod_UpdateBatchShader_Q1 ;
break ;
2022-01-03 01:57:23 +00:00
case fg_halflife :
batch - > buildmeshes = Mod_UpdateBatchShader_HL ;
break ;
2017-02-19 00:15:42 +00:00
# endif
default :
break ;
}
}
batch - > next = mod - > batches [ sortid ] ;
batch - > ent = & r_worldentity ;
batch - > fog = surf - > fog ;
2019-10-07 04:51:17 +00:00
batch - > envmap = envmap ;
2020-08-13 08:39:48 +00:00
Vector4Copy ( plane , batch - > user . bmodel . plane ) ;
2017-02-19 00:15:42 +00:00
mod - > batches [ sortid ] = batch ;
}
2021-06-25 18:50:53 +00:00
batch - > user . bmodel . ebobatch = - 1 ;
2017-02-19 00:15:42 +00:00
surf - > sbatch = batch ; //let the surface know which batch its in
batch - > maxmeshes + + ;
batch - > firstmesh + = surf - > mesh - > numvertexes ;
lbatch = batch ;
2006-03-12 22:01:49 +00:00
}
2017-02-19 00:15:42 +00:00
return merge ;
# undef lmmerge
}
void Mod_LightmapAllocInit ( lmalloc_t * lmallocator , qboolean hasdeluxe , unsigned int width , unsigned int height , int firstlm )
{
memset ( lmallocator , 0 , sizeof ( * lmallocator ) ) ;
lmallocator - > deluxe = hasdeluxe ;
lmallocator - > lmnum = firstlm ;
lmallocator - > firstlm = firstlm ;
2021-04-14 05:21:04 +00:00
lmallocator - > width = min ( LMBLOCK_SIZE_MAX , width ) ;
lmallocator - > height = min ( LMBLOCK_SIZE_MAX , height ) ;
2017-02-19 00:15:42 +00:00
}
void Mod_LightmapAllocDone ( lmalloc_t * lmallocator , model_t * mod )
{
mod - > lightmaps . first = lmallocator - > firstlm ;
mod - > lightmaps . count = ( lmallocator - > lmnum - lmallocator - > firstlm ) ;
if ( lmallocator - > allocated [ 0 ] ) //lmnum was only *COMPLETE* lightmaps that we allocated, and does not include the one we're currently building.
mod - > lightmaps . count + + ;
if ( lmallocator - > deluxe )
{
mod - > lightmaps . first * = 2 ;
mod - > lightmaps . count * = 2 ;
mod - > lightmaps . deluxemapping = true ;
}
else
mod - > lightmaps . deluxemapping = false ;
}
void Mod_LightmapAllocBlock ( lmalloc_t * lmallocator , int w , int h , unsigned short * x , unsigned short * y , int * tnum )
{
int best , best2 ;
int i , j ;
for ( ; ; )
{
best = lmallocator - > height ;
for ( i = 0 ; i < = lmallocator - > width - w ; i + + )
{
best2 = 0 ;
for ( j = 0 ; j < w ; j + + )
{
if ( lmallocator - > allocated [ i + j ] > = best )
break ;
if ( lmallocator - > allocated [ i + j ] > best2 )
best2 = lmallocator - > allocated [ i + j ] ;
}
if ( j = = w )
{ // this is a valid spot
* x = i ;
* y = best = best2 ;
}
}
if ( best + h > lmallocator - > height )
{
memset ( lmallocator - > allocated , 0 , sizeof ( lmallocator - > allocated ) ) ;
lmallocator - > lmnum + + ;
continue ;
}
for ( i = 0 ; i < w ; i + + )
lmallocator - > allocated [ * x + i ] = best + h ;
if ( lmallocator - > deluxe )
* tnum = lmallocator - > lmnum * 2 ;
else
* tnum = lmallocator - > lmnum ;
break ;
}
}
# ifdef Q3BSPS
static void Mod_Batches_SplitLightmaps ( model_t * mod , int lmmerge )
{
batch_t * batch ;
batch_t * nb ;
int i , j , sortid ;
msurface_t * surf ;
int sty ;
2017-10-31 22:52:58 +00:00
int lmscale = 1 ;
if ( mod - > lightmaps . deluxemapping )
{
lmmerge * = 2 ;
lmscale * = 2 ;
}
2017-02-19 00:15:42 +00:00
for ( sortid = 0 ; sortid < SHADER_SORT_COUNT ; sortid + + )
for ( batch = mod - > batches [ sortid ] ; batch ! = NULL ; batch = batch - > next )
{
surf = ( msurface_t * ) batch - > mesh [ 0 ] ;
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
{
2017-10-31 22:52:58 +00:00
batch - > lightmap [ sty ] = ( surf - > lightmaptexturenums [ sty ] > = 0 ) ? lmscale * ( surf - > lightmaptexturenums [ sty ] / lmmerge ) : surf - > lightmaptexturenums [ sty ] ;
2017-02-19 00:15:42 +00:00
batch - > lmlightstyle [ sty ] = surf - > styles [ sty ] ;
2020-02-25 00:30:34 +00:00
batch - > vtlightstyle [ sty ] = surf - > vlstyles [ sty ] ;
2017-02-19 00:15:42 +00:00
}
for ( j = 1 ; j < batch - > maxmeshes ; j + + )
{
surf = ( msurface_t * ) batch - > mesh [ j ] ;
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
{
2017-10-31 22:52:58 +00:00
int lm = ( surf - > lightmaptexturenums [ sty ] > = 0 ) ? lmscale * ( surf - > lightmaptexturenums [ sty ] / lmmerge ) : surf - > lightmaptexturenums [ sty ] ;
2017-02-19 00:15:42 +00:00
if ( lm ! = batch - > lightmap [ sty ] | |
//fixme: we should merge later (reverted matching) surfaces into the prior batch
surf - > styles [ sty ] ! = batch - > lmlightstyle [ sty ] | |
surf - > vlstyles [ sty ] ! = batch - > vtlightstyle [ sty ] )
break ;
}
if ( sty < MAXRLIGHTMAPS )
{
nb = ZG_Malloc ( & mod - > memgroup , sizeof ( * batch ) ) ;
* nb = * batch ;
batch - > next = nb ;
nb - > mesh = batch - > mesh + j * 2 ;
nb - > maxmeshes = batch - > maxmeshes - j ;
batch - > maxmeshes = j ;
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
{
2017-10-31 22:52:58 +00:00
int lm = ( surf - > lightmaptexturenums [ sty ] > = 0 ) ? lmscale * ( surf - > lightmaptexturenums [ sty ] / lmmerge ) : surf - > lightmaptexturenums [ sty ] ;
2017-02-19 00:15:42 +00:00
nb - > lightmap [ sty ] = lm ;
nb - > lmlightstyle [ sty ] = surf - > styles [ sty ] ;
nb - > vtlightstyle [ sty ] = surf - > vlstyles [ sty ] ;
}
memmove ( nb - > mesh , batch - > mesh + j , sizeof ( msurface_t * ) * nb - > maxmeshes ) ;
for ( i = 0 ; i < nb - > maxmeshes ; i + + )
{
surf = ( msurface_t * ) nb - > mesh [ i ] ;
surf - > sbatch = nb ;
}
batch = nb ;
j = 1 ;
}
}
}
}
# endif
# if defined(Q1BSPS) || defined(Q2BSPS)
static void Mod_LightmapAllocSurf ( lmalloc_t * lmallocator , msurface_t * surf , int surfstyle )
{
int smax , tmax ;
smax = ( surf - > extents [ 0 ] > > surf - > lmshift ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > surf - > lmshift ) + 1 ;
if ( isDedicated | |
( surf - > texinfo - > texture - > shader & & ! ( surf - > texinfo - > texture - > shader - > flags & SHADER_HASLIGHTMAP ) ) | | //fte
2018-07-22 11:49:37 +00:00
( surf - > flags & ( SURF_DRAWSKY | SURF_DRAWTILED ) ) | | //q1
2017-02-19 00:15:42 +00:00
( surf - > texinfo - > flags & TEX_SPECIAL ) | | //the original 'no lightmap'
smax > lmallocator - > width | | tmax > lmallocator - > height | | smax < 0 | | tmax < 0 ) //bugs/bounds/etc
{
surf - > lightmaptexturenums [ surfstyle ] = - 1 ;
return ;
}
Mod_LightmapAllocBlock ( lmallocator , smax , tmax , & surf - > light_s [ surfstyle ] , & surf - > light_t [ surfstyle ] , & surf - > lightmaptexturenums [ surfstyle ] ) ;
}
/*
allocates lightmaps and splits batches upon lightmap boundaries
*/
static void Mod_Batches_AllocLightmaps ( model_t * mod )
{
batch_t * batch ;
batch_t * nb ;
lmalloc_t lmallocator ;
int i , j , sortid ;
msurface_t * surf ;
int sty ;
size_t samps = 0 ;
//small models don't have many surfaces, don't allocate a smegging huge lightmap that simply won't be used.
for ( i = 0 , j = 0 ; i < mod - > nummodelsurfaces ; i + + )
{
surf = mod - > surfaces + mod - > firstmodelsurface + i ;
if ( surf - > texinfo - > flags & TEX_SPECIAL )
continue ; //surfaces with no lightmap should not count torwards anything.
samps + = ( ( surf - > extents [ 0 ] > > surf - > lmshift ) + 1 ) * ( ( surf - > extents [ 1 ] > > surf - > lmshift ) + 1 ) ;
if ( j < ( surf - > extents [ 0 ] > > surf - > lmshift ) + 1 )
j = ( surf - > extents [ 0 ] > > surf - > lmshift ) + 1 ;
if ( j < ( surf - > extents [ 1 ] > > surf - > lmshift ) + 1 )
j = ( surf - > extents [ 1 ] > > surf - > lmshift ) + 1 ;
}
samps / = 4 ;
samps = sqrt ( samps ) ;
if ( j > 128 | | r_dynamic . ival < = 0 )
samps * = 2 ;
mod - > lightmaps . width = bound ( j , samps , LMBLOCK_SIZE_MAX ) ;
mod - > lightmaps . height = bound ( j , samps , LMBLOCK_SIZE_MAX ) ;
for ( i = 0 ; ( 1 < < i ) < mod - > lightmaps . width ; i + + ) ;
mod - > lightmaps . width = 1 < < i ;
for ( i = 0 ; ( 1 < < i ) < mod - > lightmaps . height ; i + + ) ;
mod - > lightmaps . height = 1 < < i ;
2017-12-28 16:24:50 +00:00
mod - > lightmaps . width = bound ( 64 , mod - > lightmaps . width , sh_config . texture2d_maxsize ) ;
mod - > lightmaps . height = bound ( 64 , mod - > lightmaps . height , sh_config . texture2d_maxsize ) ;
2017-02-19 00:15:42 +00:00
Mod_LightmapAllocInit ( & lmallocator , mod - > deluxdata ! = NULL , mod - > lightmaps . width , mod - > lightmaps . height , 0x50 ) ;
for ( sortid = 0 ; sortid < SHADER_SORT_COUNT ; sortid + + )
for ( batch = mod - > batches [ sortid ] ; batch ! = NULL ; batch = batch - > next )
{
surf = ( msurface_t * ) batch - > mesh [ 0 ] ;
Mod_LightmapAllocSurf ( & lmallocator , surf , 0 ) ;
for ( sty = 1 ; sty < MAXRLIGHTMAPS ; sty + + )
surf - > lightmaptexturenums [ sty ] = - 1 ;
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
{
batch - > lightmap [ sty ] = surf - > lightmaptexturenums [ sty ] ;
2020-01-10 12:23:25 +00:00
batch - > lmlightstyle [ sty ] = INVALID_LIGHTSTYLE ; //don't do special backend rendering of lightstyles.
2017-02-19 00:15:42 +00:00
batch - > vtlightstyle [ sty ] = 255 ; //don't do special backend rendering of lightstyles.
}
for ( j = 1 ; j < batch - > maxmeshes ; j + + )
{
surf = ( msurface_t * ) batch - > mesh [ j ] ;
Mod_LightmapAllocSurf ( & lmallocator , surf , 0 ) ;
for ( sty = 1 ; sty < MAXRLIGHTMAPS ; sty + + )
surf - > lightmaptexturenums [ sty ] = - 1 ;
if ( surf - > lightmaptexturenums [ 0 ] ! = batch - > lightmap [ 0 ] )
{
nb = ZG_Malloc ( & mod - > memgroup , sizeof ( * batch ) ) ;
* nb = * batch ;
batch - > next = nb ;
nb - > mesh = batch - > mesh + j * 2 ;
nb - > maxmeshes = batch - > maxmeshes - j ;
batch - > maxmeshes = j ;
for ( sty = 0 ; sty < MAXRLIGHTMAPS ; sty + + )
nb - > lightmap [ sty ] = surf - > lightmaptexturenums [ sty ] ;
memmove ( nb - > mesh , batch - > mesh + j , sizeof ( msurface_t * ) * nb - > maxmeshes ) ;
2015-05-03 19:57:46 +00:00
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < nb - > maxmeshes ; i + + )
{
surf = ( msurface_t * ) nb - > mesh [ i ] ;
surf - > sbatch = nb ;
}
2015-05-03 19:57:46 +00:00
2017-02-19 00:15:42 +00:00
batch = nb ;
j = 0 ;
}
2011-10-27 16:16:29 +00:00
}
2017-02-19 00:15:42 +00:00
}
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
Mod_LightmapAllocDone ( & lmallocator , mod ) ;
}
# endif
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
extern void Surf_CreateSurfaceLightmap ( msurface_t * surf , int shift ) ;
//if build is NULL, uses q1/q2 surf generation, and allocates lightmaps
2021-11-03 20:30:40 +00:00
void Mod_Batches_Build ( model_t * mod , builddata_t * bd )
2017-02-19 00:15:42 +00:00
{
int i ;
int numverts = 0 , numindicies = 0 ;
msurface_t * surf ;
mesh_t * mesh ;
mesh_t * * bmeshes ;
int sortid ;
batch_t * batch ;
mesh_t * meshlist ;
int merge = 1 ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
if ( ! mod - > textures )
return ;
2015-03-03 00:14:43 +00:00
2017-02-19 00:15:42 +00:00
if ( mod - > firstmodelsurface + mod - > nummodelsurfaces > mod - > numsurfaces )
Sys_Error ( " submodel %s surface range is out of bounds \n " , mod - > name ) ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
if ( bd )
meshlist = NULL ;
else
meshlist = ZG_Malloc ( & mod - > memgroup , sizeof ( mesh_t ) * mod - > nummodelsurfaces ) ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < mod - > nummodelsurfaces ; i + + )
{
surf = mod - > surfaces + i + mod - > firstmodelsurface ;
if ( meshlist )
2004-08-22 22:29:09 +00:00
{
2017-02-19 00:15:42 +00:00
mesh = surf - > mesh = & meshlist [ i ] ;
mesh - > numvertexes = surf - > numedges ;
mesh - > numindexes = ( surf - > numedges - 2 ) * 3 ;
2004-08-22 22:29:09 +00:00
}
2017-02-19 00:15:42 +00:00
else
mesh = surf - > mesh ;
2004-08-22 22:29:09 +00:00
2021-10-05 05:05:43 +00:00
if ( mesh - > numindexes < = 0 | | mesh - > numvertexes < 1 )
{
mesh - > numindexes = 0 ;
mesh - > numvertexes = 0 ;
}
2017-02-19 00:15:42 +00:00
numverts + = mesh - > numvertexes ;
numindicies + = mesh - > numindexes ;
// surf->lightmaptexturenum = -1;
2004-08-22 22:29:09 +00:00
}
2006-03-12 22:01:49 +00:00
2017-02-19 00:15:42 +00:00
/*assign each mesh to a batch, generating as needed*/
merge = Mod_Batches_Generate ( mod ) ;
2004-08-22 22:29:09 +00:00
2017-02-19 00:15:42 +00:00
bmeshes = ZG_Malloc ( & mod - > memgroup , sizeof ( * bmeshes ) * mod - > nummodelsurfaces * R_MAX_RECURSE ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
//we now know which batch each surface is in, and how many meshes there are in each batch.
//allocate the mesh-pointer-lists for each batch. *2 for recursion.
for ( i = 0 , sortid = 0 ; sortid < SHADER_SORT_COUNT ; sortid + + )
for ( batch = mod - > batches [ sortid ] ; batch ! = NULL ; batch = batch - > next )
2015-06-12 14:44:50 +00:00
{
2017-02-19 00:15:42 +00:00
batch - > mesh = bmeshes + i ;
i + = batch - > maxmeshes * R_MAX_RECURSE ;
}
//store the *surface* into the batch's mesh list (yes, this is an evil cast hack, but at least both are pointers)
for ( i = 0 ; i < mod - > nummodelsurfaces ; i + + )
{
surf = mod - > surfaces + mod - > firstmodelsurface + i ;
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = ( mesh_t * ) surf ;
2015-06-12 14:44:50 +00:00
}
2017-02-19 00:15:42 +00:00
# if defined(Q1BSPS) || defined(Q2BSPS)
if ( ! bd )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
Mod_Batches_AllocLightmaps ( mod ) ;
mod - > lightmaps . surfstyles = 1 ;
Mod_Batches_BuildModelMeshes ( mod , numverts , numindicies , ModQ1_Batches_BuildQ1Q2Poly , bd , merge ) ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
# endif
if ( bd )
2012-07-05 19:42:36 +00:00
{
2021-11-03 20:30:40 +00:00
if ( bd - > paintlightmaps )
Mod_Batches_AllocLightmaps ( mod ) ;
else
Mod_Batches_SplitLightmaps ( mod , merge ) ;
2017-02-19 00:15:42 +00:00
Mod_Batches_BuildModelMeshes ( mod , numverts , numindicies , bd - > buildfunc , bd , merge ) ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
if ( BE_GenBrushModelVBO )
BE_GenBrushModelVBO ( mod ) ;
}
# endif
2012-07-05 19:42:36 +00:00
2015-05-03 19:57:46 +00:00
2017-02-19 00:15:42 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_SetParent
= = = = = = = = = = = = = = = = =
2015-05-03 19:57:46 +00:00
*/
2017-02-19 00:15:42 +00:00
void Mod_SetParent ( mnode_t * node , mnode_t * parent )
{
if ( ! node )
return ;
node - > parent = parent ;
if ( node - > contents < 0 )
return ;
Mod_SetParent ( node - > children [ 0 ] , node ) ;
Mod_SetParent ( node - > children [ 1 ] , node ) ;
}
# if defined(Q1BSPS) || defined(Q2BSPS)
/*
= = = = = = = = = = = = = = = = =
Mod_LoadEdges
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
qboolean Mod_LoadEdges ( model_t * loadmodel , qbyte * mod_base , lump_t * l , subbsp_t subbsp )
2017-02-19 00:15:42 +00:00
{
medge_t * out ;
int i , count ;
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long1 | | subbsp = = sb_long2 )
2017-02-19 00:15:42 +00:00
{
dledge_t * in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2015-05-03 19:57:46 +00:00
{
2017-02-19 00:15:42 +00:00
Con_Printf ( " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , ( count + 1 ) * sizeof ( * out ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > edges = out ;
loadmodel - > numedges = count ;
for ( i = 0 ; i < count ; i + + , in + + , out + + )
2015-03-03 00:14:43 +00:00
{
2017-02-19 00:15:42 +00:00
out - > v [ 0 ] = LittleLong ( in - > v [ 0 ] ) ;
out - > v [ 1 ] = LittleLong ( in - > v [ 1 ] ) ;
2015-03-03 00:14:43 +00:00
}
2017-02-19 00:15:42 +00:00
}
else
{
dsedge_t * in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2015-03-03 00:14:43 +00:00
{
2017-02-19 00:15:42 +00:00
Con_Printf ( " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
2015-03-03 00:14:43 +00:00
}
2017-02-19 00:15:42 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , ( count + 1 ) * sizeof ( * out ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > edges = out ;
loadmodel - > numedges = count ;
for ( i = 0 ; i < count ; i + + , in + + , out + + )
2013-08-27 13:18:09 +00:00
{
2017-02-19 00:15:42 +00:00
out - > v [ 0 ] = ( unsigned short ) LittleShort ( in - > v [ 0 ] ) ;
out - > v [ 1 ] = ( unsigned short ) LittleShort ( in - > v [ 1 ] ) ;
2013-08-27 13:18:09 +00:00
}
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
return true ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadMarksurfaces
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
qboolean Mod_LoadMarksurfaces ( model_t * loadmodel , qbyte * mod_base , lump_t * l , subbsp_t subbsp )
2017-02-19 00:15:42 +00:00
{
int i , j , count ;
msurface_t * * out ;
2014-10-05 20:04:11 +00:00
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long1 | | subbsp = = sb_long2 )
2013-05-03 04:28:08 +00:00
{
2017-02-19 00:15:42 +00:00
int * inl ;
inl = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * inl ) ;
if ( l - > filelen % sizeof ( * inl ) | | count > SANITY_LIMIT ( * out ) )
2017-02-19 00:15:42 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
loadmodel - > marksurfaces = out ;
loadmodel - > nummarksurfaces = count ;
for ( i = 0 ; i < count ; i + + )
{
j = ( unsigned int ) LittleLong ( inl [ i ] ) ;
if ( j > = loadmodel - > numsurfaces )
{
Con_Printf ( CON_ERROR " Mod_ParseMarksurfaces: bad surface number \n " ) ;
return false ;
}
out [ i ] = loadmodel - > surfaces + j ;
}
2013-05-03 04:28:08 +00:00
}
2017-02-19 00:15:42 +00:00
else
2013-08-27 13:18:09 +00:00
{
2017-02-19 00:15:42 +00:00
short * ins ;
ins = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * ins ) ;
if ( l - > filelen % sizeof ( * ins ) | | count > SANITY_LIMIT ( * out ) )
2017-02-19 00:15:42 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > marksurfaces = out ;
loadmodel - > nummarksurfaces = count ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < count ; i + + )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
j = ( unsigned short ) LittleShort ( ins [ i ] ) ;
if ( j > = loadmodel - > numsurfaces )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
Con_Printf ( CON_ERROR " Mod_ParseMarksurfaces: bad surface number \n " ) ;
return false ;
}
out [ i ] = loadmodel - > surfaces + j ;
}
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
return true ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadSurfedges
= = = = = = = = = = = = = = = = =
*/
qboolean Mod_LoadSurfedges ( model_t * loadmodel , qbyte * mod_base , lump_t * l )
{
int i , count ;
int * in , * out ;
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2017-02-19 00:15:42 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > surfedges = out ;
loadmodel - > numsurfedges = count ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < count ; i + + )
out [ i ] = LittleLong ( in [ i ] ) ;
2015-06-28 00:42:00 +00:00
2017-02-19 00:15:42 +00:00
return true ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
# endif
# ifdef Q1BSPS
/*
= = = = = = = = = = = = = = = = =
Mod_LoadVisibility
= = = = = = = = = = = = = = = = =
*/
static void Mod_LoadVisibility ( model_t * loadmodel , qbyte * mod_base , lump_t * l , qbyte * ptr , size_t len )
2013-12-02 14:30:30 +00:00
{
2017-02-19 00:15:42 +00:00
if ( ! ptr )
2013-12-02 14:30:30 +00:00
{
2017-02-19 00:15:42 +00:00
ptr = mod_base + l - > fileofs ;
len = l - > filelen ;
2013-12-02 14:30:30 +00:00
}
2017-02-19 00:15:42 +00:00
if ( ! len )
2013-12-02 14:30:30 +00:00
{
2017-02-19 00:15:42 +00:00
loadmodel - > visdata = NULL ;
return ;
2013-12-02 14:30:30 +00:00
}
2017-02-19 00:15:42 +00:00
loadmodel - > visdata = ZG_Malloc ( & loadmodel - > memgroup , len ) ;
memcpy ( loadmodel - > visdata , ptr , len ) ;
2013-12-02 14:30:30 +00:00
}
2017-02-19 00:15:42 +00:00
# ifndef SERVERONLY
2021-08-21 18:16:13 +00:00
static void Mod_LoadMiptex ( model_t * loadmodel , texture_t * tx , miptex_t * mt , int mtsize , qbyte * ptr , size_t miptexsize )
2013-12-02 14:30:30 +00:00
{
2020-03-07 09:00:40 +00:00
unsigned int legacysize =
2017-02-19 00:15:42 +00:00
( mt - > width > > 0 ) * ( mt - > height > > 0 ) +
( mt - > width > > 1 ) * ( mt - > height > > 1 ) +
( mt - > width > > 2 ) * ( mt - > height > > 2 ) +
( mt - > width > > 3 ) * ( mt - > height > > 3 ) ;
2013-12-02 14:30:30 +00:00
2020-03-07 09:00:40 +00:00
uploadfmt_t newfmt = PTI_INVALID ;
size_t neww = 0 , newh = 0 ;
qbyte * newdata = NULL ;
qbyte * pal = NULL ;
2020-03-08 18:10:50 +00:00
int m ;
2020-03-07 09:00:40 +00:00
//bug: vanilla quake ignored offsets and just made assumptions.
//this means we can't just play with offsets to hide stuff, we have to postfix it (which requires guessing lump sizes)
//issue: halflife textures have (leshort)256,(byte)pal[256*3] stuck on the end
//we signal the presence of our extended data using 0x00,0xfb,0x2b,0xaf (this should be uncommon as the next mip's name shouldn't normally be empty, nor a weird char (which should hopefully also not come from random stack junk in the wad tool)
//each extended block of data then has a size value, followed by a block name.
//compressed formats then contain a width+height value, and then a FULL (round-down) mip chain.
//if the gpu doesn't support npot, or its too big, or can't use the pixelformat then the engine will simply have to fall back on the paletted data. lets hope it was present.
size_t extofs ;
if ( ! mt - > offsets [ 0 ] )
2021-08-21 18:16:13 +00:00
extofs = mtsize ;
else if ( mt - > offsets [ 0 ] = = mtsize & &
2020-03-07 09:00:40 +00:00
mt - > offsets [ 1 ] = = mt - > offsets [ 0 ] + ( mt - > width > > 0 ) * ( mt - > height > > 0 ) & &
mt - > offsets [ 2 ] = = mt - > offsets [ 1 ] + ( mt - > width > > 1 ) * ( mt - > height > > 1 ) & &
mt - > offsets [ 3 ] = = mt - > offsets [ 2 ] + ( mt - > width > > 2 ) * ( mt - > height > > 2 ) )
{
extofs = mt - > offsets [ 3 ] + ( mt - > width > > 3 ) * ( mt - > height > > 3 ) ;
2021-08-21 18:16:13 +00:00
if ( loadmodel - > fromgame = = fg_halflife & & * ( short * ) ( ptr + mt - > offsets [ 3 ] + ( mt - > width > > 3 ) * ( mt - > height > > 3 ) ) = = 256 )
2020-03-07 09:00:40 +00:00
{
2021-08-21 18:16:13 +00:00
pal = ptr + extofs + 2 ;
2020-03-07 09:00:40 +00:00
extofs + = 2 + 256 * 3 ;
}
2017-02-19 00:15:42 +00:00
}
else
2020-03-07 09:00:40 +00:00
extofs = miptexsize ; //the numbers don't match what we expect... something weird is going on here... don't misinterpret it.
2021-08-21 18:16:13 +00:00
if ( extofs + 4 < = miptexsize & & ptr [ extofs + 0 ] = = 0 & & ptr [ extofs + 1 ] = = 0xfb & & ptr [ extofs + 2 ] = = 0x2b & & ptr [ extofs + 3 ] = = 0xaf )
2020-03-07 09:00:40 +00:00
{
unsigned int extsize ;
extofs + = 4 ;
for ( ; extofs < miptexsize ; extofs + = extsize )
{
size_t sz , w , h ;
2020-04-29 10:43:22 +00:00
unsigned int bb , bw , bh , bd ;
2020-03-07 09:00:40 +00:00
int mip ;
2021-08-21 18:16:13 +00:00
qbyte * extdata = ( void * ) ( ptr + extofs ) ;
2020-03-07 09:00:40 +00:00
char * extfmt = ( char * ) ( extdata + 4 ) ;
extsize = ( extdata [ 0 ] < < 0 ) | ( extdata [ 1 ] < < 8 ) | ( extdata [ 2 ] < < 16 ) | ( extdata [ 3 ] < < 24 ) ;
if ( extsize < 8 | | extofs + extsize > miptexsize ) break ; //not a valid entry... something weird is happening here
else if ( ! strncmp ( extfmt , " NAME " , 4 ) )
{ //replacement name, for longer shader/external names
size_t sz = extsize - 8 ;
if ( sz > = sizeof ( tx - > name ) )
continue ;
memcpy ( tx - > name , ( qbyte * ) extdata + 8 , sz ) ;
tx - > name [ sz ] = 0 ;
}
else if ( ! strncmp ( extfmt , " LPAL " , 4 ) & & extsize = = 8 + 256 * 3 )
{ //replacement palette for the 8bit data, for feature parity with halflife, but with extra markup so we know its actually meant to be a replacement palette.
pal = extdata + 8 ;
continue ;
}
else if ( extsize < = 16 ) continue ; //too small for an altformat lump
2021-08-19 06:02:10 +00:00
else if ( newfmt ! = PTI_INVALID ) continue ; //only accept the first accepted format (allowing for eg astc+bc1 fallbacks)
2020-03-07 09:00:40 +00:00
else if ( ! strncmp ( extfmt , " RGBA " , 4 ) ) newfmt = PTI_RGBA8 ; //32bpp, we don't normally need this alpha precision (padding can be handy though, for the lazy).
2021-08-05 16:49:25 +00:00
else if ( ! strncmp ( extfmt , " RGBX " , 4 ) ) newfmt = PTI_RGBX8 ; //32bpp, we don't normally need this alpha precision (padding can be handy though, for the lazy).
2020-03-07 09:00:40 +00:00
else if ( ! strncmp ( extfmt , " RGB " , 4 ) ) newfmt = PTI_RGB8 ; //24bpp
else if ( ! strncmp ( extfmt , " 565 " , 4 ) ) newfmt = PTI_RGB565 ; //16bpp
2020-04-19 01:23:32 +00:00
else if ( ! strncmp ( extfmt , " 4444 " , 4 ) ) newfmt = PTI_RGBA4444 ; //16bpp
2020-03-07 09:00:40 +00:00
else if ( ! strncmp ( extfmt , " 5551 " , 4 ) ) newfmt = PTI_RGBA5551 ; //16bpp
2020-04-19 01:23:32 +00:00
else if ( ! strncmp ( extfmt , " LUM8 " , 4 ) ) newfmt = PTI_L8 ; //8bpp
2020-03-07 09:00:40 +00:00
else if ( ! strncmp ( extfmt , " EXP5 " , 4 ) ) newfmt = PTI_E5BGR9 ; //32bpp, we don't normally need this alpha precision...
else if ( ! strncmp ( extfmt , " BC1 " , 4 ) ) newfmt = PTI_BC1_RGBA ; //4bpp
else if ( ! strncmp ( extfmt , " BC2 " , 4 ) ) newfmt = PTI_BC2_RGBA ; //8bpp, we don't normally need this alpha precision...
else if ( ! strncmp ( extfmt , " BC3 " , 4 ) ) newfmt = PTI_BC3_RGBA ; //8bpp, we don't normally need this alpha precision...
else if ( ! strncmp ( extfmt , " BC4 " , 4 ) ) newfmt = PTI_BC4_R ; //4bpp, wtf
else if ( ! strncmp ( extfmt , " BC5 " , 4 ) ) newfmt = PTI_BC5_RG ; //8bpp, wtf
else if ( ! strncmp ( extfmt , " BC6 " , 4 ) ) newfmt = PTI_BC6_RGB_UFLOAT ; //8bpp, weird
else if ( ! strncmp ( extfmt , " BC7 " , 4 ) ) newfmt = PTI_BC7_RGBA ; //8bpp
else if ( ! strncmp ( extfmt , " AST4 " , 4 ) ) newfmt = PTI_ASTC_4X4_LDR ; //8 bpp
else if ( ! strncmp ( extfmt , " AS54 " , 4 ) ) newfmt = PTI_ASTC_5X4_LDR ; //6.40bpp
else if ( ! strncmp ( extfmt , " AST5 " , 4 ) ) newfmt = PTI_ASTC_5X5_LDR ; //5.12bpp
else if ( ! strncmp ( extfmt , " AS65 " , 4 ) ) newfmt = PTI_ASTC_6X5_LDR ; //4.17bpp
else if ( ! strncmp ( extfmt , " AST6 " , 4 ) ) newfmt = PTI_ASTC_6X6_LDR ; //3.56bpp
else if ( ! strncmp ( extfmt , " AS85 " , 4 ) ) newfmt = PTI_ASTC_8X5_LDR ; //3.20bpp
else if ( ! strncmp ( extfmt , " AS86 " , 4 ) ) newfmt = PTI_ASTC_8X6_LDR ; //2.67bpp
else if ( ! strncmp ( extfmt , " AS05 " , 4 ) ) newfmt = PTI_ASTC_10X5_LDR ; //2.56bpp
else if ( ! strncmp ( extfmt , " AS06 " , 4 ) ) newfmt = PTI_ASTC_10X6_LDR ; //2.13bpp
else if ( ! strncmp ( extfmt , " AST8 " , 4 ) ) newfmt = PTI_ASTC_8X8_LDR ; //2 bpp
else if ( ! strncmp ( extfmt , " AS08 " , 4 ) ) newfmt = PTI_ASTC_10X8_LDR ; //1.60bpp
else if ( ! strncmp ( extfmt , " AS00 " , 4 ) ) newfmt = PTI_ASTC_10X10_LDR ; //1.28bpp
else if ( ! strncmp ( extfmt , " AS20 " , 4 ) ) newfmt = PTI_ASTC_12X10_LDR ; //1.07bpp
else if ( ! strncmp ( extfmt , " AST2 " , 4 ) ) newfmt = PTI_ASTC_12X12_LDR ; //0.89bpp
else if ( ! strncmp ( extfmt , " ETC1 " , 4 ) ) newfmt = PTI_ETC1_RGB8 ; //4bpp
else if ( ! strncmp ( extfmt , " ETC2 " , 4 ) ) newfmt = PTI_ETC2_RGB8 ; //4bpp
else if ( ! strncmp ( extfmt , " ETCP " , 4 ) ) newfmt = PTI_ETC2_RGB8A1 ; //4bpp
else if ( ! strncmp ( extfmt , " ETCA " , 4 ) ) newfmt = PTI_ETC2_RGB8A8 ; //8bpp, we don't normally need this alpha precision...
else continue ; //dunno what that is, ignore it
//alternative textures are usually compressed
//this means we insist on a FULL mip chain
//npot mips are explicitly round-down (but don't drop to 0 with non-square).
2020-04-29 10:43:22 +00:00
Image_BlockSizeForEncoding ( newfmt , & bb , & bw , & bh , & bd ) ;
2020-03-07 09:00:40 +00:00
neww = ( extdata [ 8 ] < < 0 ) | ( extdata [ 9 ] < < 8 ) | ( extdata [ 10 ] < < 16 ) | ( extdata [ 11 ] < < 24 ) ;
newh = ( extdata [ 12 ] < < 0 ) | ( extdata [ 13 ] < < 8 ) | ( extdata [ 14 ] < < 16 ) | ( extdata [ 15 ] < < 24 ) ;
for ( mip = 0 , w = neww , h = newh , sz = 0 ; w | | h ; mip + + , w > > = 1 , h > > = 1 )
{
w = max ( 1 , w ) ;
h = max ( 1 , h ) ;
sz + = bb *
( ( w + bw - 1 ) / bw ) *
( ( h + bh - 1 ) / bh ) ;
//Support truncation to top-mip only? tempting...
}
if ( extsize ! = 16 + sz )
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Con_Printf ( CON_WARNING " miptex %s (%s) has incomplete mipchain \n " , tx - > name , Image_FormatName ( newfmt ) ) ;
2020-03-07 09:00:40 +00:00
continue ;
}
//make sure we're not going to need to rescale compressed formats.
//gles<3 or gl<2 requires npot inputs for this to work. I guess that means dx9.3+ gpus, so all astc+bc7 but not necessarily all bc1+etc2. oh well.
if ( ! sh_config . texture_non_power_of_two )
{
if ( neww & ( neww - 1 ) )
continue ;
if ( newh & ( newh - 1 ) )
continue ;
}
//make sure its within our limits
if ( ! neww | | ! newh | | neww > sh_config . texture2d_maxsize | | newh > sh_config . texture2d_maxsize )
continue ;
//that our hardware supports it... (Note: FTE can soft-decompress all of the above so this doesn't make too much sense if there's only one)
//if (!sh_config.texfmt[newfmt])
// continue;
//that we can actually use non-paletted data...
if ( r_softwarebanding & & mt - > offsets [ 0 ] )
continue ;
newdata = BZ_Malloc ( sz ) ;
memcpy ( newdata , extdata + 16 , sz ) ;
}
}
if ( newdata )
2013-12-02 14:30:30 +00:00
{
2020-03-07 09:00:40 +00:00
tx - > srcfmt = newfmt | PTI_FULLMIPCHAIN ;
tx - > srcwidth = neww ;
tx - > srcheight = newh ;
tx - > srcdata = newdata ;
2017-02-19 00:15:42 +00:00
tx - > palette = NULL ;
2020-03-07 09:00:40 +00:00
return ;
2013-12-02 14:30:30 +00:00
}
2020-03-08 18:10:50 +00:00
if ( ! mt - > offsets [ 0 ] )
{
tx - > srcfmt = PTI_INVALID ;
tx - > srcwidth = mt - > width ;
tx - > srcheight = mt - > height ;
tx - > srcdata = NULL ;
tx - > palette = NULL ;
return ;
}
2020-03-07 09:00:40 +00:00
if ( pal )
{ //mostly identical, just a specific palette hidden at the end. handle fences elsewhere.
tx - > srcdata = BZ_Malloc ( legacysize + 768 ) ;
tx - > palette = tx - > srcdata + legacysize ;
memcpy ( tx - > palette , pal , 768 ) ;
}
else
{
tx - > srcdata = BZ_Malloc ( legacysize ) ;
tx - > palette = NULL ;
}
2017-02-19 00:15:42 +00:00
2020-03-07 09:00:40 +00:00
if ( tx - > palette )
{ //halflife, probably...
if ( * tx - > name = = ' { ' )
tx - > srcfmt = TF_MIP4_8PAL24_T255 ;
else
tx - > srcfmt = TF_MIP4_8PAL24 ;
}
else
{
if ( * tx - > name = = ' { ' )
tx - > srcfmt = TF_TRANS8 ;
else
tx - > srcfmt = TF_MIP4_SOLID8 ;
}
tx - > srcwidth = mt - > width ;
tx - > srcheight = mt - > height ;
legacysize = 0 ;
2020-03-08 18:10:50 +00:00
for ( m = 0 ; m < 4 ; m + + )
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( mt - > offsets [ m ] & & ( mt - > offsets [ m ] + ( mt - > width > > m ) * ( mt - > height > > m ) < = miptexsize ) )
2021-08-21 18:16:13 +00:00
memcpy ( tx - > srcdata + legacysize , ptr + mt - > offsets [ m ] , ( mt - > width > > m ) * ( mt - > height > > m ) ) ;
2020-03-08 18:10:50 +00:00
else
memset ( tx - > srcdata + legacysize , 0 , ( mt - > width > > m ) * ( mt - > height > > m ) ) ;
legacysize + = ( mt - > width > > m ) * ( mt - > height > > m ) ;
}
2013-12-02 14:30:30 +00:00
}
2017-02-19 00:15:42 +00:00
# endif
2013-12-02 14:30:30 +00:00
2012-07-05 19:42:36 +00:00
/*
2017-02-19 00:15:42 +00:00
= = = = = = = = = = = = = = = = =
Mod_LoadTextures
= = = = = = = = = = = = = = = = =
2012-07-05 19:42:36 +00:00
*/
2021-08-21 18:16:13 +00:00
static qboolean Mod_LoadTextures ( model_t * loadmodel , qbyte * mod_base , lump_t * l , subbsp_t subbsp )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
int i , j , num , max , altmax ;
texture_t * tx , * tx2 ;
texture_t * anims [ 10 ] ;
texture_t * altanims [ 10 ] ;
dmiptexlump_t * m ;
2020-03-07 09:00:40 +00:00
unsigned int * sizes ;
unsigned int e , o ;
2021-08-21 18:16:13 +00:00
int mtsize ;
2015-06-28 00:42:00 +00:00
2017-02-19 00:15:42 +00:00
TRACE ( ( " dbg: Mod_LoadTextures: inittexturedescs \n " ) ) ;
2015-06-28 00:42:00 +00:00
2017-02-19 00:15:42 +00:00
// Mod_InitTextureDescs(loadname);
2015-06-28 00:42:00 +00:00
2017-02-19 00:15:42 +00:00
if ( ! l - > filelen )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
Con_Printf ( CON_WARNING " warning: %s contains no texture data \n " , loadmodel - > name ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > numtextures = 1 ;
loadmodel - > textures = ZG_Malloc ( & loadmodel - > memgroup , 1 * sizeof ( * loadmodel - > textures ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
i = 0 ;
tx = ZG_Malloc ( & loadmodel - > memgroup , sizeof ( texture_t ) ) ;
memcpy ( tx , r_notexture_mip , sizeof ( texture_t ) ) ;
sprintf ( tx - > name , " unnamed%i " , i ) ;
loadmodel - > textures [ i ] = tx ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
return true ;
}
m = ( dmiptexlump_t * ) ( mod_base + l - > fileofs ) ;
m - > nummiptex = LittleLong ( m - > nummiptex ) ;
2023-03-15 18:00:47 +00:00
if ( ( 1 + m - > nummiptex ) * sizeof ( int ) > l - > filelen )
{
Con_Printf ( CON_WARNING " warning: %s contains corrupt texture lump \n " , loadmodel - > name ) ;
return false ;
}
2017-02-19 00:15:42 +00:00
loadmodel - > numtextures = m - > nummiptex ;
loadmodel - > textures = ZG_Malloc ( & loadmodel - > memgroup , m - > nummiptex * sizeof ( * loadmodel - > textures ) ) ;
2020-03-07 09:00:40 +00:00
sizes = alloca ( sizeof ( * sizes ) * m - > nummiptex ) ;
2017-02-19 00:15:42 +00:00
2021-08-21 18:16:13 +00:00
mtsize = subbsp = = sb_quake64 ? sizeof ( q64miptex_t ) : sizeof ( miptex_t ) ;
2020-03-07 09:00:40 +00:00
for ( i = m - > nummiptex , e = l - > filelen ; i - - > 0 ; )
2017-02-19 00:15:42 +00:00
{
2021-08-21 18:16:13 +00:00
qbyte * ptr ;
miptex_t * mt ;
miptex_t tmp ;
int scale ;
2020-03-07 09:00:40 +00:00
o = LittleLong ( m - > dataofs [ i ] ) ;
if ( o > = l - > filelen ) //e1m2, this happens
2012-07-05 19:42:36 +00:00
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
badmip :
2017-02-19 00:15:42 +00:00
tx = ZG_Malloc ( & loadmodel - > memgroup , sizeof ( texture_t ) ) ;
memcpy ( tx , r_notexture_mip , sizeof ( texture_t ) ) ;
sprintf ( tx - > name , " unnamed%i " , i ) ;
loadmodel - > textures [ i ] = tx ;
continue ;
2012-07-05 19:42:36 +00:00
}
2020-03-07 09:00:40 +00:00
if ( o > = e )
e = l - > filelen ; //something doesn't make sense. try to avoid making too many assumptions.
2012-07-05 19:42:36 +00:00
2021-08-21 18:16:13 +00:00
ptr = ( qbyte * ) m + o ;
if ( subbsp = = sb_quake64 )
{
q64miptex_t * q64mt = ( q64miptex_t * ) ptr ;
memcpy ( tmp . name , q64mt - > name , sizeof ( tmp . name ) ) ;
mt = & tmp ;
mt - > width = LittleLong ( q64mt - > width ) ;
mt - > height = LittleLong ( q64mt - > height ) ;
for ( j = 0 ; j < MIPLEVELS ; j + + )
mt - > offsets [ j ] = LittleLong ( q64mt - > offsets [ j ] ) ;
scale = LittleLong ( q64mt - > scale ) ;
}
else
{
mt = ( miptex_t * ) ptr ;
mt - > width = LittleLong ( mt - > width ) ;
mt - > height = LittleLong ( mt - > height ) ;
for ( j = 0 ; j < MIPLEVELS ; j + + )
mt - > offsets [ j ] = LittleLong ( mt - > offsets [ j ] ) ;
}
TRACE ( ( " dbg: Mod_LoadTextures: texture %s \n " , mt - > name ) ) ;
2012-07-05 19:42:36 +00:00
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( mt - > offsets [ 0 ] & & ( mt - > width > 0xffff | | mt - > height > 0xffff ) )
{
Con_Printf ( CON_WARNING " %s: miptex %i is excessively large. probably corrupt \n " , loadmodel - > name , i ) ;
goto badmip ;
}
2017-02-19 00:15:42 +00:00
if ( ! * mt - > name ) //I HATE MAPPERS!
{
2017-10-31 22:52:58 +00:00
Q_snprintfz ( mt - > name , sizeof ( mt - > name ) , " unnamed%i " , i ) ;
2017-02-19 00:15:42 +00:00
Con_DPrintf ( CON_WARNING " warning: unnamed texture in %s, renaming to %s \n " , loadmodel - > name , mt - > name ) ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
if ( ( mt - > width & 15 ) | | ( mt - > height & 15 ) )
2020-07-21 07:58:54 +00:00
Con_DPrintf ( CON_WARNING " Warning: Texture %s is not 16 aligned " , mt - > name ) ;
2017-02-19 00:15:42 +00:00
if ( mt - > width < 1 | | mt - > height < 1 )
Con_Printf ( CON_WARNING " Warning: Texture %s has no size " , mt - > name ) ;
tx = ZG_Malloc ( & loadmodel - > memgroup , sizeof ( texture_t ) ) ;
loadmodel - > textures [ i ] = tx ;
2012-07-05 19:42:36 +00:00
2018-12-06 05:51:24 +00:00
Q_strncpyz ( tx - > name , mt - > name , min ( sizeof ( mt - > name ) + 1 , sizeof ( tx - > name ) ) ) ;
2020-03-07 09:00:40 +00:00
tx - > vwidth = mt - > width ;
tx - > vheight = mt - > height ;
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_quake64 )
{
tx - > vwidth < < = scale ;
tx - > vheight < < = scale ;
}
2015-01-08 13:09:20 +00:00
2017-02-19 00:15:42 +00:00
# ifndef SERVERONLY
2021-08-21 18:16:13 +00:00
Mod_LoadMiptex ( loadmodel , tx , mt , mtsize , ptr , e - o ) ;
2020-03-07 09:00:40 +00:00
# else
( void ) e ;
2021-08-23 06:36:32 +00:00
( void ) mtsize ;
2017-02-19 00:15:42 +00:00
# endif
2020-03-07 09:00:40 +00:00
e = o ;
2012-09-30 05:52:03 +00:00
}
2017-02-19 00:15:42 +00:00
//
// sequence the animations
//
for ( i = 0 ; i < m - > nummiptex ; i + + )
2012-07-05 19:42:36 +00:00
{
2021-08-21 18:16:13 +00:00
qboolean animvalid = true ;
2017-02-19 00:15:42 +00:00
tx = loadmodel - > textures [ i ] ;
if ( ! tx | | tx - > name [ 0 ] ! = ' + ' )
continue ;
if ( tx - > anim_next )
continue ; // already sequenced
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
// find the number of frames in the animation
memset ( anims , 0 , sizeof ( anims ) ) ;
memset ( altanims , 0 , sizeof ( altanims ) ) ;
max = tx - > name [ 1 ] ;
altmax = 0 ;
if ( max > = ' a ' & & max < = ' z ' )
max - = ' a ' - ' A ' ;
if ( max > = ' 0 ' & & max < = ' 9 ' )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
max - = ' 0 ' ;
altmax = 0 ;
anims [ max ] = tx ;
max + + ;
}
else if ( max > = ' A ' & & max < = ' J ' )
{
altmax = max - ' A ' ;
max = 0 ;
altanims [ altmax ] = tx ;
altmax + + ;
}
else
{
2021-08-21 18:16:13 +00:00
Con_Printf ( CON_WARNING " Bad animating texture name %s \n " , tx - > name ) ;
continue ;
2017-02-19 00:15:42 +00:00
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
for ( j = i + 1 ; j < m - > nummiptex ; j + + )
{
tx2 = loadmodel - > textures [ j ] ;
if ( ! tx2 | | tx2 - > name [ 0 ] ! = ' + ' )
continue ;
if ( strcmp ( tx2 - > name + 2 , tx - > name + 2 ) )
continue ;
num = tx2 - > name [ 1 ] ;
if ( num > = ' a ' & & num < = ' z ' )
num - = ' a ' - ' A ' ;
if ( num > = ' 0 ' & & num < = ' 9 ' )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
num - = ' 0 ' ;
anims [ num ] = tx2 ;
if ( num + 1 > max )
max = num + 1 ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
else if ( num > = ' A ' & & num < = ' J ' )
{
num = num - ' A ' ;
altanims [ num ] = tx2 ;
if ( num + 1 > altmax )
altmax = num + 1 ;
}
else
{
2021-08-21 18:16:13 +00:00
continue ;
2012-07-05 19:42:36 +00:00
}
}
2017-02-19 00:15:42 +00:00
# define ANIM_CYCLE 2
2021-08-21 18:16:13 +00:00
// validate
for ( j = 0 ; j < max ; j + + )
2012-07-05 19:42:36 +00:00
{
2021-08-21 18:16:13 +00:00
if ( ! anims [ j ] )
2017-02-19 00:15:42 +00:00
{
2021-08-21 18:16:13 +00:00
Con_Printf ( CON_WARNING " Missing frame %i of %s \n " , j , tx - > name ) ;
animvalid = false ;
break ;
2017-02-19 00:15:42 +00:00
}
}
2021-08-21 18:16:13 +00:00
for ( j = 0 ; j < altmax & & animvalid ; j + + )
2017-02-19 00:15:42 +00:00
{
2021-08-21 18:16:13 +00:00
if ( ! altanims [ j ] )
2017-02-19 00:15:42 +00:00
{
2021-08-21 18:16:13 +00:00
Con_Printf ( CON_WARNING " Missing alt frame %i of %s \n " , j , tx - > name ) ;
animvalid = false ;
break ;
}
}
// link them all together
if ( animvalid )
{
for ( j = 0 ; j < max ; j + + )
{
tx2 = anims [ j ] ;
tx2 - > anim_total = max * ANIM_CYCLE ;
tx2 - > anim_min = j * ANIM_CYCLE ;
tx2 - > anim_max = ( j + 1 ) * ANIM_CYCLE ;
tx2 - > anim_next = anims [ ( j + 1 ) % max ] ;
if ( altmax )
tx2 - > alternate_anims = altanims [ 0 ] ;
}
for ( j = 0 ; j < altmax ; j + + )
{
tx2 = altanims [ j ] ;
tx2 - > anim_total = altmax * ANIM_CYCLE ;
tx2 - > anim_min = j * ANIM_CYCLE ;
tx2 - > anim_max = ( j + 1 ) * ANIM_CYCLE ;
tx2 - > anim_next = altanims [ ( j + 1 ) % altmax ] ;
if ( max )
tx2 - > alternate_anims = anims [ 0 ] ;
2017-02-19 00:15:42 +00:00
}
2012-07-05 19:42:36 +00:00
}
}
2017-02-19 00:15:42 +00:00
return true ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadSubmodels
= = = = = = = = = = = = = = = = =
*/
static qboolean Mod_LoadSubmodels ( model_t * loadmodel , qbyte * mod_base , lump_t * l , qboolean * hexen2map )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
dq1model_t * inq ;
dh2model_t * inh ;
mmodel_t * out ;
int i , j , count ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
//this is crazy!
inq = ( void * ) ( mod_base + l - > fileofs ) ;
inh = ( void * ) ( mod_base + l - > fileofs ) ;
if ( ! inq - > numfaces )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
* hexen2map = true ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * inh ) ;
if ( l - > filelen % sizeof ( * inh ) | | count > SANITY_LIMIT ( * out ) )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > submodels = out ;
loadmodel - > numsubmodels = count ;
for ( i = 0 ; i < count ; i + + , inh + + , out + + )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
for ( j = 0 ; j < 3 ; j + + )
{ // spread the mins / maxs by a pixel
out - > mins [ j ] = LittleFloat ( inh - > mins [ j ] ) - 1 ;
out - > maxs [ j ] = LittleFloat ( inh - > maxs [ j ] ) + 1 ;
out - > origin [ j ] = LittleFloat ( inh - > origin [ j ] ) ;
2013-08-27 13:18:09 +00:00
}
2017-02-19 00:15:42 +00:00
for ( j = 0 ; j < MAX_MAP_HULLSDH2 ; j + + )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
out - > headnode [ j ] = LittleLong ( inh - > headnode [ j ] ) ;
}
for ( ; j < MAX_MAP_HULLSM ; j + + )
out - > headnode [ j ] = 0 ;
for ( j = 0 ; j < MAX_MAP_HULLSDH2 ; j + + )
out - > hullavailable [ j ] = true ;
for ( ; j < MAX_MAP_HULLSM ; j + + )
out - > hullavailable [ j ] = false ;
out - > visleafs = LittleLong ( inh - > visleafs ) ;
out - > firstface = LittleLong ( inh - > firstface ) ;
out - > numfaces = LittleLong ( inh - > numfaces ) ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
}
else
{
* hexen2map = false ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * inq ) ;
if ( l - > filelen % sizeof ( * inq ) | | count > SANITY_LIMIT ( * out ) )
2017-02-19 00:15:42 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > submodels = out ;
loadmodel - > numsubmodels = count ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < count ; i + + , inq + + , out + + )
{
for ( j = 0 ; j < 3 ; j + + )
{ // spread the mins / maxs by a pixel
out - > mins [ j ] = LittleFloat ( inq - > mins [ j ] ) - 1 ;
out - > maxs [ j ] = LittleFloat ( inq - > maxs [ j ] ) + 1 ;
out - > origin [ j ] = LittleFloat ( inq - > origin [ j ] ) ;
}
for ( j = 0 ; j < MAX_MAP_HULLSDQ1 ; j + + )
{
out - > headnode [ j ] = LittleLong ( inq - > headnode [ j ] ) ;
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
for ( ; j < MAX_MAP_HULLSM ; j + + )
out - > headnode [ j ] = 0 ;
for ( j = 0 ; j < 4 ; j + + )
out - > hullavailable [ j ] = true ;
for ( ; j < MAX_MAP_HULLSM ; j + + )
out - > hullavailable [ j ] = false ;
out - > visleafs = LittleLong ( inq - > visleafs ) ;
out - > firstface = LittleLong ( inq - > firstface ) ;
out - > numfaces = LittleLong ( inq - > numfaces ) ;
2012-07-05 19:42:36 +00:00
}
}
2017-02-19 00:15:42 +00:00
return true ;
2012-07-05 19:42:36 +00:00
}
/*
2017-02-19 00:15:42 +00:00
= = = = = = = = = = = = = = = = =
Mod_LoadTexinfo
= = = = = = = = = = = = = = = = =
2012-07-05 19:42:36 +00:00
*/
2017-02-19 00:15:42 +00:00
static qboolean Mod_LoadTexinfo ( model_t * loadmodel , qbyte * mod_base , lump_t * l )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
texinfo_t * in ;
mtexinfo_t * out ;
int i , j , count ;
int miptex ;
2015-03-03 00:14:43 +00:00
2017-02-19 00:15:42 +00:00
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2015-03-03 00:14:43 +00:00
{
2017-02-19 00:15:42 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
2015-03-03 00:14:43 +00:00
}
2017-02-19 00:15:42 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2015-03-03 00:14:43 +00:00
2017-02-19 00:15:42 +00:00
loadmodel - > texinfo = out ;
loadmodel - > numtexinfo = count ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < count ; i + + , in + + , out + + )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
for ( j = 0 ; j < 4 ; j + + )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
out - > vecs [ 0 ] [ j ] = LittleFloat ( in - > vecs [ 0 ] [ j ] ) ;
out - > vecs [ 1 ] [ j ] = LittleFloat ( in - > vecs [ 1 ] [ j ] ) ;
2012-07-05 19:42:36 +00:00
}
2021-07-01 01:16:29 +00:00
if ( mod_lightscale_broken . ival )
{
out - > vecscale [ 0 ] = 1.0 ;
out - > vecscale [ 1 ] = 1.0 ;
}
else
{
out - > vecscale [ 0 ] = 1.0 / Length ( out - > vecs [ 0 ] ) ;
out - > vecscale [ 1 ] = 1.0 / Length ( out - > vecs [ 1 ] ) ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
miptex = LittleLong ( in - > miptex ) ;
out - > flags = LittleLong ( in - > flags ) ;
if ( loadmodel - > numtextures )
out - > texture = loadmodel - > textures [ miptex % loadmodel - > numtextures ] ;
else
out - > texture = NULL ;
if ( ! out - > texture )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
out - > texture = r_notexture_mip ; // texture not found
out - > flags = 0 ;
}
2018-07-22 11:49:37 +00:00
else
{
if ( * out - > texture - > name = = ' * ' | | ( * out - > texture - > name = = ' ! ' & & loadmodel - > fromgame = = fg_halflife ) ) // turbulent
{
if ( ! ( out - > flags & TEX_SPECIAL ) & & ! strchr ( out - > texture - > name , ' # ' ) )
Q_strncatz ( out - > texture - > name , " #LIT " , sizeof ( out - > texture - > name ) ) ;
}
if ( ! strncmp ( out - > texture - > name , " scroll " , 6 ) | | ( ( * out - > texture - > name = = ' * ' | | * out - > texture - > name = = ' { ' | | * out - > texture - > name = = ' ! ' ) & & ! strncmp ( out - > texture - > name + 1 , " scroll " , 6 ) ) )
out - > flags | = TI_FLOWING ;
}
2017-02-19 00:15:42 +00:00
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
return true ;
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
/*
= = = = = = = = = = = = = = = =
CalcSurfaceExtents
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
Fills in s - > texturemins [ ] and s - > extents [ ]
= = = = = = = = = = = = = = = =
*/
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
void CalcSurfaceExtents ( model_t * mod , msurface_t * s ) ;
/*
{
float mins [ 2 ] , maxs [ 2 ] , val ;
int i , j , e ;
mvertex_t * v ;
mtexinfo_t * tex ;
int bmins [ 2 ] , bmaxs [ 2 ] ;
mins [ 0 ] = mins [ 1 ] = 999999 ;
maxs [ 0 ] = maxs [ 1 ] = - 99999 ;
tex = s - > texinfo ;
for ( i = 0 ; i < s - > numedges ; i + + )
{
e = loadmodel - > surfedges [ s - > firstedge + i ] ;
if ( e > = 0 )
v = & loadmodel - > vertexes [ loadmodel - > edges [ e ] . v [ 0 ] ] ;
else
v = & loadmodel - > vertexes [ loadmodel - > edges [ - e ] . v [ 1 ] ] ;
for ( j = 0 ; j < 2 ; j + + )
{
val = v - > position [ 0 ] * tex - > vecs [ j ] [ 0 ] +
v - > position [ 1 ] * tex - > vecs [ j ] [ 1 ] +
v - > position [ 2 ] * tex - > vecs [ j ] [ 2 ] +
tex - > vecs [ j ] [ 3 ] ;
if ( val < mins [ j ] )
mins [ j ] = val ;
if ( val > maxs [ j ] )
maxs [ j ] = val ;
2012-07-05 19:42:36 +00:00
}
}
2017-02-19 00:15:42 +00:00
for ( i = 0 ; i < 2 ; i + + )
{
bmins [ i ] = floor ( mins [ i ] / 16 ) ;
bmaxs [ i ] = ceil ( maxs [ i ] / 16 ) ;
s - > texturemins [ i ] = bmins [ i ] ;
s - > extents [ i ] = ( bmaxs [ i ] - bmins [ i ] ) ;
// if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 512 ) //q2 uses 512.
// Sys_Error ("Bad surface extents");
}
2012-07-05 19:42:36 +00:00
}
2017-02-19 00:15:42 +00:00
*/
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadFaces
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
static qboolean Mod_LoadFaces ( model_t * loadmodel , bspx_header_t * bspx , qbyte * mod_base , lump_t * l , lump_t * lightlump , subbsp_t subbsp )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
dsface_t * ins ;
dlface_t * inl ;
msurface_t * out ;
int count , surfnum ;
int i , planenum , side ;
int tn ;
unsigned int lofs , lend ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
unsigned short lmshift , lmscale ;
char buf [ 64 ] ;
lightmapoverrides_t overrides ;
2012-07-05 19:42:36 +00:00
2018-03-04 14:41:16 +00:00
int lofsscale = 1 ;
2023-08-01 11:08:51 +00:00
qboolean lightmapusable = false ;
struct decoupled_lm_info_s * decoupledlm ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
size_t dcsize ;
2018-03-04 14:41:16 +00:00
2017-02-19 00:15:42 +00:00
memset ( & overrides , 0 , sizeof ( overrides ) ) ;
lmscale = atoi ( Mod_ParseWorldspawnKey ( loadmodel , " lightmap_scale " , buf , sizeof ( buf ) ) ) ;
if ( ! lmscale )
lmshift = LMSHIFT_DEFAULT ;
else
{
for ( lmshift = 0 ; lmscale > 1 ; lmshift + + )
lmscale > > = 1 ;
}
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long1 | | subbsp = = sb_long2 )
2017-02-19 00:15:42 +00:00
{
ins = NULL ;
inl = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * inl ) ;
if ( l - > filelen % sizeof ( * inl ) | | count > SANITY_LIMIT ( * out ) )
2017-02-19 00:15:42 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
}
else
{
ins = ( void * ) ( mod_base + l - > fileofs ) ;
inl = NULL ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * ins ) ;
if ( l - > filelen % sizeof ( * ins ) | | count > SANITY_LIMIT ( * out ) )
2017-02-19 00:15:42 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
}
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
------------------------------------------------------------------------
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
2017-02-19 00:15:42 +00:00
// *meshlist = ZG_Malloc(&loadmodel->memgroup, count*sizeof(**meshlist));
loadmodel - > surfaces = out ;
loadmodel - > numsurfaces = count ;
2015-09-18 20:30:10 +00:00
2023-07-12 17:05:21 +00:00
Mod_LoadVertexNormals ( loadmodel , bspx , mod_base , NULL ) ;
2021-08-21 18:16:13 +00:00
Mod_LoadLighting ( loadmodel , bspx , mod_base , lightlump , false , & overrides , subbsp ) ;
2012-07-05 19:42:36 +00:00
2023-08-01 11:08:51 +00:00
decoupledlm = BSPX_FindLump ( bspx , mod_base , " DECOUPLED_LM " , & dcsize ) ; //RGB packed data
if ( dcsize = = count * sizeof ( * decoupledlm ) )
loadmodel - > facelmvecs = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * loadmodel - > facelmvecs ) ) ; //seems good.
else
decoupledlm = NULL ; //wrong size somehow... discard it.
2018-03-04 14:41:16 +00:00
switch ( loadmodel - > lightmaps . fmt )
{
case LM_E5BGR9 :
lofsscale = 4 ;
break ;
case LM_RGB8 :
lofsscale = 3 ;
break ;
default :
case LM_L8 :
lofsscale = 1 ;
break ;
}
if ( loadmodel - > fromgame = = fg_halflife )
lofsscale / = 3 ; //halflife has rgb offsets already (this should drop to 1, preserving any misaligned offsets...
2017-02-19 00:15:42 +00:00
for ( surfnum = 0 ; surfnum < count ; surfnum + + , out + + )
2012-07-05 19:42:36 +00:00
{
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long1 | | subbsp = = sb_long2 )
2012-07-05 19:42:36 +00:00
{
2017-02-19 00:15:42 +00:00
planenum = LittleLong ( inl - > planenum ) ;
side = LittleLong ( inl - > side ) ;
out - > firstedge = LittleLong ( inl - > firstedge ) ;
out - > numedges = LittleLong ( inl - > numedges ) ;
tn = LittleLong ( inl - > texinfo ) ;
2019-09-10 15:40:04 +00:00
for ( i = 0 ; i < countof ( out - > styles ) ; i + + )
2019-11-04 17:24:11 +00:00
out - > styles [ i ] = ( i > = countof ( inl - > styles ) | | ( lightstyleindex_t ) inl - > styles [ i ] > = INVALID_LIGHTSTYLE | | inl - > styles [ i ] = = 255 ) ? INVALID_LIGHTSTYLE : inl - > styles [ i ] ;
2017-02-19 00:15:42 +00:00
lofs = LittleLong ( inl - > lightofs ) ;
inl + + ;
2012-07-05 19:42:36 +00:00
}
else
2017-02-19 00:15:42 +00:00
{
planenum = LittleShort ( ins - > planenum ) ;
side = LittleShort ( ins - > side ) ;
out - > firstedge = LittleLong ( ins - > firstedge ) ;
out - > numedges = LittleShort ( ins - > numedges ) ;
tn = LittleShort ( ins - > texinfo ) ;
2019-09-10 15:40:04 +00:00
for ( i = 0 ; i < countof ( out - > styles ) ; i + + )
2019-11-04 17:24:11 +00:00
out - > styles [ i ] = ( i > = countof ( ins - > styles ) | | ( lightstyleindex_t ) ins - > styles [ i ] > = INVALID_LIGHTSTYLE | | ins - > styles [ i ] = = 255 ) ? INVALID_LIGHTSTYLE : ins - > styles [ i ] ;
2017-02-19 00:15:42 +00:00
lofs = LittleLong ( ins - > lightofs ) ;
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_quake64 )
{
lofs > > = 1 ;
}
2017-02-19 00:15:42 +00:00
ins + + ;
}
// (*meshlist)[surfnum].vbofirstvert = out->firstedge;
// (*meshlist)[surfnum].numvertexes = out->numedges;
out - > flags = 0 ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
if ( side )
out - > flags | = SURF_PLANEBACK ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
out - > plane = loadmodel - > planes + planenum ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
if ( tn < 0 | | tn > = loadmodel - > numtexinfo )
{
Con_Printf ( " texinfo 0 <= %i < %i \n " , tn , loadmodel - > numtexinfo ) ;
return false ;
}
out - > texinfo = loadmodel - > texinfo + tn ;
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
if ( overrides . shifts )
out - > lmshift = overrides . shifts [ surfnum ] ;
else
out - > lmshift = lmshift ;
if ( overrides . offsets )
lofs = overrides . offsets [ surfnum ] ;
2019-09-10 15:40:04 +00:00
if ( overrides . styles16 )
{
for ( i = 0 ; i < countof ( out - > styles ) ; i + + )
out - > styles [ i ] = ( i > = overrides . stylesperface ) ? INVALID_LIGHTSTYLE : overrides . styles16 [ surfnum * overrides . stylesperface + i ] ;
}
else if ( overrides . styles8 )
{
for ( i = 0 ; i < countof ( out - > styles ) ; i + + )
2019-11-04 17:24:11 +00:00
out - > styles [ i ] = ( i > = overrides . stylesperface ) ? INVALID_LIGHTSTYLE : ( ( overrides . styles8 [ surfnum * overrides . stylesperface + i ] = = 255 ) ? INVALID_LIGHTSTYLE : overrides . styles8 [ surfnum * overrides . stylesperface + i ] ) ;
2019-09-10 15:40:04 +00:00
}
for ( i = 0 ; i < countof ( out - > styles ) & & out - > styles [ i ] ! = INVALID_LIGHTSTYLE ; i + + )
if ( loadmodel - > lightmaps . maxstyle < out - > styles [ i ] )
loadmodel - > lightmaps . maxstyle = out - > styles [ i ] ;
2012-07-05 19:42:36 +00:00
2023-08-01 11:08:51 +00:00
if ( decoupledlm )
{
lofs = LittleLong ( decoupledlm - > lmoffset ) ;
out - > texturemins [ 0 ] = out - > texturemins [ 1 ] = 0 ; // should be handled by the now-per-surface vecs[][3] value.
out - > lmshift = 0 ; //redundant.
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( ! decoupledlm - > lmsize [ 0 ] | | ! decoupledlm - > lmsize [ 1 ] )
{
decoupledlm - > lmsize [ 0 ] = decoupledlm - > lmsize [ 1 ] = 0 ;
if ( lofs ! = ( unsigned int ) - 1 )
{ //we'll silently allow these buggy surfaces for now... but only if they've got no lightmap data at all. unsafe if they're the last otherwise.
lofs = - 1 ;
Con_Printf ( CON_WARNING " %s: Face %i has invalid extents \n " , loadmodel - > name , surfnum ) ;
}
}
else
{
out - > extents [ 0 ] = ( unsigned short ) LittleShort ( decoupledlm - > lmsize [ 0 ] ) - 1 ; //surfaces should NEVER have an extent of 0. even if the surface is omitted it should still have some padding...
out - > extents [ 1 ] = ( unsigned short ) LittleShort ( decoupledlm - > lmsize [ 1 ] ) - 1 ;
}
2023-08-01 11:08:51 +00:00
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 0 ] [ 0 ] = LittleFloat ( decoupledlm - > lmvecs [ 0 ] [ 0 ] ) ;
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 0 ] [ 1 ] = LittleFloat ( decoupledlm - > lmvecs [ 0 ] [ 1 ] ) ;
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 0 ] [ 2 ] = LittleFloat ( decoupledlm - > lmvecs [ 0 ] [ 2 ] ) ;
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 0 ] [ 3 ] = LittleFloat ( decoupledlm - > lmvecs [ 0 ] [ 3 ] ) + 0.5f ; //sigh
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 1 ] [ 0 ] = LittleFloat ( decoupledlm - > lmvecs [ 1 ] [ 0 ] ) ;
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 1 ] [ 1 ] = LittleFloat ( decoupledlm - > lmvecs [ 1 ] [ 1 ] ) ;
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 1 ] [ 2 ] = LittleFloat ( decoupledlm - > lmvecs [ 1 ] [ 2 ] ) ;
loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 1 ] [ 3 ] = LittleFloat ( decoupledlm - > lmvecs [ 1 ] [ 3 ] ) + 0.5f ; //sigh
loadmodel - > facelmvecs [ surfnum ] . lmvecscale [ 0 ] = 1.0f / Length ( loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 0 ] ) ; //luxels->qu
loadmodel - > facelmvecs [ surfnum ] . lmvecscale [ 1 ] = 1.0f / Length ( loadmodel - > facelmvecs [ surfnum ] . lmvecs [ 1 ] ) ;
decoupledlm + + ;
}
else
CalcSurfaceExtents ( loadmodel , out ) ;
2018-03-04 14:41:16 +00:00
if ( lofs ! = ( unsigned int ) - 1 )
lofs * = lofsscale ;
2023-08-01 11:08:51 +00:00
lend = lofs + ( out - > extents [ 0 ] + 1 ) * ( out - > extents [ 1 ] + 1 ) /*FIXME: mul by numstyles */ ;
2017-02-19 00:15:42 +00:00
if ( lofs > loadmodel - > lightdatasize | | lend < lofs )
out - > samples = NULL ; //should includes -1
else
2023-08-01 11:08:51 +00:00
{
2017-02-19 00:15:42 +00:00
out - > samples = loadmodel - > lightdata + lofs ;
2023-08-01 11:08:51 +00:00
lightmapusable = true ; //something has a valid offset.
}
2012-07-05 19:42:36 +00:00
2017-02-19 00:15:42 +00:00
if ( ! out - > texinfo - > texture )
continue ;
2004-08-22 22:29:09 +00:00
2021-10-05 05:05:43 +00:00
if ( out - > numedges < 3 )
Con_Printf ( CON_WARNING " %s: Face %i has only %i edge(s) - \" %s \" . \n " , loadmodel - > name , surfnum , out - > numedges , out - > texinfo - > texture - > name ) ;
2017-02-19 00:15:42 +00:00
// set the drawing flags flag
if ( ! Q_strncmp ( out - > texinfo - > texture - > name , " sky " , 3 ) ) // sky
{
out - > flags | = ( SURF_DRAWSKY | SURF_DRAWTILED ) ;
continue ;
}
if ( * out - > texinfo - > texture - > name = = ' * ' | | ( * out - > texinfo - > texture - > name = = ' ! ' & & loadmodel - > fromgame = = fg_halflife ) ) // turbulent
{
2018-07-22 11:49:37 +00:00
out - > flags | = SURF_DRAWTURB ;
if ( out - > texinfo - > flags & TEX_SPECIAL )
2017-02-19 00:15:42 +00:00
{
2018-07-22 11:49:37 +00:00
out - > flags | = SURF_DRAWTILED ;
for ( i = 0 ; i < 2 ; i + + )
{
out - > extents [ i ] = 16384 ;
out - > texturemins [ i ] = - 8192 ;
}
2017-02-19 00:15:42 +00:00
}
continue ;
}
/*if (*out->texinfo->texture->name == '~')
{
out - > texinfo - > flags | = SURF_BLENDED ;
continue ;
} */
if ( ! Q_strncmp ( out - > texinfo - > texture - > name , " { " , 1 ) ) // alpha
{
out - > flags | = ( SURF_DRAWALPHA ) ;
continue ;
}
2020-03-29 18:37:10 +00:00
2017-02-19 00:15:42 +00:00
if ( out - > flags & SURF_DRAWALPHA )
out - > flags & = ~ SURF_DRAWALPHA ;
}
2023-08-01 11:08:51 +00:00
if ( ! lightmapusable )
{
Con_Printf ( " no valid lightmap offsets in map \n " ) ;
# ifdef RUNTIMELIGHTING
RelightTerminate ( loadmodel ) ; //not gonna work...
# endif
loadmodel - > lightdata = NULL ;
loadmodel - > deluxdata = NULL ;
}
2017-02-19 00:15:42 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadNodes
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
static qboolean Mod_LoadNodes ( model_t * loadmodel , qbyte * mod_base , lump_t * l , subbsp_t subbsp )
2004-08-22 22:29:09 +00:00
{
int i , j , count , p ;
mnode_t * out ;
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long2 )
2012-09-30 05:52:03 +00:00
{
dl2node_t * in ;
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2012-09-30 05:52:03 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2012-09-30 05:52:03 +00:00
loadmodel - > nodes = out ;
loadmodel - > numnodes = count ;
for ( i = 0 ; i < count ; i + + , in + + , out + + )
{
for ( j = 0 ; j < 3 ; j + + )
{
out - > minmaxs [ j ] = LittleFloat ( in - > mins [ j ] ) ;
out - > minmaxs [ 3 + j ] = LittleFloat ( in - > maxs [ j ] ) ;
}
p = LittleLong ( in - > planenum ) ;
out - > plane = loadmodel - > planes + p ;
out - > firstsurface = LittleLong ( in - > firstface ) ;
out - > numsurfaces = LittleLong ( in - > numfaces ) ;
for ( j = 0 ; j < 2 ; j + + )
{
p = LittleLong ( in - > children [ j ] ) ;
if ( p > = 0 )
out - > children [ j ] = loadmodel - > nodes + p ;
else
out - > children [ j ] = ( mnode_t * ) ( loadmodel - > leafs + ( - 1 - p ) ) ;
}
}
}
2021-08-21 18:16:13 +00:00
else if ( subbsp = = sb_long1 )
2006-03-12 22:01:49 +00:00
{
2012-09-30 05:52:03 +00:00
dl1node_t * in ;
2011-10-27 16:16:29 +00:00
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2011-10-27 16:16:29 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
loadmodel - > nodes = out ;
loadmodel - > numnodes = count ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < count ; i + + , in + + , out + + )
{
for ( j = 0 ; j < 3 ; j + + )
{
out - > minmaxs [ j ] = LittleShort ( in - > mins [ j ] ) ;
out - > minmaxs [ 3 + j ] = LittleShort ( in - > maxs [ j ] ) ;
}
p = LittleLong ( in - > planenum ) ;
out - > plane = loadmodel - > planes + p ;
out - > firstsurface = LittleLong ( in - > firstface ) ;
out - > numsurfaces = LittleLong ( in - > numfaces ) ;
2017-01-13 00:39:50 +00:00
2011-10-27 16:16:29 +00:00
for ( j = 0 ; j < 2 ; j + + )
{
2011-12-05 15:23:40 +00:00
p = LittleLong ( in - > children [ j ] ) ;
2011-10-27 16:16:29 +00:00
if ( p > = 0 )
out - > children [ j ] = loadmodel - > nodes + p ;
else
out - > children [ j ] = ( mnode_t * ) ( loadmodel - > leafs + ( - 1 - p ) ) ;
}
}
}
else
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
dsnode_t * in ;
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
2004-08-22 22:29:09 +00:00
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
loadmodel - > nodes = out ;
loadmodel - > numnodes = count ;
for ( i = 0 ; i < count ; i + + , in + + , out + + )
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
for ( j = 0 ; j < 3 ; j + + )
{
out - > minmaxs [ j ] = LittleShort ( in - > mins [ j ] ) ;
out - > minmaxs [ 3 + j ] = LittleShort ( in - > maxs [ j ] ) ;
}
p = LittleLong ( in - > planenum ) ;
out - > plane = loadmodel - > planes + p ;
2012-09-30 05:52:03 +00:00
out - > firstsurface = ( unsigned short ) LittleShort ( in - > firstface ) ;
out - > numsurfaces = ( unsigned short ) LittleShort ( in - > numfaces ) ;
2017-01-13 00:39:50 +00:00
2011-10-27 16:16:29 +00:00
for ( j = 0 ; j < 2 ; j + + )
{
2017-08-29 02:29:06 +00:00
p = ( unsigned short ) LittleShort ( in - > children [ j ] ) ;
if ( p > = 0 & & p < loadmodel - > numnodes )
2011-10-27 16:16:29 +00:00
out - > children [ j ] = loadmodel - > nodes + p ;
else
2017-08-29 02:29:06 +00:00
{
p = ( - 1 - ( signed ) ( 0xffff0000 | p ) ) ;
if ( p > = 0 & & p < loadmodel - > numleafs )
out - > children [ j ] = ( mnode_t * ) ( loadmodel - > leafs + p ) ;
else
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: invalid node child %i in %s \n " , LittleShort ( in - > children [ j ] ) , loadmodel - > name ) ;
return false ;
}
}
2011-10-27 16:16:29 +00:00
}
2004-08-22 22:29:09 +00:00
}
}
2013-07-14 12:22:51 +00:00
Mod_SetParent ( loadmodel - > nodes , NULL ) ; // sets nodes and leafs
2006-03-12 22:01:49 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadLeafs
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
static qboolean Mod_LoadLeafs ( model_t * loadmodel , qbyte * mod_base , lump_t * l , subbsp_t subbsp , qboolean isnotmap , qbyte * ptr , size_t len )
2004-08-22 22:29:09 +00:00
{
mleaf_t * out ;
int i , j , count , p ;
2014-09-08 23:47:19 +00:00
if ( ! ptr )
{
ptr = mod_base + l - > fileofs ;
len = l - > filelen ;
}
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long2 )
2006-03-12 22:01:49 +00:00
{
2012-09-30 05:52:03 +00:00
dl2leaf_t * in ;
2014-09-08 23:47:19 +00:00
in = ( void * ) ptr ;
count = len / sizeof ( * in ) ;
2019-05-23 19:06:04 +00:00
if ( len % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2013-12-29 22:48:28 +00:00
{
2019-05-23 19:06:04 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
2013-12-29 22:48:28 +00:00
return false ;
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2012-09-30 05:52:03 +00:00
loadmodel - > leafs = out ;
loadmodel - > numleafs = count ;
2014-05-23 02:02:51 +00:00
loadmodel - > numclusters = count - 1 ;
2017-06-21 01:24:25 +00:00
loadmodel - > pvsbytes = ( ( loadmodel - > numclusters + 31 ) > > 3 ) & ~ 3 ;
2012-09-30 05:52:03 +00:00
for ( i = 0 ; i < count ; i + + , in + + , out + + )
{
for ( j = 0 ; j < 3 ; j + + )
{
out - > minmaxs [ j ] = LittleFloat ( in - > mins [ j ] ) ;
out - > minmaxs [ 3 + j ] = LittleFloat ( in - > maxs [ j ] ) ;
}
p = LittleLong ( in - > contents ) ;
out - > contents = p ;
out - > firstmarksurface = loadmodel - > marksurfaces +
LittleLong ( in - > firstmarksurface ) ;
out - > nummarksurfaces = LittleLong ( in - > nummarksurfaces ) ;
p = LittleLong ( in - > visofs ) ;
if ( p = = - 1 )
out - > compressed_vis = NULL ;
else
out - > compressed_vis = loadmodel - > visdata + p ;
for ( j = 0 ; j < 4 ; j + + )
out - > ambient_sound_level [ j ] = in - > ambient_level [ j ] ;
# ifndef CLIENTONLY
if ( ! isDedicated )
# endif
{
// gl underwater warp
if ( out - > contents ! = Q1CONTENTS_EMPTY )
{
for ( j = 0 ; j < out - > nummarksurfaces ; j + + )
out - > firstmarksurface [ j ] - > flags | = SURF_UNDERWATER ;
}
if ( isnotmap )
{
for ( j = 0 ; j < out - > nummarksurfaces ; j + + )
out - > firstmarksurface [ j ] - > flags | = SURF_DONTWARP ;
}
}
}
}
2021-08-21 18:16:13 +00:00
else if ( subbsp = = sb_long1 )
2012-09-30 05:52:03 +00:00
{
dl1leaf_t * in ;
2014-09-08 23:47:19 +00:00
in = ( void * ) ( ptr ) ;
count = len / sizeof ( * in ) ;
2019-05-23 19:06:04 +00:00
if ( len % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2013-12-29 22:48:28 +00:00
{
2019-05-23 19:06:04 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
2013-12-29 22:48:28 +00:00
return false ;
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
loadmodel - > leafs = out ;
loadmodel - > numleafs = count ;
2014-05-23 02:02:51 +00:00
loadmodel - > numclusters = count - 1 ;
2017-06-21 01:24:25 +00:00
loadmodel - > pvsbytes = ( ( loadmodel - > numclusters + 31 ) > > 3 ) & ~ 3 ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < count ; i + + , in + + , out + + )
{
for ( j = 0 ; j < 3 ; j + + )
{
out - > minmaxs [ j ] = LittleShort ( in - > mins [ j ] ) ;
out - > minmaxs [ 3 + j ] = LittleShort ( in - > maxs [ j ] ) ;
}
p = LittleLong ( in - > contents ) ;
out - > contents = p ;
out - > firstmarksurface = loadmodel - > marksurfaces +
LittleLong ( in - > firstmarksurface ) ;
out - > nummarksurfaces = LittleLong ( in - > nummarksurfaces ) ;
p = LittleLong ( in - > visofs ) ;
if ( p = = - 1 )
out - > compressed_vis = NULL ;
else
out - > compressed_vis = loadmodel - > visdata + p ;
for ( j = 0 ; j < 4 ; j + + )
out - > ambient_sound_level [ j ] = in - > ambient_level [ j ] ;
# ifndef CLIENTONLY
if ( ! isDedicated )
# endif
{
// gl underwater warp
if ( out - > contents ! = Q1CONTENTS_EMPTY )
{
for ( j = 0 ; j < out - > nummarksurfaces ; j + + )
out - > firstmarksurface [ j ] - > flags | = SURF_UNDERWATER ;
}
if ( isnotmap )
{
for ( j = 0 ; j < out - > nummarksurfaces ; j + + )
out - > firstmarksurface [ j ] - > flags | = SURF_DONTWARP ;
}
}
}
}
else
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
dsleaf_t * in ;
2014-09-08 23:47:19 +00:00
in = ( void * ) ( ptr ) ;
count = len / sizeof ( * in ) ;
2019-05-23 19:06:04 +00:00
if ( len % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2013-12-29 22:48:28 +00:00
{
2019-05-23 19:06:04 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
2013-12-29 22:48:28 +00:00
return false ;
}
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
loadmodel - > leafs = out ;
loadmodel - > numleafs = count ;
2014-05-23 02:02:51 +00:00
loadmodel - > numclusters = count - 1 ;
2017-06-21 01:24:25 +00:00
loadmodel - > pvsbytes = ( ( loadmodel - > numclusters + 31 ) > > 3 ) & ~ 3 ;
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < count ; i + + , in + + , out + + )
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
for ( j = 0 ; j < 3 ; j + + )
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
out - > minmaxs [ j ] = LittleShort ( in - > mins [ j ] ) ;
out - > minmaxs [ 3 + j ] = LittleShort ( in - > maxs [ j ] ) ;
2004-08-22 22:29:09 +00:00
}
2011-10-27 16:16:29 +00:00
p = LittleLong ( in - > contents ) ;
out - > contents = p ;
2014-10-11 19:39:45 +00:00
out - > firstmarksurface = loadmodel - > marksurfaces + ( unsigned short ) LittleShort ( in - > firstmarksurface ) ;
2011-10-27 16:16:29 +00:00
out - > nummarksurfaces = ( unsigned short ) LittleShort ( in - > nummarksurfaces ) ;
p = LittleLong ( in - > visofs ) ;
if ( p = = - 1 )
out - > compressed_vis = NULL ;
else
out - > compressed_vis = loadmodel - > visdata + p ;
for ( j = 0 ; j < 4 ; j + + )
out - > ambient_sound_level [ j ] = in - > ambient_level [ j ] ;
# ifndef CLIENTONLY
if ( ! isDedicated )
# endif
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
// gl underwater warp
if ( out - > contents ! = Q1CONTENTS_EMPTY )
{
for ( j = 0 ; j < out - > nummarksurfaces ; j + + )
out - > firstmarksurface [ j ] - > flags | = SURF_UNDERWATER ;
}
if ( isnotmap )
{
for ( j = 0 ; j < out - > nummarksurfaces ; j + + )
out - > firstmarksurface [ j ] - > flags | = SURF_DONTWARP ;
}
2004-08-22 22:29:09 +00:00
}
}
2011-10-27 16:16:29 +00:00
}
2006-03-12 22:01:49 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadClipnodes
= = = = = = = = = = = = = = = = =
*/
2021-08-21 18:16:13 +00:00
static qboolean Mod_LoadClipnodes ( model_t * loadmodel , qbyte * mod_base , lump_t * l , subbsp_t subbsp , qboolean hexen2map )
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
dsclipnode_t * ins ;
2011-12-05 15:23:40 +00:00
dlclipnode_t * inl ;
2011-06-29 18:39:11 +00:00
mclipnode_t * out ;
2004-08-22 22:29:09 +00:00
int i , count ;
hull_t * hull ;
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long1 | | subbsp = = sb_long2 )
2006-03-12 22:01:49 +00:00
{
2011-10-27 16:16:29 +00:00
ins = NULL ;
inl = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * inl ) ;
if ( l - > filelen % sizeof ( * inl ) | | count > SANITY_LIMIT ( * out ) )
2011-10-27 16:16:29 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
}
else
{
ins = ( void * ) ( mod_base + l - > fileofs ) ;
inl = NULL ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * ins ) ;
if ( l - > filelen % sizeof ( * ins ) | | count > SANITY_LIMIT ( * out ) )
2011-10-27 16:16:29 +00:00
{
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
return false ;
}
2021-12-20 10:08:01 +00:00
if ( count > ( 1u < < 16 ) )
{
Con_Printf ( CON_ERROR " %s: clipnode count exceeds 16bit limit (%u). Try bsp2. \n " , loadmodel - > name , count ) ;
return false ;
}
2006-03-12 22:01:49 +00:00
}
2021-08-14 04:04:01 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ; //space for both
2004-08-22 22:29:09 +00:00
loadmodel - > clipnodes = out ;
2021-08-14 04:04:01 +00:00
loadmodel - > numclipnodes = count ;
2004-08-22 22:29:09 +00:00
if ( hexen2map )
{ //hexen2.
2018-08-09 06:21:39 +00:00
//compatible with Q1.
2004-08-22 22:29:09 +00:00
hull = & loadmodel - > hulls [ 1 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 16 ;
hull - > clip_mins [ 1 ] = - 16 ;
hull - > clip_mins [ 2 ] = - 24 ;
hull - > clip_maxs [ 0 ] = 16 ;
hull - > clip_maxs [ 1 ] = 16 ;
hull - > clip_maxs [ 2 ] = 32 ;
hull - > available = true ;
2018-08-09 06:21:39 +00:00
//NOT compatible with Q1
2004-08-22 22:29:09 +00:00
hull = & loadmodel - > hulls [ 2 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 24 ;
hull - > clip_mins [ 1 ] = - 24 ;
hull - > clip_mins [ 2 ] = - 20 ;
hull - > clip_maxs [ 0 ] = 24 ;
hull - > clip_maxs [ 1 ] = 24 ;
hull - > clip_maxs [ 2 ] = 20 ;
hull - > available = true ;
hull = & loadmodel - > hulls [ 3 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 16 ;
hull - > clip_mins [ 1 ] = - 16 ;
hull - > clip_mins [ 2 ] = - 12 ;
hull - > clip_maxs [ 0 ] = 16 ;
hull - > clip_maxs [ 1 ] = 16 ;
hull - > clip_maxs [ 2 ] = 16 ;
hull - > available = true ;
2010-08-18 21:59:06 +00:00
/*
There is some mission - pack weirdness here
in the missionpack , hull 4 is meant to be ' - 8 - 8 - 8 ' ' 8 8 8 '
in the original game , hull 4 is ' - 40 - 40 - 42 ' ' 40 40 42 '
*/
2004-08-22 22:29:09 +00:00
hull = & loadmodel - > hulls [ 4 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
2010-08-18 21:59:06 +00:00
hull - > clip_mins [ 0 ] = - 8 ;
hull - > clip_mins [ 1 ] = - 8 ;
hull - > clip_mins [ 2 ] = - 8 ;
hull - > clip_maxs [ 0 ] = 8 ;
hull - > clip_maxs [ 1 ] = 8 ;
hull - > clip_maxs [ 2 ] = 8 ;
2004-08-22 22:29:09 +00:00
hull - > available = true ;
hull = & loadmodel - > hulls [ 5 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 48 ;
hull - > clip_mins [ 1 ] = - 48 ;
2010-08-18 21:59:06 +00:00
hull - > clip_mins [ 2 ] = - 50 ;
2004-08-22 22:29:09 +00:00
hull - > clip_maxs [ 0 ] = 48 ;
hull - > clip_maxs [ 1 ] = 48 ;
hull - > clip_maxs [ 2 ] = 50 ;
hull - > available = true ;
2008-11-09 22:29:28 +00:00
//6 isn't used.
//7 isn't used.
2004-08-22 22:29:09 +00:00
}
else if ( loadmodel - > fromgame = = fg_halflife )
{
hull = & loadmodel - > hulls [ 1 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 16 ;
hull - > clip_mins [ 1 ] = - 16 ;
2009-04-01 22:03:56 +00:00
hull - > clip_mins [ 2 ] = - 36 ; //-36 is correct here, but mvdsv uses -32 instead. This breaks prediction between the two
2004-08-22 22:29:09 +00:00
hull - > clip_maxs [ 0 ] = 16 ;
hull - > clip_maxs [ 1 ] = 16 ;
2008-11-09 22:29:28 +00:00
hull - > clip_maxs [ 2 ] = hull - > clip_mins [ 2 ] + 72 ;
2004-08-22 22:29:09 +00:00
hull - > available = true ;
hull = & loadmodel - > hulls [ 2 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 32 ;
hull - > clip_mins [ 1 ] = - 32 ;
hull - > clip_mins [ 2 ] = - 32 ;
hull - > clip_maxs [ 0 ] = 32 ;
hull - > clip_maxs [ 1 ] = 32 ;
2008-11-09 22:29:28 +00:00
hull - > clip_maxs [ 2 ] = hull - > clip_mins [ 2 ] + 64 ;
2004-08-22 22:29:09 +00:00
hull - > available = true ;
hull = & loadmodel - > hulls [ 3 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 16 ;
hull - > clip_mins [ 1 ] = - 16 ;
hull - > clip_mins [ 2 ] = - 18 ;
hull - > clip_maxs [ 0 ] = 16 ;
hull - > clip_maxs [ 1 ] = 16 ;
2008-11-09 22:29:28 +00:00
hull - > clip_maxs [ 2 ] = hull - > clip_mins [ 2 ] + 36 ;
2004-08-22 22:29:09 +00:00
hull - > available = true ;
}
else
{
hull = & loadmodel - > hulls [ 1 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 16 ;
hull - > clip_mins [ 1 ] = - 16 ;
hull - > clip_mins [ 2 ] = - 24 ;
hull - > clip_maxs [ 0 ] = 16 ;
hull - > clip_maxs [ 1 ] = 16 ;
hull - > clip_maxs [ 2 ] = 32 ;
hull - > available = true ;
hull = & loadmodel - > hulls [ 2 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 32 ;
hull - > clip_mins [ 1 ] = - 32 ;
hull - > clip_mins [ 2 ] = - 24 ;
hull - > clip_maxs [ 0 ] = 32 ;
hull - > clip_maxs [ 1 ] = 32 ;
hull - > clip_maxs [ 2 ] = 64 ;
hull - > available = true ;
hull = & loadmodel - > hulls [ 3 ] ;
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
hull - > clip_mins [ 0 ] = - 16 ;
hull - > clip_mins [ 1 ] = - 16 ;
hull - > clip_mins [ 2 ] = - 6 ;
hull - > clip_maxs [ 0 ] = 16 ;
hull - > clip_maxs [ 1 ] = 16 ;
hull - > clip_maxs [ 2 ] = 30 ;
hull - > available = false ;
}
2021-08-21 18:16:13 +00:00
if ( subbsp = = sb_long1 | | subbsp = = sb_long2 )
2011-07-30 14:14:56 +00:00
{
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < count ; i + + , out + + , inl + + )
2011-07-30 14:14:56 +00:00
{
2011-10-27 16:16:29 +00:00
out - > planenum = LittleLong ( inl - > planenum ) ;
out - > children [ 0 ] = LittleLong ( inl - > children [ 0 ] ) ;
out - > children [ 1 ] = LittleLong ( inl - > children [ 1 ] ) ;
2011-07-30 14:14:56 +00:00
}
}
else
2004-08-22 22:29:09 +00:00
{
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < count ; i + + , out + + , ins + + )
2011-07-30 14:14:56 +00:00
{
2011-10-27 16:16:29 +00:00
out - > planenum = LittleLong ( ins - > planenum ) ;
2014-10-11 19:39:45 +00:00
out - > children [ 0 ] = ( unsigned short ) LittleShort ( ins - > children [ 0 ] ) ;
out - > children [ 1 ] = ( unsigned short ) LittleShort ( ins - > children [ 1 ] ) ;
//if these 'overflow', then they're meant to refer to contents instead, and should be negative
if ( out - > children [ 0 ] > = count )
out - > children [ 0 ] - = 0x10000 ;
if ( out - > children [ 1 ] > = count )
out - > children [ 1 ] - = 0x10000 ;
2011-07-30 14:14:56 +00:00
}
2004-08-22 22:29:09 +00:00
}
2006-03-12 22:01:49 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Mod_MakeHull0
Deplicate the drawing hull structure as a clipping hull
= = = = = = = = = = = = = = = = =
*/
2017-01-13 00:39:50 +00:00
static void Mod_MakeHull0 ( model_t * loadmodel )
2004-08-22 22:29:09 +00:00
{
mnode_t * in , * child ;
2011-06-29 18:39:11 +00:00
mclipnode_t * out ;
2004-08-22 22:29:09 +00:00
int i , j , count ;
hull_t * hull ;
2005-04-16 16:21:27 +00:00
2004-08-22 22:29:09 +00:00
hull = & loadmodel - > hulls [ 0 ] ;
2005-04-16 16:21:27 +00:00
2004-08-22 22:29:09 +00:00
in = loadmodel - > nodes ;
count = loadmodel - > numnodes ;
2013-07-14 12:22:51 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
hull - > clipnodes = out ;
hull - > firstclipnode = 0 ;
hull - > lastclipnode = count - 1 ;
hull - > planes = loadmodel - > planes ;
for ( i = 0 ; i < count ; i + + , out + + , in + + )
{
out - > planenum = in - > plane - loadmodel - > planes ;
for ( j = 0 ; j < 2 ; j + + )
{
child = in - > children [ j ] ;
if ( child - > contents < 0 )
out - > children [ j ] = child - > contents ;
else
out - > children [ j ] = child - loadmodel - > nodes ;
}
}
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadPlanes
= = = = = = = = = = = = = = = = =
*/
2017-01-13 00:39:50 +00:00
static qboolean Mod_LoadPlanes ( model_t * loadmodel , qbyte * mod_base , lump_t * l )
2004-08-22 22:29:09 +00:00
{
int i , j ;
mplane_t * out ;
dplane_t * in ;
int count ;
int bits ;
in = ( void * ) ( mod_base + l - > fileofs ) ;
2019-05-23 19:06:04 +00:00
count = l - > filelen / sizeof ( * in ) ;
if ( l - > filelen % sizeof ( * in ) | | count > SANITY_LIMIT ( * out ) )
2006-03-12 22:01:49 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " MOD_LoadBmodel: funny lump size in %s \n " , loadmodel - > name ) ;
2006-03-12 22:01:49 +00:00
return false ;
}
2021-08-14 04:04:01 +00:00
out = ZG_Malloc ( & loadmodel - > memgroup , count * 2 * sizeof ( * out ) ) ;
2004-08-22 22:29:09 +00:00
loadmodel - > planes = out ;
2021-08-14 04:04:01 +00:00
loadmodel - > numplanes = count ;
2004-08-22 22:29:09 +00:00
for ( i = 0 ; i < count ; i + + , in + + , out + + )
{
bits = 0 ;
for ( j = 0 ; j < 3 ; j + + )
{
out - > normal [ j ] = LittleFloat ( in - > normal [ j ] ) ;
if ( out - > normal [ j ] < 0 )
bits | = 1 < < j ;
}
out - > dist = LittleFloat ( in - > dist ) ;
out - > type = LittleLong ( in - > type ) ;
out - > signbits = bits ;
}
2006-03-12 22:01:49 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
2017-01-13 00:39:50 +00:00
static void Mod_FixupNodeMinsMaxs ( mnode_t * node , mnode_t * parent )
2007-05-25 22:16:29 +00:00
{
if ( ! node )
return ;
if ( node - > contents > = 0 )
{
2013-07-14 12:22:51 +00:00
Mod_FixupNodeMinsMaxs ( node - > children [ 0 ] , node ) ;
Mod_FixupNodeMinsMaxs ( node - > children [ 1 ] , node ) ;
2007-05-25 22:16:29 +00:00
}
if ( parent )
{
if ( parent - > minmaxs [ 0 ] > node - > minmaxs [ 0 ] )
parent - > minmaxs [ 0 ] = node - > minmaxs [ 0 ] ;
if ( parent - > minmaxs [ 1 ] > node - > minmaxs [ 1 ] )
parent - > minmaxs [ 1 ] = node - > minmaxs [ 1 ] ;
if ( parent - > minmaxs [ 2 ] > node - > minmaxs [ 2 ] )
parent - > minmaxs [ 2 ] = node - > minmaxs [ 2 ] ;
if ( parent - > minmaxs [ 3 ] < node - > minmaxs [ 3 ] )
parent - > minmaxs [ 3 ] = node - > minmaxs [ 3 ] ;
if ( parent - > minmaxs [ 4 ] < node - > minmaxs [ 4 ] )
parent - > minmaxs [ 4 ] = node - > minmaxs [ 4 ] ;
if ( parent - > minmaxs [ 5 ] < node - > minmaxs [ 5 ] )
parent - > minmaxs [ 5 ] = node - > minmaxs [ 5 ] ;
}
}
2014-05-10 13:42:13 +00:00
2014-10-05 20:04:11 +00:00
static void Mod_FixupMinsMaxs ( model_t * loadmodel )
2007-05-25 22:16:29 +00:00
{
//q1 bsps are capped to +/- 32767 by the nodes/leafs
//verts arn't though
//so if the map is too big, let's figure out what they should be
float * v ;
msurface_t * * mark , * surf ;
mleaf_t * pleaf ;
medge_t * e , * pedges ;
int en , lindex ;
int i , c , lnumverts ;
qboolean needsfixup = false ;
if ( loadmodel - > mins [ 0 ] < - 32768 )
needsfixup = true ;
if ( loadmodel - > mins [ 1 ] < - 32768 )
needsfixup = true ;
if ( loadmodel - > mins [ 2 ] < - 32768 )
needsfixup = true ;
if ( loadmodel - > maxs [ 0 ] > 32767 )
needsfixup = true ;
if ( loadmodel - > maxs [ 1 ] > 32767 )
needsfixup = true ;
if ( loadmodel - > maxs [ 2 ] > 32767 )
needsfixup = true ;
if ( ! needsfixup )
return ;
//this is insane.
//why am I writing this?
//by the time the world actually gets this large, the floating point errors are going to be so immensly crazy that it's just not worth it.
pedges = loadmodel - > edges ;
for ( i = 0 ; i < loadmodel - > numleafs ; i + + )
{
pleaf = & loadmodel - > leafs [ i ] ;
mark = pleaf - > firstmarksurface ;
c = pleaf - > nummarksurfaces ;
if ( c )
{
do
{
surf = ( * mark + + ) ;
lnumverts = surf - > numedges ;
for ( en = 0 ; en < lnumverts ; en + + )
{
2014-05-10 13:42:13 +00:00
lindex = loadmodel - > surfedges [ surf - > firstedge + en ] ;
2007-05-25 22:16:29 +00:00
if ( lindex > 0 )
{
e = & pedges [ lindex ] ;
2014-05-10 13:42:13 +00:00
v = loadmodel - > vertexes [ e - > v [ 0 ] ] . position ;
2007-05-25 22:16:29 +00:00
}
else
{
e = & pedges [ - lindex ] ;
2014-05-10 13:42:13 +00:00
v = loadmodel - > vertexes [ e - > v [ 1 ] ] . position ;
2007-05-25 22:16:29 +00:00
}
if ( pleaf - > minmaxs [ 0 ] > v [ 0 ] )
pleaf - > minmaxs [ 0 ] = v [ 0 ] ;
if ( pleaf - > minmaxs [ 1 ] > v [ 1 ] )
pleaf - > minmaxs [ 1 ] = v [ 1 ] ;
if ( pleaf - > minmaxs [ 2 ] > v [ 2 ] )
pleaf - > minmaxs [ 2 ] = v [ 2 ] ;
if ( pleaf - > minmaxs [ 3 ] < v [ 0 ] )
pleaf - > minmaxs [ 3 ] = v [ 0 ] ;
if ( pleaf - > minmaxs [ 4 ] < v [ 1 ] )
pleaf - > minmaxs [ 4 ] = v [ 1 ] ;
if ( pleaf - > minmaxs [ 5 ] < v [ 2 ] )
pleaf - > minmaxs [ 5 ] = v [ 2 ] ;
}
} while ( - - c ) ;
}
}
2013-07-14 12:22:51 +00:00
Mod_FixupNodeMinsMaxs ( loadmodel - > nodes , NULL ) ; // sets nodes and leafs
2007-05-25 22:16:29 +00:00
}
2017-02-19 00:15:42 +00:00
# endif
2014-10-05 20:04:11 +00:00
void ModBrush_LoadGLStuff ( void * ctx , void * data , size_t a , size_t b )
{
# ifndef SERVERONLY
model_t * mod = ctx ;
2015-04-14 23:12:17 +00:00
char loadname [ MAX_QPATH ] ;
2014-10-05 20:04:11 +00:00
if ( ! a )
{ //submodels share textures, so only do this if 'a' is 0 (inline index, 0 = world).
for ( a = 0 ; a < mod - > numfogs ; a + + )
{
2021-06-22 14:40:53 +00:00
mod - > fogs [ a ] . shader = R_RegisterShader_Lightmap ( mod , mod - > fogs [ a ] . shadername ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , mod - > fogs [ a ] . shader , IF_WORLDTEX ) ;
2014-10-05 20:04:11 +00:00
if ( ! mod - > fogs [ a ] . shader - > fog_dist )
{
//invalid fog shader, don't use.
mod - > fogs [ a ] . shader = NULL ;
mod - > fogs [ a ] . numplanes = 0 ;
}
}
2018-03-04 14:41:16 +00:00
# if defined(Q3BSPS) || defined(RFBSPS)
2014-10-05 20:04:11 +00:00
if ( mod - > fromgame = = fg_quake3 )
{
2017-08-29 02:29:06 +00:00
if ( mod - > lightmaps . deluxemapping & & mod - > lightmaps . deluxemapping_modelspace )
2014-10-05 20:04:11 +00:00
{
2017-08-29 02:29:06 +00:00
for ( a = 0 ; a < mod - > numtexinfo ; a + + )
{
2021-06-22 14:40:53 +00:00
mod - > textures [ a ] - > shader = R_RegisterShader_Lightmap ( mod , va ( " %s#BUMPMODELSPACE " , mod - > textures [ a ] - > name ) ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , mod - > textures [ a ] - > shader , IF_WORLDTEX ) ;
2014-10-05 20:04:11 +00:00
2021-06-22 14:40:53 +00:00
mod - > textures [ a + mod - > numtexinfo ] - > shader = R_RegisterShader_Vertex ( mod , va ( " %s#VERTEXLIT " , mod - > textures [ a + mod - > numtexinfo ] - > name ) ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , mod - > textures [ a + mod - > numtexinfo ] - > shader , IF_WORLDTEX ) ;
2017-08-29 02:29:06 +00:00
}
}
else
{
for ( a = 0 ; a < mod - > numtexinfo ; a + + )
{
2021-06-22 14:40:53 +00:00
mod - > textures [ a ] - > shader = R_RegisterShader_Lightmap ( mod , mod - > textures [ a ] - > name ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , mod - > textures [ a ] - > shader , IF_WORLDTEX ) ;
2017-08-29 02:29:06 +00:00
2021-06-22 14:40:53 +00:00
mod - > textures [ a + mod - > numtexinfo ] - > shader = R_RegisterShader_Vertex ( mod , va ( " %s#VERTEXLIT " , mod - > textures [ a + mod - > numtexinfo ] - > name ) ) ;
2018-09-29 17:31:58 +00:00
R_BuildDefaultTexnums ( NULL , mod - > textures [ a + mod - > numtexinfo ] - > shader , IF_WORLDTEX ) ;
2017-08-29 02:29:06 +00:00
}
2014-10-05 20:04:11 +00:00
}
2021-06-22 14:40:53 +00:00
mod - > textures [ 2 * mod - > numtexinfo ] - > shader = R_RegisterShader_Flare ( mod , " noshader " ) ;
2014-10-05 20:04:11 +00:00
}
2018-03-04 14:41:16 +00:00
else
# endif
# ifdef Q2BSPS
if ( mod - > fromgame = = fg_quake2 )
2014-10-05 20:04:11 +00:00
{
2015-04-14 23:12:17 +00:00
COM_FileBase ( mod - > name , loadname , sizeof ( loadname ) ) ;
2014-10-05 20:04:11 +00:00
for ( a = 0 ; a < mod - > numtextures ; a + + )
{
2015-04-14 23:12:17 +00:00
unsigned int maps = 0 ;
2021-06-22 14:40:53 +00:00
mod - > textures [ a ] - > shader = R_RegisterCustom ( mod , mod - > textures [ a ] - > name , SUF_LIGHTMAP , Shader_DefaultBSPQ2 , NULL ) ;
2015-04-14 23:12:17 +00:00
maps | = SHADER_HASPALETTED ;
maps | = SHADER_HASDIFFUSE ;
if ( r_fb_bmodels . ival )
maps | = SHADER_HASFULLBRIGHT ;
// if (r_loadbumpmapping || (r_waterstyle.ival > 1 && *tx->name == '*'))
// maps |= SHADER_HASNORMALMAP;
if ( gl_specular . ival )
maps | = SHADER_HASGLOSS ;
2020-03-28 01:46:25 +00:00
R_BuildLegacyTexnums ( mod - > textures [ a ] - > shader , mod - > textures [ a ] - > name , loadname , maps , IF_WORLDTEX , mod - > textures [ a ] - > srcfmt , mod - > textures [ a ] - > srcwidth , mod - > textures [ a ] - > srcheight , mod - > textures [ a ] - > srcdata , mod - > textures [ a ] - > palette ) ;
2020-03-07 09:00:40 +00:00
BZ_Free ( mod - > textures [ a ] - > srcdata ) ;
mod - > textures [ a ] - > srcdata = NULL ;
2014-10-05 20:04:11 +00:00
}
}
else
2018-03-04 14:41:16 +00:00
# endif
2014-10-05 20:04:11 +00:00
{
2015-03-03 00:14:43 +00:00
COM_FileBase ( mod - > name , loadname , sizeof ( loadname ) ) ;
if ( ! strncmp ( loadname , " b_ " , 2 ) )
Q_strncpyz ( loadname , " bmodels " , sizeof ( loadname ) ) ;
2014-10-05 20:04:11 +00:00
for ( a = 0 ; a < mod - > numtextures ; a + + )
2021-06-22 14:40:53 +00:00
Mod_FinishTexture ( mod , mod - > textures [ a ] , loadname , false ) ;
2014-10-05 20:04:11 +00:00
}
}
Mod_Batches_Build ( mod , data ) ;
if ( data )
BZ_Free ( data ) ;
# endif
}
2017-01-13 00:39:50 +00:00
# ifdef Q1BSPS
2014-09-08 23:47:19 +00:00
struct vispatch_s
{
void * fileptr ;
size_t filelen ;
void * visptr ;
int vislen ;
void * leafptr ;
int leaflen ;
} ;
2014-10-05 20:04:11 +00:00
static void Mod_FindVisPatch ( struct vispatch_s * patch , model_t * mod , size_t leaflumpsize )
2014-09-08 23:47:19 +00:00
{
char patchname [ MAX_QPATH ] ;
int * lenptr , len ;
int ofs ;
qbyte * file ;
2015-04-14 23:12:17 +00:00
char * mapname ;
2014-09-08 23:47:19 +00:00
memset ( patch , 0 , sizeof ( * patch ) ) ;
if ( ! mod_external_vis . ival )
return ;
2015-04-14 23:12:17 +00:00
mapname = COM_SkipPath ( mod - > name ) ;
2014-09-08 23:47:19 +00:00
COM_StripExtension ( mod - > name , patchname , sizeof ( patchname ) ) ;
Q_strncatz ( patchname , " .vis " , sizeof ( patchname ) ) ;
//ignore the patch file if its in a different gamedir.
//this file format sucks too much for other verification.
2016-07-12 00:40:13 +00:00
if ( FS_FLocateFile ( mod - > name , FSLF_DEEPONFAILURE , NULL ) ! = FS_FLocateFile ( patchname , FSLF_DEEPONFAILURE , NULL ) )
2014-09-08 23:47:19 +00:00
return ;
patch - > filelen = FS_LoadFile ( patchname , & patch - > fileptr ) ;
if ( ! patch - > fileptr )
return ;
2015-04-14 23:12:17 +00:00
2014-09-08 23:47:19 +00:00
ofs = 0 ;
while ( ofs + 36 < = patch - > filelen )
{
file = patch - > fileptr ;
file + = ofs ;
memcpy ( patchname , file , 32 ) ;
patchname [ 32 ] = 0 ;
file + = 32 ;
lenptr = ( int * ) file ;
file + = sizeof ( int ) ;
len = LittleLong ( * lenptr ) ;
if ( ofs + 36 + len > patch - > filelen )
break ;
2015-04-14 23:12:17 +00:00
if ( ! Q_strcasecmp ( patchname , mapname ) )
2014-09-08 23:47:19 +00:00
{
lenptr = ( int * ) file ;
patch - > vislen = LittleLong ( * lenptr ) ;
file + = sizeof ( int ) ;
patch - > visptr = file ;
file + = patch - > vislen ;
lenptr = ( int * ) file ;
patch - > leaflen = LittleLong ( * lenptr ) ;
file + = sizeof ( int ) ;
patch - > leafptr = file ;
file + = patch - > leaflen ;
if ( sizeof ( int ) * 2 + patch - > vislen + patch - > leaflen ! = len | | patch - > leaflen ! = leaflumpsize )
{
patch - > visptr = NULL ;
patch - > leafptr = NULL ;
}
2015-04-14 23:12:17 +00:00
else
break ;
2014-09-08 23:47:19 +00:00
}
ofs + = 36 + len ;
}
}
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadBrushModel
= = = = = = = = = = = = = = = = =
*/
2017-01-13 00:39:50 +00:00
static qboolean QDECL Mod_LoadBrushModel ( model_t * mod , void * buffer , size_t fsize )
2004-08-22 22:29:09 +00:00
{
2014-09-08 23:47:19 +00:00
struct vispatch_s vispatch ;
2004-08-22 22:29:09 +00:00
int i , j ;
2018-06-02 08:55:57 +00:00
dheader_t header ;
2004-08-22 22:29:09 +00:00
mmodel_t * bm ;
2014-10-05 20:04:11 +00:00
model_t * submod ;
2006-02-22 23:50:12 +00:00
unsigned int chksum ;
2006-03-12 22:01:49 +00:00
qboolean noerrors ;
2014-10-05 20:04:11 +00:00
char loadname [ 32 ] ;
qbyte * mod_base = buffer ;
2015-10-11 11:34:58 +00:00
qboolean hexen2map = false ;
qboolean isnotmap ;
2016-07-12 00:40:13 +00:00
qboolean using_rbe = true ;
2018-06-02 08:55:57 +00:00
qboolean misaligned = false ;
2018-07-24 13:59:42 +00:00
bspx_header_t * bspx ;
2021-08-21 18:16:13 +00:00
subbsp_t subbsp = sb_none ;
2006-03-12 22:01:49 +00:00
2014-10-05 20:04:11 +00:00
COM_FileBase ( mod - > name , loadname , sizeof ( loadname ) ) ;
mod - > type = mod_brush ;
2004-08-22 22:29:09 +00:00
2018-06-02 08:55:57 +00:00
if ( fsize < sizeof ( header ) )
return false ;
mod_base = ( qbyte * ) buffer ;
memcpy ( & header , mod_base , sizeof ( header ) ) ;
for ( i = 0 ; i < countof ( header . lumps ) / 4 ; i + + )
{
header . lumps [ i ] . filelen = LittleLong ( header . lumps [ i ] . filelen ) ;
header . lumps [ i ] . fileofs = LittleLong ( header . lumps [ i ] . fileofs ) ;
}
2004-08-22 22:29:09 +00:00
2014-05-10 13:42:13 +00:00
# ifdef SERVERONLY
isnotmap = ! ! sv . world . worldmodel ;
# else
2004-08-22 22:29:09 +00:00
if ( ( ! cl . worldmodel & & cls . state > = ca_connected )
# ifndef CLIENTONLY
2014-10-05 20:04:11 +00:00
| | ( ! sv . world . worldmodel & & sv . state )
2004-08-22 22:29:09 +00:00
# endif
)
isnotmap = false ;
else
isnotmap = true ;
2014-05-10 13:42:13 +00:00
# endif
2004-08-22 22:29:09 +00:00
2021-11-03 20:31:32 +00:00
mod - > fromgame = fg_quake ;
if ( ! memcmp ( & header . version , BSPVERSION ) )
2014-10-05 20:04:11 +00:00
mod - > engineflags | = MDLF_NEEDOVERBRIGHT ;
2021-11-03 20:31:32 +00:00
else if ( ! memcmp ( & header . version , BSPVERSIONQ64 ) )
mod - > engineflags | = MDLF_NEEDOVERBRIGHT , subbsp = sb_quake64 ;
else if ( ! memcmp ( & header . version , BSPVERSIONPREREL ) )
2014-10-05 20:04:11 +00:00
mod - > engineflags | = MDLF_NEEDOVERBRIGHT ;
2021-11-03 20:31:32 +00:00
else if ( ! memcmp ( & header . version , BSPVERSION_LONG1 ) )
mod - > engineflags | = MDLF_NEEDOVERBRIGHT , subbsp = sb_long1 ;
else if ( ! memcmp ( & header . version , BSPVERSION_LONG2 ) )
mod - > engineflags | = MDLF_NEEDOVERBRIGHT , subbsp = sb_long2 ;
else if ( ! memcmp ( & header . version , BSPVERSIONHL ) )
2023-02-19 18:19:13 +00:00
{
char tmp [ 64 ] ;
2014-10-05 20:04:11 +00:00
mod - > fromgame = fg_halflife ;
2023-02-19 18:19:13 +00:00
//special hack to work around blueshit bugs - we need to swap LUMP_ENTITIES and LUMP_PLANES over
if ( COM_ParseOut ( mod_base + header . lumps [ LUMP_PLANES ] . fileofs , tmp , sizeof ( tmp ) ) & & ! strcmp ( tmp , " { " ) )
{
COM_ParseOut ( mod_base + header . lumps [ LUMP_ENTITIES ] . fileofs , tmp , sizeof ( tmp ) ) ;
if ( strcmp ( tmp , " { " ) )
{
int i ;
for ( i = 0 ; i < header . lumps [ LUMP_ENTITIES ] . filelen & & i < sizeof ( dplane_t ) ; i + + )
if ( mod_base [ header . lumps [ LUMP_ENTITIES ] . fileofs + i ] = = 0 )
{ //yeah, looks screwy in the way we expect. swap em over.
lump_t tmp = header . lumps [ LUMP_ENTITIES ] ;
header . lumps [ LUMP_ENTITIES ] = header . lumps [ LUMP_PLANES ] ;
header . lumps [ LUMP_PLANES ] = tmp ;
break ;
}
}
}
}
2021-11-03 20:31:32 +00:00
else
{
Con_Printf ( CON_ERROR " Mod_LoadBrushModel: %s has wrong version number (%i) \n " , mod - > name , i ) ;
2006-03-12 22:01:49 +00:00
return false ;
}
2023-01-09 05:15:31 +00:00
header . version = LittleLong ( header . version ) ;
2004-08-22 22:29:09 +00:00
2015-03-03 00:14:43 +00:00
mod - > lightmaps . width = 128 ; //LMBLOCK_WIDTH;
mod - > lightmaps . height = 128 ; //LMBLOCK_HEIGHT;
2012-07-05 19:42:36 +00:00
2004-08-22 22:29:09 +00:00
// checksum all of the map, except for entities
mod - > checksum = 0 ;
mod - > checksum2 = 0 ;
2006-10-05 21:12:04 +00:00
for ( i = 0 ; i < HEADER_LUMPS ; i + + )
{
2018-06-02 08:55:57 +00:00
if ( ( header . lumps [ i ] . fileofs & 3 ) & & header . lumps [ i ] . filelen )
misaligned = true ;
if ( ( unsigned ) header . lumps [ i ] . fileofs + ( unsigned ) header . lumps [ i ] . filelen > fsize )
2006-10-05 21:12:04 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " Mod_LoadBrushModel: %s appears truncated \n " , mod - > name ) ;
2006-10-05 21:12:04 +00:00
return false ;
}
2004-08-22 22:29:09 +00:00
if ( i = = LUMP_ENTITIES )
continue ;
2023-02-20 06:13:40 +00:00
chksum = CalcHashInt ( & hash_md4 , mod_base + header . lumps [ i ] . fileofs , header . lumps [ i ] . filelen ) ;
2006-02-22 23:50:12 +00:00
mod - > checksum ^ = chksum ;
2004-08-22 22:29:09 +00:00
if ( i = = LUMP_VISIBILITY | | i = = LUMP_LEAFS | | i = = LUMP_NODES )
continue ;
2006-02-22 23:50:12 +00:00
mod - > checksum2 ^ = chksum ;
2004-08-22 22:29:09 +00:00
}
2006-10-05 21:12:04 +00:00
2018-06-02 08:55:57 +00:00
if ( misaligned )
{ //pre-phong versions of tyrutils wrote misaligned lumps. These crash on arm/etc.
char * tmp ;
2021-07-01 15:43:18 +00:00
unsigned int ofs = 0 ;
2018-08-09 15:50:07 +00:00
Con_DPrintf ( CON_WARNING " %s: Misaligned lumps detected \n " , mod - > name ) ;
2018-06-02 08:55:57 +00:00
tmp = BZ_Malloc ( fsize ) ;
memcpy ( tmp , mod_base , fsize ) ;
for ( i = 0 ; i < HEADER_LUMPS ; i + + )
{
if ( ofs + header . lumps [ i ] . filelen > fsize )
{ //can happen if two lumps overlap... otherwise impossible.
Con_Printf ( CON_ERROR " %s: Realignment failed \n " , mod - > name ) ;
BZ_Free ( tmp ) ;
return false ;
}
memcpy ( mod_base + ofs , tmp + header . lumps [ i ] . fileofs , header . lumps [ i ] . filelen ) ;
header . lumps [ i ] . fileofs = ofs ;
ofs + = header . lumps [ i ] . filelen ;
2021-07-01 15:43:18 +00:00
ofs = ( ofs + 3 ) & ~ 3u ;
2018-06-02 08:55:57 +00:00
}
BZ_Free ( tmp ) ;
2018-07-24 13:59:42 +00:00
bspx = NULL ;
2018-06-02 08:55:57 +00:00
}
else
2006-10-05 21:12:04 +00:00
{
2018-07-24 13:59:42 +00:00
bspx = BSPX_Setup ( mod , mod_base , fsize , header . lumps , HEADER_LUMPS ) ;
2018-06-02 08:55:57 +00:00
2018-07-24 13:59:42 +00:00
/*if (1)//mod_ebfs.value)
2018-06-02 08:55:57 +00:00
{
char * id ;
id = ( char * ) mod_base + sizeof ( dheader_t ) ;
if ( id [ 0 ] = = ' P ' & & id [ 1 ] = = ' A ' & & id [ 2 ] = = ' C ' & & id [ 3 ] = = ' K ' )
{ //EBFS detected.
COM_LoadMapPackFile ( mod - > name , sizeof ( dheader_t ) ) ;
}
2018-07-24 13:59:42 +00:00
} */
2006-10-05 21:12:04 +00:00
}
2004-08-22 22:29:09 +00:00
2006-03-12 22:01:49 +00:00
noerrors = true ;
2018-06-02 08:55:57 +00:00
Mod_FindVisPatch ( & vispatch , mod , header . lumps [ LUMP_LEAFS ] . filelen ) ;
2014-09-08 23:47:19 +00:00
2004-08-22 22:29:09 +00:00
// load into heap
2016-07-12 00:40:13 +00:00
if ( ! isDedicated | | using_rbe )
2004-08-22 22:29:09 +00:00
{
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
TRACE ( ( " Loading verts \n " ) ) ;
2018-06-02 08:55:57 +00:00
noerrors = noerrors & & Mod_LoadVertexes ( mod , mod_base , & header . lumps [ LUMP_VERTEXES ] ) ;
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
TRACE ( ( " Loading edges \n " ) ) ;
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadEdges ( mod , mod_base , & header . lumps [ LUMP_EDGES ] , subbsp ) ;
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
TRACE ( ( " Loading Surfedges \n " ) ) ;
2018-06-02 08:55:57 +00:00
noerrors = noerrors & & Mod_LoadSurfedges ( mod , mod_base , & header . lumps [ LUMP_SURFEDGES ] ) ;
2009-11-15 03:20:17 +00:00
}
if ( ! isDedicated )
{
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
TRACE ( ( " Loading Textures \n " ) ) ;
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadTextures ( mod , mod_base , & header . lumps [ LUMP_TEXTURES ] , subbsp ) ;
2006-03-12 22:01:49 +00:00
}
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
TRACE ( ( " Loading Submodels \n " ) ) ;
2018-06-02 08:55:57 +00:00
noerrors = noerrors & & Mod_LoadSubmodels ( mod , mod_base , & header . lumps [ LUMP_MODELS ] , & hexen2map ) ;
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
TRACE ( ( " Loading Planes \n " ) ) ;
2018-06-02 08:55:57 +00:00
noerrors = noerrors & & Mod_LoadPlanes ( mod , mod_base , & header . lumps [ LUMP_PLANES ] ) ;
2015-03-03 00:14:43 +00:00
TRACE ( ( " Loading Entities \n " ) ) ;
2018-06-02 08:55:57 +00:00
Mod_LoadEntities ( mod , mod_base , & header . lumps [ LUMP_ENTITIES ] ) ;
2016-07-12 00:40:13 +00:00
if ( ! isDedicated | | using_rbe )
2004-08-22 22:29:09 +00:00
{
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
TRACE ( ( " Loading Texinfo \n " ) ) ;
2018-06-02 08:55:57 +00:00
noerrors = noerrors & & Mod_LoadTexinfo ( mod , mod_base , & header . lumps [ LUMP_TEXINFO ] ) ;
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
TRACE ( ( " Loading Faces \n " ) ) ;
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadFaces ( mod , bspx , mod_base , & header . lumps [ LUMP_FACES ] , & header . lumps [ LUMP_LIGHTING ] , subbsp ) ;
2009-11-15 03:20:17 +00:00
}
if ( ! isDedicated )
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
{
TRACE ( ( " Loading MarkSurfaces \n " ) ) ;
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadMarksurfaces ( mod , mod_base , & header . lumps [ LUMP_MARKSURFACES ] , subbsp ) ;
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
}
2006-03-12 22:01:49 +00:00
if ( noerrors )
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
{
TRACE ( ( " Loading Vis \n " ) ) ;
2018-06-02 08:55:57 +00:00
Mod_LoadVisibility ( mod , mod_base , & header . lumps [ LUMP_VISIBILITY ] , vispatch . visptr , vispatch . vislen ) ;
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
}
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadLeafs ( mod , mod_base , & header . lumps [ LUMP_LEAFS ] , subbsp , isnotmap , vispatch . leafptr , vispatch . leaflen ) ;
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
TRACE ( ( " Loading Nodes \n " ) ) ;
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadNodes ( mod , mod_base , & header . lumps [ LUMP_NODES ] , subbsp ) ;
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
TRACE ( ( " Loading Clipnodes \n " ) ) ;
2021-08-21 18:16:13 +00:00
noerrors = noerrors & & Mod_LoadClipnodes ( mod , mod_base , & header . lumps [ LUMP_CLIPNODES ] , subbsp , hexen2map ) ;
2006-03-12 22:01:49 +00:00
if ( noerrors )
{
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
TRACE ( ( " Loading hull 0 \n " ) ) ;
2014-10-05 20:04:11 +00:00
Mod_MakeHull0 ( mod ) ;
2006-03-12 22:01:49 +00:00
}
2004-08-22 22:29:09 +00:00
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
TRACE ( ( " sorting shaders \n " ) ) ;
2010-07-11 02:22:39 +00:00
if ( ! isDedicated & & noerrors )
2014-10-05 20:04:11 +00:00
Mod_SortShaders ( mod ) ;
2010-07-11 02:22:39 +00:00
2014-09-08 23:47:19 +00:00
BZ_Free ( vispatch . fileptr ) ;
2006-03-12 22:01:49 +00:00
if ( ! noerrors )
{
return false ;
}
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2018-07-24 13:59:42 +00:00
Q1BSP_LoadBrushes ( mod , bspx , mod_base ) ;
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2004-08-22 22:29:09 +00:00
mod - > numframes = 2 ; // regular and alternate animation
2009-11-15 03:20:17 +00:00
2004-08-22 22:29:09 +00:00
//
// set up the submodels (FIXME: this is confusing)
//
2020-04-19 01:23:32 +00:00
for ( j = 0 ; j < 2 ; j + + )
Q1BSP_CheckHullNodes ( & mod - > hulls [ j ] ) ;
2014-10-05 20:04:11 +00:00
for ( i = 0 , submod = mod ; i < mod - > numsubmodels ; i + + )
2004-08-22 22:29:09 +00:00
{
bm = & mod - > submodels [ i ] ;
2014-10-05 20:04:11 +00:00
submod - > rootnode = submod - > nodes + bm - > headnode [ 0 ] ;
submod - > hulls [ 0 ] . firstclipnode = bm - > headnode [ 0 ] ;
submod - > hulls [ 0 ] . available = true ;
2020-04-19 01:23:32 +00:00
// Q1BSP_CheckHullNodes(&submod->hulls[0]);
2010-07-12 22:46:37 +00:00
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2004-08-22 22:29:09 +00:00
for ( j = 1 ; j < MAX_MAP_HULLSM ; j + + )
{
2014-10-05 20:04:11 +00:00
submod - > hulls [ j ] . firstclipnode = bm - > headnode [ j ] ;
submod - > hulls [ j ] . lastclipnode = submod - > numclipnodes - 1 ;
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
submod - > hulls [ j ] . available & = bm - > hullavailable [ j ] ;
if ( submod - > hulls [ j ] . firstclipnode > submod - > hulls [ j ] . lastclipnode )
submod - > hulls [ j ] . available = false ;
2004-08-22 22:29:09 +00:00
2020-04-19 01:23:32 +00:00
// if (submod->hulls[j].available)
// Q1BSP_CheckHullNodes(&submod->hulls[j]);
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
if ( mod - > fromgame = = fg_halflife & & i )
{
for ( j = bm - > firstface ; j < bm - > firstface + bm - > numfaces ; j + + )
{
if ( mod - > surfaces [ j ] . flags & SURF_DRAWTURB )
{
2021-06-18 20:37:57 +00:00
float mid = bm - > mins [ 2 ] + ( 0.5 * ( bm - > maxs [ 2 ] - bm - > mins [ 2 ] ) ) ;
if ( mod - > surfaces [ j ] . plane - > type = = PLANE_Z & & mod - > surfaces [ j ] . plane - > dist > = mid ) {
2016-12-13 11:50:15 +00:00
continue ;
2021-06-18 20:37:57 +00:00
}
2016-12-13 11:50:15 +00:00
mod - > surfaces [ j ] . flags | = SURF_NODRAW ;
}
}
}
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
submod - > firstmodelsurface = bm - > firstface ;
submod - > nummodelsurfaces = bm - > numfaces ;
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
VectorCopy ( bm - > maxs , submod - > maxs ) ;
VectorCopy ( bm - > mins , submod - > mins ) ;
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
submod - > radius = RadiusFromBounds ( submod - > mins , submod - > maxs ) ;
2004-08-22 22:29:09 +00:00
2017-07-04 05:07:51 +00:00
submod - > numclusters = ( i = = 0 ) ? bm - > visleafs : 0 ;
submod - > pvsbytes = ( ( submod - > numclusters + 31 ) > > 3 ) & ~ 3 ;
2004-08-22 22:29:09 +00:00
2015-08-20 03:17:47 +00:00
if ( i )
2021-05-28 07:07:48 +00:00
{
2016-11-25 08:14:54 +00:00
submod - > entities_raw = NULL ;
2021-05-28 07:07:48 +00:00
submod - > archive = NULL ;
}
2015-08-20 03:17:47 +00:00
2014-10-05 20:04:11 +00:00
memset ( & submod - > batches , 0 , sizeof ( submod - > batches ) ) ;
submod - > vbos = NULL ;
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2016-07-12 00:40:13 +00:00
if ( ! isDedicated | | using_rbe )
2012-07-05 19:42:36 +00:00
{
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , ModBrush_LoadGLStuff , submod , NULL , i , 0 ) ;
2012-07-05 19:42:36 +00:00
}
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2012-07-05 19:42:36 +00:00
2021-04-14 05:21:04 +00:00
submod - > cnodes = NULL ;
Q1BSP_SetModelFuncs ( submod ) ;
2021-04-14 06:10:37 +00:00
# ifdef Q2BSPS
2021-04-14 05:21:04 +00:00
if ( bm - > brushes )
{
struct bihleaf_s * leafs , * l ;
size_t i ;
leafs = l = BZ_Malloc ( sizeof ( * leafs ) * bm - > numbrushes ) ;
for ( i = 0 ; i < bm - > numbrushes ; i + + )
{
struct q2cbrush_s * b = & bm - > brushes [ i ] ;
l - > type = BIH_BRUSH ;
l - > data . brush = b ;
l - > data . contents = b - > contents ;
VectorCopy ( b - > absmins , l - > mins ) ;
VectorCopy ( b - > absmaxs , l - > maxs ) ;
l + + ;
}
BIH_Build ( submod , leafs , l - leafs ) ;
BZ_Free ( leafs ) ;
}
2021-04-14 06:10:37 +00:00
# endif
2021-04-14 05:21:04 +00:00
2014-10-05 20:04:11 +00:00
if ( i )
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , Mod_ModelLoaded , submod , NULL , MLS_LOADED , 0 ) ;
2014-10-05 20:04:11 +00:00
if ( i < submod - > numsubmodels - 1 )
2004-08-22 22:29:09 +00:00
{ // duplicate the basic information
2014-10-05 20:04:11 +00:00
char name [ MAX_QPATH ] ;
model_t * nextmod ;
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
Q_snprintfz ( name , sizeof ( name ) , " *%i:%s " , i + 1 , mod - > publicname ) ;
2014-10-05 20:04:11 +00:00
nextmod = Mod_FindName ( name ) ;
* nextmod = * submod ;
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
nextmod - > submodelof = mod ;
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
Q_strncpyz ( nextmod - > publicname , name , sizeof ( nextmod - > publicname ) ) ;
Q_snprintfz ( nextmod - > name , sizeof ( nextmod - > publicname ) , " *%i:%s " , i + 1 , mod - > publicname ) ;
2014-10-05 20:04:11 +00:00
submod = nextmod ;
memset ( & submod - > memgroup , 0 , sizeof ( submod - > memgroup ) ) ;
2004-08-22 22:29:09 +00:00
}
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2004-08-22 22:29:09 +00:00
}
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2014-05-20 02:23:37 +00:00
if ( ! isDedicated )
2014-10-05 20:04:11 +00:00
Mod_FixupMinsMaxs ( mod ) ;
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
TRACE ( ( " LoadBrushModel %i \n " , __LINE__ ) ) ;
2007-05-25 22:16:29 +00:00
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
# ifdef TERRAIN
2014-10-05 20:04:11 +00:00
mod - > terrain = Mod_LoadTerrainInfo ( mod , loadname , false ) ;
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
# endif
2006-03-12 22:01:49 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
2017-01-13 00:39:50 +00:00
# endif
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2014-10-05 20:04:11 +00:00
SPRITES
2004-08-22 22:29:09 +00:00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
//=========================================================
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
# ifdef SERVERONLY
//dedicated servers should not need to load sprites.
//dedicated servers need *.bsp to be loaded for setmodel to get the correct size (or all model types with sv_gameplayfix_setmodelrealbox).
//otherwise other model types(actually: names) only need to be loaded once reflection or hitmodel is used.
//for sprites we don't really care ever.
qboolean QDECL Mod_LoadSpriteModel ( model_t * mod , void * buffer , size_t fsize )
{
mod - > type = mod_dummy ;
return true ;
}
qboolean QDECL Mod_LoadSprite2Model ( model_t * mod , void * buffer , size_t fsize )
{
return Mod_LoadSpriteModel ( mod , buffer , fsize ) ;
}
void Mod_LoadDoomSprite ( model_t * mod )
{
mod - > type = mod_dummy ;
}
# else
2014-10-05 20:04:11 +00:00
//we need to override the rtlight shader for sprites so they get lit properly ignoring n+s+t dirs
//so lets split the shader into parts to avoid too many dupes
2022-01-17 09:13:05 +00:00
# define SPRITE_SHADER_MAIN(extra) \
2014-10-05 20:04:11 +00:00
" { \n " \
" if gl_blendsprites \n " \
" program defaultsprite \n " \
" else \n " \
2016-01-18 05:22:07 +00:00
" program defaultsprite#MASK=0.666 \n " \
2014-10-05 20:04:11 +00:00
" endif \n " \
" { \n " \
" map $diffuse \n " \
2021-05-27 11:33:48 +00:00
" if gl_blendsprites == 2 \n " \
" blendfunc GL_ONE GL_ONE \n " \
" elif gl_blendsprites \n " \
2018-01-22 19:18:04 +00:00
" blendfunc GL_ONE GL_ONE_MINUS_SRC_ALPHA \n " \
2014-10-05 20:04:11 +00:00
" else \n " \
" alphafunc ge128 \n " \
" depthwrite \n " \
" endif \n " \
" rgbgen vertex \n " \
" alphagen vertex \n " \
" } \n " \
2022-01-17 09:13:05 +00:00
" surfaceparm noshadows \n " \
extra \
" } \n "
# define SPRITE_SHADER_UNLIT SPRITE_SHADER_MAIN( \
" surfaceparm nodlight \n " )
# define SPRITE_SHADER_LIT SPRITE_SHADER_MAIN( \
2014-10-05 20:04:11 +00:00
" sort seethrough \n " \
" bemode rtlight \n " \
" { \n " \
" program rtlight#NOBUMP \n " \
" { \n " \
" map $diffuse \n " \
" blendfunc add \n " \
" } \n " \
2022-01-17 09:13:05 +00:00
" } \n " )
2014-10-05 20:04:11 +00:00
void Mod_LoadSpriteFrameShader ( model_t * spr , int frame , int subframe , mspriteframe_t * frameinfo )
{
# ifndef SERVERONLY
char * shadertext ;
char name [ MAX_QPATH ] ;
2016-07-12 00:40:13 +00:00
qboolean litsprite = false ;
2014-10-05 20:04:11 +00:00
if ( qrenderer = = QR_NONE )
return ;
if ( subframe = = - 1 )
Q_snprintfz ( name , sizeof ( name ) , " %s_%i.tga " , spr - > name , frame ) ;
else
Q_snprintfz ( name , sizeof ( name ) , " %s_%i_%i.tga " , spr - > name , frame , subframe ) ;
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
if ( mod_litsprites_force . ival | | strchr ( spr - > publicname , ' ! ' ) )
2016-07-12 00:40:13 +00:00
litsprite = true ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2014-10-05 20:04:11 +00:00
else
{
2016-07-15 12:26:24 +00:00
int i ;
2016-07-12 00:40:13 +00:00
/*
2022-01-19 08:27:42 +00:00
A quick note on tenebrae and sprites : In tenebrae , sprites are always additive , unless the light_lev field is set ( which makes it fullbright ) .
2016-07-12 00:40:13 +00:00
While its generally preferable and more consistent to assume lit sprites , this is incompatible with vanilla quake and thus unacceptable to us , but you can set the mod_assumelitsprites cvar if you want it .
So for better compatibility , we have a whitelist of ' well - known ' sprites that tenebrae uses in this way , which we do lighting on .
You should still be able to use EF_FULLBRIGHT on these , but light_lev is an imprecise setting and will result in issues . Just be specific about fullbright or additive .
DP on the other hand , supports lit sprites only when the sprite contains a ! in its name . We support that too .
*/
static char * forcelitsprites [ ] =
{
" progs/smokepuff.spr " ,
NULL
} ;
2014-10-05 20:04:11 +00:00
for ( i = 0 ; forcelitsprites [ i ] ; i + + )
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
if ( ! strcmp ( spr - > publicname , forcelitsprites [ i ] ) )
2014-10-05 20:04:11 +00:00
{
2016-07-12 00:40:13 +00:00
litsprite = true ;
2014-10-05 20:04:11 +00:00
break ;
}
}
2016-07-12 00:40:13 +00:00
# endif
2014-10-05 20:04:11 +00:00
2016-07-12 00:40:13 +00:00
if ( litsprite ) // a ! in the filename makes it non-fullbright (and can also be lit by rtlights too).
2022-01-17 09:13:05 +00:00
shadertext = SPRITE_SHADER_LIT ;
2014-10-05 20:04:11 +00:00
else
2022-01-17 09:13:05 +00:00
shadertext = SPRITE_SHADER_UNLIT ;
frameinfo - > lit = litsprite ;
2014-10-05 20:04:11 +00:00
frameinfo - > shader = R_RegisterShader ( name , SUF_NONE , shadertext ) ;
2015-05-03 19:57:46 +00:00
frameinfo - > shader - > defaulttextures - > base = frameinfo - > image ;
2014-10-05 20:04:11 +00:00
frameinfo - > shader - > width = frameinfo - > right - frameinfo - > left ;
frameinfo - > shader - > height = frameinfo - > up - frameinfo - > down ;
# endif
}
void Mod_LoadSpriteShaders ( model_t * spr )
{
msprite_t * psprite = spr - > meshinfo ;
int i , j ;
mspritegroup_t * group ;
for ( i = 0 ; i < psprite - > numframes ; i + + )
{
switch ( psprite - > frames [ i ] . type )
{
case SPR_SINGLE :
Mod_LoadSpriteFrameShader ( spr , i , - 1 , psprite - > frames [ i ] . frameptr ) ;
break ;
case SPR_ANGLED :
case SPR_GROUP :
group = ( mspritegroup_t * ) psprite - > frames [ i ] . frameptr ;
for ( j = 0 ; j < group - > numframes ; j + + )
Mod_LoadSpriteFrameShader ( spr , i , j , group - > frames [ j ] ) ;
break ;
}
}
}
2014-05-10 13:42:13 +00:00
# ifdef SPRMODELS
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = =
Mod_LoadSpriteFrame
= = = = = = = = = = = = = = = = =
*/
2022-07-28 02:16:48 +00:00
static void * Mod_LoadSpriteFrame ( model_t * mod , void * pin , void * pend , mspriteframe_t * * ppframe , int framenum , int subframe , int version , unsigned char * palette )
2004-08-22 22:29:09 +00:00
{
dspriteframe_t * pinframe ;
mspriteframe_t * pspriteframe ;
int width , height , size , origin [ 2 ] ;
char name [ 64 ] ;
2014-10-05 20:04:11 +00:00
uploadfmt_t lowresfmt ;
void * dataptr ;
2004-08-22 22:29:09 +00:00
pinframe = ( dspriteframe_t * ) pin ;
width = LittleLong ( pinframe - > width ) ;
height = LittleLong ( pinframe - > height ) ;
size = width * height ;
2014-10-05 20:04:11 +00:00
pspriteframe = ZG_Malloc ( & mod - > memgroup , sizeof ( mspriteframe_t ) ) ;
2004-08-22 22:29:09 +00:00
Q_memset ( pspriteframe , 0 , sizeof ( mspriteframe_t ) ) ;
* ppframe = pspriteframe ;
origin [ 0 ] = LittleLong ( pinframe - > origin [ 0 ] ) ;
origin [ 1 ] = LittleLong ( pinframe - > origin [ 1 ] ) ;
pspriteframe - > up = origin [ 1 ] ;
pspriteframe - > down = origin [ 1 ] - height ;
pspriteframe - > left = origin [ 0 ] ;
pspriteframe - > right = width + origin [ 0 ] ;
2017-07-13 10:44:54 +00:00
pspriteframe - > xmirror = false ;
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
dataptr = ( pinframe + 1 ) ;
2005-05-13 10:42:48 +00:00
2004-08-22 22:29:09 +00:00
if ( version = = SPRITE32_VERSION )
{
size * = 4 ;
2014-10-05 20:04:11 +00:00
lowresfmt = TF_RGBA32 ;
2005-05-13 10:42:48 +00:00
}
else if ( version = = SPRITEHL_VERSION )
2014-10-05 20:04:11 +00:00
lowresfmt = TF_8PAL32 ;
2005-05-13 10:42:48 +00:00
else
2014-10-05 20:04:11 +00:00
lowresfmt = TF_TRANS8 ;
if ( ( qbyte * ) dataptr + size > ( qbyte * ) pend )
2005-05-13 10:42:48 +00:00
{
2014-10-05 20:04:11 +00:00
//tenebrae has a couple of dodgy truncated sprites. yay for replacement textures.
dataptr = NULL ;
lowresfmt = TF_INVALID ;
}
2022-07-28 02:16:48 +00:00
if ( subframe = = - 1 )
Q_snprintfz ( name , sizeof ( name ) , " %s_%i.tga " , mod - > name , framenum ) ;
else
Q_snprintfz ( name , sizeof ( name ) , " %s_%i_%i.tga " , mod - > name , framenum , subframe ) ;
2018-01-22 19:18:04 +00:00
pspriteframe - > image = Image_GetTexture ( name , " sprites " , IF_NOMIPMAP | IF_NOGAMMA | IF_CLAMP | IF_PREMULTIPLYALPHA , dataptr , palette , width , height , lowresfmt ) ;
2004-08-22 22:29:09 +00:00
2005-05-13 10:42:48 +00:00
return ( void * ) ( ( qbyte * ) ( pinframe + 1 ) + size ) ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadSpriteGroup
= = = = = = = = = = = = = = = = =
*/
2014-10-05 20:04:11 +00:00
static void * Mod_LoadSpriteGroup ( model_t * mod , void * pin , void * pend , mspriteframe_t * * ppframe , int framenum , int version , unsigned char * palette )
2004-08-22 22:29:09 +00:00
{
dspritegroup_t * pingroup ;
mspritegroup_t * pspritegroup ;
int i , numframes ;
dspriteinterval_t * pin_intervals ;
float * poutintervals ;
void * ptemp ;
2016-09-01 14:31:24 +00:00
float prevtime ;
2004-08-22 22:29:09 +00:00
pingroup = ( dspritegroup_t * ) pin ;
numframes = LittleLong ( pingroup - > numframes ) ;
2020-06-12 23:29:58 +00:00
if ( numframes < = 0 )
{
Con_Printf ( CON_ERROR " Mod_LoadSpriteGroup: invalid frame count \n " ) ;
return NULL ;
}
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
pspritegroup = ZG_Malloc ( & mod - > memgroup , sizeof ( mspritegroup_t ) + ( numframes - 1 ) * sizeof ( pspritegroup - > frames [ 0 ] ) ) ;
2004-08-22 22:29:09 +00:00
pspritegroup - > numframes = numframes ;
* ppframe = ( mspriteframe_t * ) pspritegroup ;
pin_intervals = ( dspriteinterval_t * ) ( pingroup + 1 ) ;
2014-10-05 20:04:11 +00:00
poutintervals = ZG_Malloc ( & mod - > memgroup , numframes * sizeof ( float ) ) ;
2004-08-22 22:29:09 +00:00
pspritegroup - > intervals = poutintervals ;
2016-09-01 14:31:24 +00:00
for ( i = 0 , prevtime = 0 ; i < numframes ; i + + )
2004-08-22 22:29:09 +00:00
{
* poutintervals = LittleFloat ( pin_intervals - > interval ) ;
if ( * poutintervals < = 0.0 )
2006-03-13 06:15:11 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " Mod_LoadSpriteGroup: interval<=0 \n " ) ;
2006-03-13 06:15:11 +00:00
return NULL ;
}
2016-09-01 14:31:24 +00:00
prevtime = * poutintervals = prevtime + * poutintervals ;
2004-08-22 22:29:09 +00:00
poutintervals + + ;
pin_intervals + + ;
}
ptemp = ( void * ) pin_intervals ;
for ( i = 0 ; i < numframes ; i + + )
{
2022-07-28 02:16:48 +00:00
ptemp = Mod_LoadSpriteFrame ( mod , ptemp , pend , & pspritegroup - > frames [ i ] , framenum , i , version , palette ) ;
2004-08-22 22:29:09 +00:00
}
return ptemp ;
}
/*
= = = = = = = = = = = = = = = = =
Mod_LoadSpriteModel
= = = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
qboolean QDECL Mod_LoadSpriteModel ( model_t * mod , void * buffer , size_t fsize )
2004-08-22 22:29:09 +00:00
{
int i ;
int version ;
dsprite_t * pin ;
msprite_t * psprite ;
int numframes ;
int size ;
dspriteframetype_t * pframetype ;
2013-12-29 22:48:28 +00:00
int rendertype = SPRHL_ALPHATEST ;
2005-05-13 10:42:48 +00:00
unsigned char pal [ 256 * 4 ] ;
int sptype ;
2004-08-22 22:29:09 +00:00
pin = ( dsprite_t * ) buffer ;
version = LittleLong ( pin - > version ) ;
if ( version ! = SPRITE_VERSION )
2005-05-13 10:42:48 +00:00
if ( version ! = SPRITE32_VERSION )
if ( version ! = SPRITEHL_VERSION )
2006-03-13 06:15:11 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " %s has wrong version number "
2006-03-13 06:15:11 +00:00
" (%i should be %i) \n " , mod - > name , version , SPRITE_VERSION ) ;
return false ;
}
2004-08-22 22:29:09 +00:00
2005-05-13 10:42:48 +00:00
sptype = LittleLong ( pin - > type ) ;
2006-04-09 15:35:50 +00:00
if ( LittleLong ( pin - > version ) = = SPRITEHL_VERSION )
2005-05-13 10:42:48 +00:00
{
pin = ( dsprite_t * ) ( ( char * ) pin + 4 ) ;
2013-12-29 22:48:28 +00:00
rendertype = LittleLong ( pin - > type ) ; //not sure what the values mean.
2005-05-13 10:42:48 +00:00
}
2004-08-22 22:29:09 +00:00
numframes = LittleLong ( pin - > numframes ) ;
size = sizeof ( msprite_t ) + ( numframes - 1 ) * sizeof ( psprite - > frames ) ;
2014-10-05 20:04:11 +00:00
psprite = ZG_Malloc ( & mod - > memgroup , size ) ;
2004-08-22 22:29:09 +00:00
2013-07-14 12:22:51 +00:00
mod - > meshinfo = psprite ;
2013-12-29 22:48:28 +00:00
switch ( sptype )
{
2021-06-21 19:13:33 +00:00
case SPR_ORIENTED :
if ( r_sprite_backfacing . ival )
sptype = SPR_ORIENTED_BACKFACE ;
break ;
2013-12-29 22:48:28 +00:00
case SPR_VP_PARALLEL_UPRIGHT :
case SPR_FACING_UPRIGHT :
case SPR_VP_PARALLEL :
2021-06-21 13:44:14 +00:00
case SPR_VP_PARALLEL_ORIENTED :
2013-12-29 22:48:28 +00:00
// case SPRDP_LABEL:
// case SPRDP_LABEL_SCALE:
// case SPRDP_OVERHEAD:
break ;
default :
Con_DPrintf ( CON_ERROR " %s has unsupported sprite type %i \n " , mod - > name , sptype ) ;
sptype = SPR_VP_PARALLEL ;
break ;
}
2005-05-13 10:42:48 +00:00
psprite - > type = sptype ;
2004-08-22 22:29:09 +00:00
psprite - > maxwidth = LittleLong ( pin - > width ) ;
psprite - > maxheight = LittleLong ( pin - > height ) ;
psprite - > beamlength = LittleFloat ( pin - > beamlength ) ;
mod - > synctype = LittleLong ( pin - > synctype ) ;
psprite - > numframes = numframes ;
mod - > mins [ 0 ] = mod - > mins [ 1 ] = - psprite - > maxwidth / 2 ;
mod - > maxs [ 0 ] = mod - > maxs [ 1 ] = psprite - > maxwidth / 2 ;
mod - > mins [ 2 ] = - psprite - > maxheight / 2 ;
mod - > maxs [ 2 ] = psprite - > maxheight / 2 ;
2010-11-07 02:18:37 +00:00
if ( qrenderer = = QR_NONE )
{
mod - > type = mod_dummy ;
return true ;
}
2005-05-13 10:42:48 +00:00
2009-02-22 13:46:48 +00:00
if ( version = = SPRITEHL_VERSION )
2005-05-13 10:42:48 +00:00
{
int i ;
short * numi = ( short * ) ( pin + 1 ) ;
unsigned char * src = ( unsigned char * ) ( numi + 1 ) ;
2006-04-09 15:35:50 +00:00
if ( LittleShort ( * numi ) ! = 256 )
2006-03-13 06:15:11 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " %s has wrong number of palette indexes (we only support 256) \n " , mod - > name ) ;
2006-03-13 06:15:11 +00:00
return false ;
}
2005-05-13 10:42:48 +00:00
2013-12-29 22:48:28 +00:00
if ( rendertype = = SPRHL_INDEXALPHA )
2005-05-13 10:42:48 +00:00
{
2020-09-05 18:58:12 +00:00
/* alpha value is equivalent to palette index - eukara */
for ( i = 0 ; i < 256 ; i + + )
{
pal [ i * 4 + 0 ] = * src + + ;
pal [ i * 4 + 1 ] = * src + + ;
pal [ i * 4 + 2 ] = * src + + ;
pal [ i * 4 + 3 ] = i ;
}
2013-12-29 22:48:28 +00:00
}
else
{
for ( i = 0 ; i < 256 ; i + + )
{ //FIXME: bgr?
pal [ i * 4 + 0 ] = * src + + ;
pal [ i * 4 + 1 ] = * src + + ;
pal [ i * 4 + 2 ] = * src + + ;
pal [ i * 4 + 3 ] = 255 ;
}
if ( rendertype = = SPRHL_ALPHATEST )
{
pal [ 255 * 4 + 0 ] = 0 ;
pal [ 255 * 4 + 1 ] = 0 ;
pal [ 255 * 4 + 2 ] = 0 ;
pal [ 255 * 4 + 3 ] = 0 ;
}
2005-05-13 10:42:48 +00:00
}
pframetype = ( dspriteframetype_t * ) ( src ) ;
}
else
pframetype = ( dspriteframetype_t * ) ( pin + 1 ) ;
2004-08-22 22:29:09 +00:00
//
// load the frames
//
if ( numframes < 1 )
2006-03-13 06:15:11 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " Mod_LoadSpriteModel: Invalid # of frames: %d \n " , numframes ) ;
2006-03-13 06:15:11 +00:00
return false ;
}
2004-08-22 22:29:09 +00:00
mod - > numframes = numframes ;
for ( i = 0 ; i < numframes ; i + + )
{
spriteframetype_t frametype ;
frametype = LittleLong ( pframetype - > type ) ;
psprite - > frames [ i ] . type = frametype ;
if ( frametype = = SPR_SINGLE )
{
pframetype = ( dspriteframetype_t * )
2014-10-05 20:04:11 +00:00
Mod_LoadSpriteFrame ( mod , pframetype + 1 , ( qbyte * ) buffer + fsize ,
2022-07-28 02:16:48 +00:00
& psprite - > frames [ i ] . frameptr , i , - 1 , version , pal ) ;
2004-08-22 22:29:09 +00:00
}
else
{
pframetype = ( dspriteframetype_t * )
2014-10-05 20:04:11 +00:00
Mod_LoadSpriteGroup ( mod , pframetype + 1 , ( qbyte * ) buffer + fsize ,
2005-05-13 10:42:48 +00:00
& psprite - > frames [ i ] . frameptr , i , version , pal ) ;
2004-08-22 22:29:09 +00:00
}
2006-03-13 06:15:11 +00:00
if ( pframetype = = NULL )
{
return false ;
}
2004-08-22 22:29:09 +00:00
}
mod - > type = mod_sprite ;
2006-03-13 06:15:11 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
2014-05-10 13:42:13 +00:00
# endif
2004-08-22 22:29:09 +00:00
2013-07-14 12:22:51 +00:00
# ifdef SP2MODELS
2014-03-30 08:55:06 +00:00
qboolean QDECL Mod_LoadSprite2Model ( model_t * mod , void * buffer , size_t fsize )
2004-08-22 22:29:09 +00:00
{
int i ;
int version ;
dmd2sprite_t * pin ;
msprite_t * psprite ;
int numframes ;
int size ;
dmd2sprframe_t * pframetype ;
mspriteframe_t * frame ;
2009-11-04 21:16:50 +00:00
int w , h ;
2004-08-22 22:29:09 +00:00
float origin [ 2 ] ;
2014-10-05 20:04:11 +00:00
2004-08-22 22:29:09 +00:00
pin = ( dmd2sprite_t * ) buffer ;
version = LittleLong ( pin - > version ) ;
if ( version ! = SPRITE2_VERSION )
2006-03-13 06:15:11 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " %s has wrong version number "
2004-08-22 22:29:09 +00:00
" (%i should be %i) " , mod - > name , version , SPRITE2_VERSION ) ;
2006-03-13 06:15:11 +00:00
return false ;
}
2004-08-22 22:29:09 +00:00
numframes = LittleLong ( pin - > numframes ) ;
size = sizeof ( msprite_t ) + ( numframes - 1 ) * sizeof ( psprite - > frames ) ;
2014-10-05 20:04:11 +00:00
psprite = ZG_Malloc ( & mod - > memgroup , size ) ;
2004-08-22 22:29:09 +00:00
2013-07-14 12:22:51 +00:00
mod - > meshinfo = psprite ;
2004-08-22 22:29:09 +00:00
psprite - > type = SPR_VP_PARALLEL ;
psprite - > maxwidth = 1 ;
psprite - > maxheight = 1 ;
psprite - > beamlength = 1 ;
mod - > synctype = 0 ;
psprite - > numframes = numframes ;
mod - > mins [ 0 ] = mod - > mins [ 1 ] = - psprite - > maxwidth / 2 ;
mod - > maxs [ 0 ] = mod - > maxs [ 1 ] = psprite - > maxwidth / 2 ;
mod - > mins [ 2 ] = - psprite - > maxheight / 2 ;
mod - > maxs [ 2 ] = psprite - > maxheight / 2 ;
//
// load the frames
//
if ( numframes < 1 )
2006-03-13 06:15:11 +00:00
{
2007-09-23 15:28:06 +00:00
Con_Printf ( CON_ERROR " Mod_LoadSpriteModel: Invalid # of frames: %d \n " , numframes ) ;
2006-03-13 06:15:11 +00:00
return false ;
}
2004-08-22 22:29:09 +00:00
mod - > numframes = numframes ;
pframetype = pin - > frames ;
for ( i = 0 ; i < numframes ; i + + )
{
spriteframetype_t frametype ;
frametype = SPR_SINGLE ;
psprite - > frames [ i ] . type = frametype ;
2014-10-05 20:04:11 +00:00
frame = psprite - > frames [ i ] . frameptr = ZG_Malloc ( & mod - > memgroup , sizeof ( mspriteframe_t ) ) ;
2004-08-22 22:29:09 +00:00
2014-10-05 20:04:11 +00:00
frame - > image = Image_GetTexture ( pframetype - > name , NULL , IF_NOMIPMAP | IF_NOGAMMA | IF_CLAMP , NULL , NULL , 0 , 0 , TF_INVALID ) ;
2007-05-25 22:16:29 +00:00
2009-11-04 21:16:50 +00:00
w = LittleLong ( pframetype - > width ) ;
h = LittleLong ( pframetype - > height ) ;
2004-08-22 22:29:09 +00:00
origin [ 0 ] = LittleLong ( pframetype - > origin_x ) ;
origin [ 1 ] = LittleLong ( pframetype - > origin_y ) ;
2011-04-23 20:37:20 +00:00
frame - > down = - origin [ 1 ] ;
frame - > up = h - origin [ 1 ] ;
2004-08-22 22:29:09 +00:00
frame - > left = - origin [ 0 ] ;
2009-11-04 21:16:50 +00:00
frame - > right = w - origin [ 0 ] ;
2017-07-13 10:44:54 +00:00
frame - > xmirror = false ;
2005-03-18 06:14:33 +00:00
pframetype + + ;
2004-08-22 22:29:09 +00:00
}
mod - > type = mod_sprite ;
2006-03-13 06:15:11 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
2013-07-14 12:22:51 +00:00
# endif
2004-08-22 22:29:09 +00:00
2014-05-10 13:42:13 +00:00
# ifdef DSPMODELS
2004-08-22 22:29:09 +00:00
typedef struct {
short width ;
short height ;
short xpos ;
short ypos ;
} doomimage_t ;
2017-07-13 10:44:54 +00:00
static int QDECL FindDoomSprites ( const char * name , qofs_t size , time_t mtime , void * param , searchpathfuncs_t * spath )
2004-08-22 22:29:09 +00:00
{
if ( * ( int * ) param + strlen ( name ) + 1 > 16000 )
Sys_Error ( " Too many doom sprites \n " ) ;
strcpy ( ( char * ) param + * ( int * ) param , name ) ;
* ( int * ) param + = strlen ( name ) + 1 ;
return true ;
}
2017-07-13 10:44:54 +00:00
static void LoadDoomSpriteFrame ( model_t * mod , mspriteframe_t frame , mspriteframedesc_t * pdesc , int anglenum )
2004-08-22 22:29:09 +00:00
{
mspriteframe_t * pframe ;
if ( ! anglenum )
{
pdesc - > type = SPR_SINGLE ;
2014-10-05 20:04:11 +00:00
pdesc - > frameptr = pframe = ZG_Malloc ( & mod - > memgroup , sizeof ( * pframe ) ) ;
2004-08-22 22:29:09 +00:00
}
else
{
mspritegroup_t * group ;
if ( ! pdesc - > frameptr | | pdesc - > type ! = SPR_ANGLED )
{
pdesc - > type = SPR_ANGLED ;
2014-10-05 20:04:11 +00:00
group = ZG_Malloc ( & mod - > memgroup , sizeof ( * group ) + sizeof ( mspriteframe_t * ) * ( 8 - 1 ) ) ;
2004-08-22 22:29:09 +00:00
pdesc - > frameptr = ( mspriteframe_t * ) group ;
group - > numframes = 8 ;
}
else
group = ( mspritegroup_t * ) pdesc - > frameptr ;
2014-10-05 20:04:11 +00:00
pframe = ZG_Malloc ( & mod - > memgroup , sizeof ( * pframe ) ) ;
2004-08-22 22:29:09 +00:00
group - > frames [ anglenum - 1 ] = pframe ;
}
2017-07-13 10:44:54 +00:00
* pframe = frame ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = = =
Doom Sprites
= = = = = = = = = = = = = = = = =
*/
2013-07-14 12:22:51 +00:00
void Mod_LoadDoomSprite ( model_t * mod )
2004-08-22 22:29:09 +00:00
{
char files [ 16384 ] ;
char basename [ MAX_QPATH ] ;
int baselen ;
char * name ;
int numframes = 0 ;
int ofs ;
int size ;
int elements = 0 ;
int framenum ;
int anglenum ;
msprite_t * psprite ;
2017-07-13 10:44:54 +00:00
unsigned int image [ 256 * 256 ] ;
size_t fsize ;
qbyte palette [ 256 * 4 ] ;
doomimage_t * header ;
qbyte * coldata , fr , rc ;
mspriteframe_t frame ;
size_t c ;
unsigned int * colpointers ;
2017-07-28 01:49:25 +00:00
vec3_t t ;
2017-07-13 10:44:54 +00:00
mod - > type = mod_dummy ;
2004-08-22 22:29:09 +00:00
2006-05-12 21:02:56 +00:00
COM_StripExtension ( mod - > name , basename , sizeof ( basename ) ) ;
2004-08-22 22:29:09 +00:00
baselen = strlen ( basename ) ;
strcat ( basename , " * " ) ;
* ( int * ) files = 4 ;
COM_EnumerateFiles ( basename , FindDoomSprites , files ) ;
//find maxframes and validate the rest.
for ( ofs = 4 ; ofs < * ( int * ) files ; ofs + = strlen ( files + ofs ) + 1 )
{
name = files + ofs + baselen ;
if ( ! * name )
Host_Error ( " Doom sprite componant lacks frame name " ) ;
if ( * name - ' a ' + 1 > numframes )
numframes = * name - ' a ' + 1 ;
if ( name [ 1 ] < ' 0 ' | | name [ 1 ] > ' 8 ' )
Host_Error ( " Doom sprite componant has bad angle number " ) ;
if ( name [ 1 ] = = ' 0 ' )
elements + = 8 ;
else
elements + + ;
if ( name [ 2 ] ) //is there a second element?
{
if ( name [ 2 ] - ' a ' + 1 > numframes )
numframes = name [ 2 ] - ' a ' + 1 ;
if ( name [ 3 ] < ' 0 ' | | name [ 3 ] > ' 8 ' )
Host_Error ( " Doom sprite componant has bad angle number " ) ;
if ( name [ 3 ] = = ' 0 ' )
elements + = 8 ;
else
elements + + ;
}
}
if ( elements ! = numframes * 8 )
2017-07-13 10:44:54 +00:00
Con_Printf ( " Doom sprite %s has wrong componant count " , mod - > name ) ;
else if ( numframes )
{
size = sizeof ( msprite_t ) + ( elements - 1 ) * sizeof ( psprite - > frames ) ;
psprite = ZG_Malloc ( & mod - > memgroup , size ) ;
2004-08-22 22:29:09 +00:00
2017-07-13 10:44:54 +00:00
psprite - > numframes = numframes ;
2004-08-22 22:29:09 +00:00
2017-07-13 10:44:54 +00:00
memset ( & frame , 0 , sizeof ( frame ) ) ;
coldata = FS_LoadMallocFile ( " wad/playpal " , & fsize ) ;
if ( coldata & & fsize > = 256 * 3 )
{ //expand to 32bit.
for ( ofs = 0 ; ofs < 256 ; ofs + + )
{
palette [ ofs * 4 + 0 ] = coldata [ ofs * 3 + 0 ] ;
palette [ ofs * 4 + 1 ] = coldata [ ofs * 3 + 1 ] ;
palette [ ofs * 4 + 2 ] = coldata [ ofs * 3 + 2 ] ;
palette [ ofs * 4 + 3 ] = 255 ;
}
}
Z_Free ( coldata ) ;
2004-08-22 22:29:09 +00:00
2017-07-28 01:49:25 +00:00
ClearBounds ( mod - > mins , mod - > maxs ) ;
2017-07-13 10:44:54 +00:00
//do the actual loading.
for ( ofs = 4 ; ofs < * ( int * ) files ; ofs + = strlen ( files + ofs ) + 1 )
{
name = files + ofs ;
2004-08-22 22:29:09 +00:00
2017-07-13 10:44:54 +00:00
header = ( doomimage_t * ) FS_LoadMallocFile ( name , & fsize ) ;
2017-07-28 01:49:25 +00:00
//the 5 is because doom likes drawing sprites slightly downwards, in the floor.
frame . up = header - > ypos + 5 ;
frame . down = header - > ypos - header - > height + 5 ;
2017-07-13 10:44:54 +00:00
frame . left = - header - > xpos ;
frame . right = header - > width - header - > xpos ;
2004-08-22 22:29:09 +00:00
2017-07-31 17:15:37 +00:00
t [ 0 ] = t [ 1 ] = max ( fabs ( frame . left ) , fabs ( frame . right ) ) ;
2017-07-28 01:49:25 +00:00
t [ 2 ] = frame . up ;
AddPointToBounds ( t , mod - > mins , mod - > maxs ) ;
t [ 0 ] * = - 1 ;
t [ 1 ] * = - 1 ;
t [ 2 ] = frame . down ;
2004-08-22 22:29:09 +00:00
2017-07-13 10:44:54 +00:00
if ( header - > width * header - > height < = sizeof ( image ) )
{
//anything not written will be transparent.
memset ( image , 0 , header - > width * header - > height * 4 ) ;
colpointers = ( unsigned int * ) ( header + 1 ) ;
for ( c = 0 ; c < header - > width ; c + + )
{
coldata = ( qbyte * ) header + colpointers [ c ] ;
while ( 1 )
{
fr = * coldata + + ;
if ( fr = = 255 )
break ;
rc = * coldata + + ;
coldata + + ;
if ( ( fr + rc ) > header - > height )
break ;
while ( rc )
{
image [ c + fr * header - > width ] = ( ( unsigned int * ) palette ) [ * coldata + + ] ;
fr + + ;
rc - - ;
}
coldata + + ;
}
}
frame . image = Image_GetTexture ( name , NULL , IF_CLAMP | IF_NOREPLACE , image , palette , header - > width , header - > height , TF_RGBA32 ) ;
Z_Free ( header ) ;
}
framenum = name [ baselen + 0 ] - ' a ' ;
anglenum = name [ baselen + 1 ] - ' 0 ' ;
frame . xmirror = false ;
LoadDoomSpriteFrame ( mod , frame , & psprite - > frames [ framenum ] , anglenum ) ;
if ( name [ baselen + 2 ] ) //is there a second element?
{
framenum = name [ baselen + 2 ] - ' a ' ;
anglenum = name [ baselen + 3 ] - ' 0 ' ;
frame . xmirror = true ;
LoadDoomSpriteFrame ( mod , frame , & psprite - > frames [ framenum ] , anglenum ) ;
}
2004-08-22 22:29:09 +00:00
}
2017-07-13 10:44:54 +00:00
psprite - > type = SPR_FACING_UPRIGHT ;
mod - > numframes = numframes ;
mod - > type = mod_sprite ;
2004-08-22 22:29:09 +00:00
2017-07-13 10:44:54 +00:00
mod - > meshinfo = psprite ;
}
2004-08-22 22:29:09 +00:00
}
# endif
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
# endif
2004-08-22 22:29:09 +00:00
//=============================================================================
/*
= = = = = = = = = = = = = = = =
Mod_Print
= = = = = = = = = = = = = = = =
*/
2013-07-14 12:22:51 +00:00
void Mod_Print ( void )
2004-08-22 22:29:09 +00:00
{
int i ;
model_t * mod ;
Con_Printf ( " Cached models: \n " ) ;
for ( i = 0 , mod = mod_known ; i < mod_numknown ; i + + , mod + + )
{
2013-07-14 12:22:51 +00:00
Con_Printf ( " %8p : %s \n " , mod - > meshinfo , mod - > name ) ;
2004-08-22 22:29:09 +00:00
}
}
2004-12-15 19:53:30 +00:00
# endif