Compare commits

...

18 Commits

Author SHA1 Message Date
Alibek Omarov
30d1492b93 engine: remove Set/GetCurrentLoadingModel from RefAPI 2023-10-28 15:22:21 +03:00
Alibek Omarov
f07eea5073 engine: server: allow server unloading for Win32 targets until we figure out the issues with MetaMod 2023-10-28 11:14:12 +03:00
Alibek Omarov
fe407fbe00 public: workaround when empty string is passed to COM_ExtractFilePath (should make safe COM_ExtractFilePath) 2023-10-28 11:06:18 +03:00
Alibek Omarov
78bc177e05 engine: server: remove unused host struct field 2023-10-28 11:06:18 +03:00
Alibek Omarov
8fb908e3d4 engine: server: disable SV_UnloadProgs, only call it when shutting down engine 2023-10-28 11:06:18 +03:00
Alibek Omarov
d8b261370a engine: common: do not probe server to collect cvars for game.cfg (CHECK THIS) 2023-10-28 11:06:18 +03:00
Alibek Omarov
a2c9ac5b1f engine: client: disable server DLL probe for GameUI, check it's existence instead 2023-10-28 11:06:18 +03:00
Alibek Omarov
7f9025e178 engine: server: sv_pmove: use model name for physent name to avoid crash when classname isn't initialized yet 2023-10-28 11:04:43 +03:00
Alibek Omarov
8647110a10 Revert "engine: wscript: move libasound uselib under linux condition, as the ALSA interface is only relevant for Linux"
This reverts commit 48e44f0057.
2023-10-28 10:10:03 +03:00
Alibek Omarov
48e44f0057 engine: wscript: move libasound uselib under linux condition, as the ALSA interface is only relevant for Linux 2023-10-27 17:03:04 +03:00
Alibek Omarov
e3934af7d1 wscript: always load cmakelists generation tool 2023-10-27 16:57:22 +03:00
Alibek Omarov
a5ee631191 engine: server: sv_game: disable searching closer to server library memory region for Android 2023-10-27 14:31:16 +03:00
Alibek Omarov
ce39255ef0 engine: host: set rootdir on Android SDL port 2023-10-27 14:25:16 +03:00
Alibek Omarov
5aac5d2a52 filesystem: VFileSystem009: add pathid support to RemoveFile method 2023-10-27 08:02:45 +03:00
Alibek Omarov
061b50404d engine: server: register dummy cvar sv_allow_dlfile for GoldSrc compatibility 2023-10-27 08:02:10 +03:00
Alibek Omarov
279cec5ae9 engine: rename cl/sv_allowdownload for GoldSrc compatibility 2023-10-27 07:25:09 +03:00
Alibek Omarov
83a5648335 filesystem: only allow setting true or false for boolean type keys in gameinfo/liblist.gam 2023-10-27 07:24:42 +03:00
Alibek Omarov
a8fc9a4c5a waf: update to latest waifu 2023-10-27 07:24:18 +03:00
23 changed files with 81 additions and 110 deletions

View File

@@ -982,28 +982,21 @@ pfnCheckGameDll
*/ */
int GAME_EXPORT pfnCheckGameDll( void ) int GAME_EXPORT pfnCheckGameDll( void )
{ {
string dllpath; #if XASH_INTERNAL_GAMELIBS
void *hInst;
#if TARGET_OS_IPHONE
// loading server library drains too many ram
// so 512MB iPod Touch cannot even connect to
// to servers in cstrike
return true; return true;
#endif #else
string dllpath;
if( svgame.hInstance ) if( svgame.hInstance )
return true; return true;
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath )); COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL ) if( FS_FileExists( dllpath, false ))
{
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
return true; return true;
}
Con_Reportf( S_WARN "Could not load server library: %s\n", COM_GetLibraryError() );
return false; return false;
#endif
} }
/* /*

View File

@@ -34,7 +34,7 @@ GNU General Public License for more details.
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" ); CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
CVAR_DEFINE_AUTO( dev_overview, "0", 0, "draw level in overview-mode" ); CVAR_DEFINE_AUTO( dev_overview, "0", 0, "draw level in overview-mode" );
CVAR_DEFINE_AUTO( cl_resend, "6.0", 0, "time to resend connect" ); CVAR_DEFINE_AUTO( cl_resend, "6.0", 0, "time to resend connect" );
CVAR_DEFINE_AUTO( cl_allow_download, "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" ); CVAR_DEFINE( cl_allow_download, "cl_allowdownload", "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
CVAR_DEFINE_AUTO( cl_allow_upload, "1", FCVAR_ARCHIVE, "allow to uploading resources to the server" ); CVAR_DEFINE_AUTO( cl_allow_upload, "1", FCVAR_ARCHIVE, "allow to uploading resources to the server" );
CVAR_DEFINE_AUTO( cl_download_ingame, "1", FCVAR_ARCHIVE, "allow to downloading resources while client is active" ); CVAR_DEFINE_AUTO( cl_download_ingame, "1", FCVAR_ARCHIVE, "allow to downloading resources while client is active" );
CVAR_DEFINE_AUTO( cl_logofile, "lambda", FCVAR_ARCHIVE, "player logo name" ); CVAR_DEFINE_AUTO( cl_logofile, "lambda", FCVAR_ARCHIVE, "player logo name" );

View File

@@ -98,16 +98,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
return NULL; return NULL;
} }
static model_t *pfnMod_GetCurrentLoadingModel( void )
{
return loadmodel;
}
static void pfnMod_SetCurrentLoadingModel( model_t *m )
{
loadmodel = m;
}
static void pfnGetPredictedOrigin( vec3_t v ) static void pfnGetPredictedOrigin( vec3_t v )
{ {
VectorCopy( cl.simorg, v ); VectorCopy( cl.simorg, v );
@@ -282,8 +272,6 @@ static ref_api_t gEngfuncs =
Mod_ForName, Mod_ForName,
pfnMod_Extradata, pfnMod_Extradata,
CL_ModelHandle, CL_ModelHandle,
pfnMod_GetCurrentLoadingModel,
pfnMod_SetCurrentLoadingModel,
CL_GetRemapInfoForEntity, CL_GetRemapInfoForEntity,
CL_AllocRemapInfo, CL_AllocRemapInfo,

View File

@@ -747,8 +747,6 @@ void SV_ShutdownGame( void );
void SV_ExecLoadLevel( void ); void SV_ExecLoadLevel( void );
void SV_ExecLoadGame( void ); void SV_ExecLoadGame( void );
void SV_ExecChangeLevel( void ); void SV_ExecChangeLevel( void );
qboolean SV_InitGameProgs( void );
void SV_FreeGameProgs( void );
void CL_WriteMessageHistory( void ); void CL_WriteMessageHistory( void );
void CL_SendCmd( void ); void CL_SendCmd( void );
void CL_Disconnect( void ); void CL_Disconnect( void );

View File

@@ -1423,15 +1423,11 @@ save serverinfo variables into server.cfg (using for dedicated server too)
*/ */
void GAME_EXPORT Host_WriteServerConfig( const char *name ) void GAME_EXPORT Host_WriteServerConfig( const char *name )
{ {
qboolean already_loaded;
file_t *f; file_t *f;
string newconfigfile; string newconfigfile;
Q_snprintf( newconfigfile, MAX_STRING, "%s.new", name ); Q_snprintf( newconfigfile, MAX_STRING, "%s.new", name );
// TODO: remove this mechanism, make it safer for now
already_loaded = SV_InitGameProgs(); // collect user variables
// FIXME: move this out until menu parser is done // FIXME: move this out until menu parser is done
CSCR_LoadDefaultCVars( "settings.scr" ); CSCR_LoadDefaultCVars( "settings.scr" );
@@ -1448,10 +1444,6 @@ void GAME_EXPORT Host_WriteServerConfig( const char *name )
Host_FinalizeConfig( f, name ); Host_FinalizeConfig( f, name );
} }
else Con_DPrintf( S_ERROR "Couldn't write %s.\n", name ); else Con_DPrintf( S_ERROR "Couldn't write %s.\n", name );
// don't unload library that wasn't loaded by us
if( !already_loaded )
SV_FreeGameProgs(); // release progs with all variables
} }
/* /*

View File

@@ -33,6 +33,7 @@ GNU General Public License for more details.
#include "common.h" #include "common.h"
#include "base_cmd.h" #include "base_cmd.h"
#include "client.h" #include "client.h"
#include "server.h"
#include "netchan.h" #include "netchan.h"
#include "protocol.h" #include "protocol.h"
#include "mod_local.h" #include "mod_local.h"
@@ -1017,10 +1018,11 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
else else
{ {
#if TARGET_OS_IOS #if TARGET_OS_IOS
const char *IOS_GetDocsDir(); Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof( host.rootdir ));
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) ); #elif XASH_ANDROID && XASH_SDL
Q_strncpy( host.rootdir, SDL_AndroidGetExternalStoragePath, sizeof( host.rootdir ));
#elif XASH_PSVITA #elif XASH_PSVITA
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir ) ) ) if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir )))
{ {
Sys_Error( "couldn't find xash3d data directory" ); Sys_Error( "couldn't find xash3d data directory" );
host.rootdir[0] = 0; host.rootdir[0] = 0;
@@ -1307,6 +1309,7 @@ void EXPORT Host_Shutdown( void )
#endif #endif
SV_Shutdown( "Server shutdown\n" ); SV_Shutdown( "Server shutdown\n" );
SV_UnloadProgs();
SV_ShutdownFilter(); SV_ShutdownFilter();
CL_Shutdown(); CL_Shutdown();

View File

@@ -2505,7 +2505,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
#if !XASH_DEDICATED // TODO: Do we need subdivide on server? #if !XASH_DEDICATED // TODO: Do we need subdivide on server?
if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() ) if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() )
ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps ref.dllFuncs.GL_SubdivideSurface( loadmodel, out ); // cut up polygon for warps
#endif #endif
} }

View File

@@ -37,6 +37,11 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak
void Platform_SetStatus( const char *status ); void Platform_SetStatus( const char *status );
// legacy iOS port functions
#if TARGET_OS_IOS
const char *IOS_GetDocsDir( void );
#endif // TARGET_OS_IOS
#if XASH_WIN32 || XASH_LINUX #if XASH_WIN32 || XASH_LINUX
#define XASH_PLATFORM_HAVE_STATUS 1 #define XASH_PLATFORM_HAVE_STATUS 1
#else #else

View File

@@ -330,8 +330,6 @@ typedef struct ref_api_s
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC ); model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
void *(*Mod_Extradata)( int type, model_t *model ); void *(*Mod_Extradata)( int type, model_t *model );
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
struct model_s *(*Mod_GetCurrentLoadingModel)( void ); // loadmodel
void (*Mod_SetCurrentLoadingModel)( struct model_s* ); // loadmodel
// remap // remap
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e ); struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
@@ -506,7 +504,7 @@ typedef struct ref_interface_s
// bmodel // bmodel
void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette ); void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette );
void (*GL_SubdivideSurface)( msurface_t *fa ); void (*GL_SubdivideSurface)( model_t *mod, msurface_t *fa );
void (*CL_RunLightStyles)( void ); void (*CL_RunLightStyles)( void );
// sprites // sprites

View File

@@ -360,7 +360,6 @@ typedef struct
typedef struct typedef struct
{ {
qboolean initialized; // sv_init has completed qboolean initialized; // sv_init has completed
qboolean game_library_loaded; // is game library loaded in SV_InitGame
double timestart; // just for profiling double timestart; // just for profiling
int maxclients; // server max clients int maxclients; // server max clients

View File

@@ -3031,7 +3031,7 @@ void SV_SetStringArrayMode( qboolean dynamic )
#endif #endif
} }
#if XASH_64BIT && !XASH_WIN32 && !XASH_APPLE && !XASH_NSWITCH #if XASH_64BIT && !XASH_WIN32 && !XASH_APPLE && !XASH_NSWITCH && !XASH_ANDROID
#define USE_MMAP #define USE_MMAP
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
@@ -5130,7 +5130,6 @@ void SV_UnloadProgs( void )
Mod_ResetStudioAPI (); Mod_ResetStudioAPI ();
svs.game_library_loaded = false;
COM_FreeLibrary( svgame.hInstance ); COM_FreeLibrary( svgame.hInstance );
Mem_FreePool( &svgame.mempool ); Mem_FreePool( &svgame.mempool );
memset( &svgame, 0, sizeof( svgame )); memset( &svgame, 0, sizeof( svgame ));
@@ -5148,7 +5147,14 @@ qboolean SV_LoadProgs( const char *name )
static playermove_t gpMove; static playermove_t gpMove;
edict_t *e; edict_t *e;
if( svgame.hInstance ) SV_UnloadProgs(); if( svgame.hInstance )
{
#if XASH_WIN32
SV_UnloadProgs();
#else // XASH_WIN32
return true;
#endif // XASH_WIN32
}
// fill it in // fill it in
svgame.pmove = &gpMove; svgame.pmove = &gpMove;

View File

@@ -706,7 +706,7 @@ qboolean SV_InitGame( void )
{ {
string dllpath; string dllpath;
if( svs.game_library_loaded ) if( svgame.hInstance )
return true; return true;
// first initialize? // first initialize?
@@ -721,7 +721,6 @@ qboolean SV_InitGame( void )
} }
// client frames will be allocated in SV_ClientConnect // client frames will be allocated in SV_ClientConnect
svs.game_library_loaded = true;
return true; return true;
} }
@@ -1115,28 +1114,6 @@ int SV_GetMaxClients( void )
return svs.maxclients; return svs.maxclients;
} }
qboolean SV_InitGameProgs( void )
{
string dllpath;
if( svgame.hInstance ) return true; // already loaded
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
// just try to initialize
SV_LoadProgs( dllpath );
return false;
}
void SV_FreeGameProgs( void )
{
if( svs.initialized ) return; // server is active
// unload progs (free cvars and commands)
SV_UnloadProgs();
}
/* /*
================ ================
SV_ExecLoadLevel SV_ExecLoadLevel

View File

@@ -48,7 +48,8 @@ CVAR_DEFINE_AUTO( sv_send_logos, "1", 0, "send custom decal logo to other player
CVAR_DEFINE_AUTO( sv_send_resources, "1", 0, "allow to download missed resources for players" ); CVAR_DEFINE_AUTO( sv_send_resources, "1", 0, "allow to download missed resources for players" );
CVAR_DEFINE_AUTO( sv_logbans, "0", 0, "print into the server log info about player bans" ); CVAR_DEFINE_AUTO( sv_logbans, "0", 0, "print into the server log info about player bans" );
CVAR_DEFINE_AUTO( sv_allow_upload, "1", FCVAR_SERVER, "allow uploading custom resources on a server" ); CVAR_DEFINE_AUTO( sv_allow_upload, "1", FCVAR_SERVER, "allow uploading custom resources on a server" );
CVAR_DEFINE_AUTO( sv_allow_download, "1", FCVAR_SERVER, "allow downloading custom resources to the client" ); CVAR_DEFINE( sv_allow_download, "sv_allowdownload", "1", FCVAR_SERVER, "allow downloading custom resources to the client" );
static CVAR_DEFINE_AUTO( sv_allow_dlfile, "1", 0, "compatibility cvar, does nothing" );
CVAR_DEFINE_AUTO( sv_uploadmax, "0.5", FCVAR_SERVER, "max size to upload custom resources (500 kB as default)" ); CVAR_DEFINE_AUTO( sv_uploadmax, "0.5", FCVAR_SERVER, "max size to upload custom resources (500 kB as default)" );
CVAR_DEFINE_AUTO( sv_downloadurl, "", FCVAR_PROTECTED, "location from which clients can download missing files" ); CVAR_DEFINE_AUTO( sv_downloadurl, "", FCVAR_PROTECTED, "location from which clients can download missing files" );
CVAR_DEFINE( sv_consistency, "mp_consistency", "1", FCVAR_SERVER, "enbale consistency check in multiplayer" ); CVAR_DEFINE( sv_consistency, "mp_consistency", "1", FCVAR_SERVER, "enbale consistency check in multiplayer" );
@@ -925,6 +926,7 @@ void SV_Init( void )
Cvar_RegisterVariable( &sv_unlagsamples ); Cvar_RegisterVariable( &sv_unlagsamples );
Cvar_RegisterVariable( &sv_allow_upload ); Cvar_RegisterVariable( &sv_allow_upload );
Cvar_RegisterVariable( &sv_allow_download ); Cvar_RegisterVariable( &sv_allow_download );
Cvar_RegisterVariable( &sv_allow_dlfile );
Cvar_RegisterVariable( &sv_send_logos ); Cvar_RegisterVariable( &sv_send_logos );
Cvar_RegisterVariable( &sv_send_resources ); Cvar_RegisterVariable( &sv_send_resources );
Cvar_RegisterVariable( &sv_uploadmax ); Cvar_RegisterVariable( &sv_uploadmax );
@@ -1089,7 +1091,9 @@ void SV_Shutdown( const char *finalmsg )
if( CL_IsPlaybackDemo( )) if( CL_IsPlaybackDemo( ))
CL_Drop(); CL_Drop();
SV_UnloadProgs (); #if XASH_WIN32
SV_UnloadProgs();
#endif // XASH_WIN32
return; return;
} }
@@ -1106,7 +1110,10 @@ void SV_Shutdown( const char *finalmsg )
NET_MasterShutdown(); NET_MasterShutdown();
NET_Config( false, false ); NET_Config( false, false );
SV_UnloadProgs (); SV_DeactivateServer();
#if XASH_WIN32
SV_UnloadProgs();
#endif // XASH_WIN32
CL_Drop(); CL_Drop();
// free current level // free current level

View File

@@ -80,8 +80,8 @@ static qboolean SV_CopyEdictToPhysEnt( physent_t *pe, edict_t *ed )
} }
else else
{ {
// otherwise copy the classname // otherwise copy the modelname
Q_strncpy( pe->name, STRING( ed->v.classname ), sizeof( pe->name )); Q_strncpy( pe->name, mod->name, sizeof( pe->name ));
} }
pe->model = pe->studiomodel = NULL; pe->model = pe->studiomodel = NULL;

View File

@@ -150,7 +150,10 @@ public:
void RemoveFile( const char *path, const char *id ) override void RemoveFile( const char *path, const char *id ) override
{ {
FS_Delete( path ); // FS_Delete is aware of slashes char dir[MAX_VA_STRING], fullpath[MAX_VA_STRING];
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", IdToDir( dir, sizeof( dir ), id ), path );
FS_Delete( fullpath ); // FS_Delete is aware of slashes
} }
void CreateDirHierarchy( const char *path, const char *id ) override void CreateDirHierarchy( const char *path, const char *id ) override

View File

@@ -770,13 +770,13 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
else if( !Q_stricmp( token, "secure" )) else if( !Q_stricmp( token, "secure" ))
{ {
pfile = COM_ParseFile( pfile, token, sizeof( token )); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->secure = Q_atoi( token ); GameInfo->secure = Q_atoi( token ) ? true : false;
} }
// valid for both // valid for both
else if( !Q_stricmp( token, "nomodels" )) else if( !Q_stricmp( token, "nomodels" ))
{ {
pfile = COM_ParseFile( pfile, token, sizeof( token )); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->nomodels = Q_atoi( token ); GameInfo->nomodels = Q_atoi( token ) ? true : false;
} }
else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" )) else if( !Q_stricmp( token, isGameInfo ? "max_edicts" : "edicts" ))
{ {
@@ -844,17 +844,17 @@ void FS_ParseGenericGameInfo( gameinfo_t *GameInfo, const char *buf, const qbool
else if( !Q_stricmp( token, "noskills" )) else if( !Q_stricmp( token, "noskills" ))
{ {
pfile = COM_ParseFile( pfile, token, sizeof( token )); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->noskills = Q_atoi( token ); GameInfo->noskills = Q_atoi( token ) ? true : false;
} }
else if( !Q_stricmp( token, "render_picbutton_text" )) else if( !Q_stricmp( token, "render_picbutton_text" ))
{ {
pfile = COM_ParseFile( pfile, token, sizeof( token )); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->render_picbutton_text = Q_atoi( token ); GameInfo->render_picbutton_text = Q_atoi( token ) ? true : false;
} }
else if( !Q_stricmp( token, "internal_vgui_support" )) else if( !Q_stricmp( token, "internal_vgui_support" ))
{ {
pfile = COM_ParseFile( pfile, token, sizeof( token )); pfile = COM_ParseFile( pfile, token, sizeof( token ));
GameInfo->internal_vgui_support = Q_atoi( token ); GameInfo->internal_vgui_support = Q_atoi( token ) ? true : false;
} }
else if( !Q_stricmp( token, "quicksave_aged_count" )) else if( !Q_stricmp( token, "quicksave_aged_count" ))
{ {

View File

@@ -642,7 +642,14 @@ COM_ExtractFilePath
*/ */
void COM_ExtractFilePath( const char *path, char *dest ) void COM_ExtractFilePath( const char *path, char *dest )
{ {
const char *src = path + Q_strlen( path ) - 1; size_t len = Q_strlen( path );
const char *src = path + len - 1;
if( len == 0 )
{
dest[0] = 0;
return;
}
// back up until a \ or the start // back up until a \ or the start
while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' )) while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' ))

View File

@@ -418,7 +418,6 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
static rgbdata_t skin; static rgbdata_t skin;
char name[MAX_QPATH]; char name[MAX_QPATH];
int i; int i;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
skin.width = width; skin.width = width;
skin.height = height; skin.height = height;
@@ -443,7 +442,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
} }
} }
COM_FileBase( loadmodel->name, name, sizeof( name )); COM_FileBase( mod->name, name, sizeof( name ));
// for alias models only player can have remap textures // for alias models only player can have remap textures
if( mod != NULL && !Q_stricmp( name, "player" )) if( mod != NULL && !Q_stricmp( name, "player" ))
@@ -476,12 +475,11 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
return gEngfuncs.FS_CopyImage( &skin ); return gEngfuncs.FS_CopyImage( &skin );
} }
void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size ) void *Mod_LoadSingleSkin( model_t *loadmodel, daliasskintype_t *pskintype, int skinnum, int size )
{ {
string name, lumaname; string name, lumaname;
string checkname; string checkname;
rgbdata_t *pic; rgbdata_t *pic;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum ); Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum ); Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
@@ -508,14 +506,13 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
return ((byte *)(pskintype + 1) + size); return ((byte *)(pskintype + 1) + size);
} }
void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size ) void *Mod_LoadGroupSkin( model_t *loadmodel, daliasskintype_t *pskintype, int skinnum, int size )
{ {
daliasskininterval_t *pinskinintervals; daliasskininterval_t *pinskinintervals;
daliasskingroup_t *pinskingroup; daliasskingroup_t *pinskingroup;
string name, lumaname; string name, lumaname;
rgbdata_t *pic; rgbdata_t *pic;
int i, j; int i, j;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
// animating skin group. yuck. // animating skin group. yuck.
pskintype++; pskintype++;
@@ -555,7 +552,7 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
Mod_LoadAllSkins Mod_LoadAllSkins
=============== ===============
*/ */
void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype ) void *Mod_LoadAllSkins( model_t *mod, int numskins, daliasskintype_t *pskintype )
{ {
int i, size; int i, size;
@@ -568,11 +565,11 @@ void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
{ {
if( pskintype->type == ALIAS_SKIN_SINGLE ) if( pskintype->type == ALIAS_SKIN_SINGLE )
{ {
pskintype = (daliasskintype_t *)Mod_LoadSingleSkin( pskintype, i, size ); pskintype = (daliasskintype_t *)Mod_LoadSingleSkin( mod, pskintype, i, size );
} }
else else
{ {
pskintype = (daliasskintype_t *)Mod_LoadGroupSkin( pskintype, i, size ); pskintype = (daliasskintype_t *)Mod_LoadGroupSkin( mod, pskintype, i, size );
} }
} }
@@ -680,7 +677,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
// load the skins // load the skins
pskintype = (daliasskintype_t *)&pinmodel[1]; pskintype = (daliasskintype_t *)&pinmodel[1];
pskintype = Mod_LoadAllSkins( m_pAliasHeader->numskins, pskintype ); pskintype = Mod_LoadAllSkins( mod, m_pAliasHeader->numskins, pskintype );
// load base s and t vertices // load base s and t vertices
pinstverts = (stvert_t *)pskintype; pinstverts = (stvert_t *)pskintype;
@@ -725,7 +722,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
GL_MakeAliasModelDisplayLists( mod ); GL_MakeAliasModelDisplayLists( mod );
// move the complete, relocatable alias model to the cache // move the complete, relocatable alias model to the cache
gEngfuncs.Mod_GetCurrentLoadingModel()->cache.data = m_pAliasHeader; mod->cache.data = m_pAliasHeader;
if( loaded ) *loaded = true; // done if( loaded ) *loaded = true; // done
} }

View File

@@ -426,7 +426,7 @@ void R_MarkLeaves( void );
void R_DrawWorld( void ); void R_DrawWorld( void );
void R_DrawWaterSurfaces( void ); void R_DrawWaterSurfaces( void );
void R_DrawBrushModel( cl_entity_t *e ); void R_DrawBrushModel( cl_entity_t *e );
void GL_SubdivideSurface( msurface_t *fa ); void GL_SubdivideSurface( model_t *mod, msurface_t *fa );
void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa ); void GL_BuildPolygonFromSurface( model_t *mod, msurface_t *fa );
void DrawGLPoly( glpoly_t *p, float xScale, float yScale ); void DrawGLPoly( glpoly_t *p, float xScale, float yScale );
texture_t *R_TextureAnimation( msurface_t *s ); texture_t *R_TextureAnimation( msurface_t *s );

View File

@@ -78,7 +78,7 @@ static void BoundPoly( int numverts, float *verts, vec3_t mins, vec3_t maxs )
} }
} }
static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts ) static void SubdividePolygon_r( model_t *loadmodel, msurface_t *warpface, int numverts, float *verts )
{ {
vec3_t front[SUBDIVIDE_SIZE], back[SUBDIVIDE_SIZE]; vec3_t front[SUBDIVIDE_SIZE], back[SUBDIVIDE_SIZE];
mextrasurf_t *warpinfo = warpface->info; mextrasurf_t *warpinfo = warpface->info;
@@ -88,7 +88,6 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
float sample_size; float sample_size;
vec3_t mins, maxs; vec3_t mins, maxs;
glpoly_t *poly; glpoly_t *poly;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
if( numverts > ( SUBDIVIDE_SIZE - 4 )) if( numverts > ( SUBDIVIDE_SIZE - 4 ))
gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts ); gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts );
@@ -143,8 +142,8 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
} }
} }
SubdividePolygon_r( warpface, f, front[0] ); SubdividePolygon_r( loadmodel, warpface, f, front[0] );
SubdividePolygon_r( warpface, b, back[0] ); SubdividePolygon_r( loadmodel, warpface, b, back[0] );
return; return;
} }
@@ -238,13 +237,12 @@ boundaries so that turbulent and sky warps
can be done reasonably. can be done reasonably.
================ ================
*/ */
void GL_SubdivideSurface( msurface_t *fa ) void GL_SubdivideSurface( model_t *loadmodel, msurface_t *fa )
{ {
vec3_t verts[SUBDIVIDE_SIZE]; vec3_t verts[SUBDIVIDE_SIZE];
int numverts; int numverts;
int i, lindex; int i, lindex;
float *vec; float *vec;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
// convert edges back to a normal polygon // convert edges back to a normal polygon
numverts = 0; numverts = 0;
@@ -261,7 +259,7 @@ void GL_SubdivideSurface( msurface_t *fa )
SetBits( fa->flags, SURF_DRAWTURB_QUADS ); // predict state SetBits( fa->flags, SURF_DRAWTURB_QUADS ); // predict state
// do subdivide // do subdivide
SubdividePolygon_r( fa, numverts, verts[0] ); SubdividePolygon_r( loadmodel, fa, numverts, verts[0] );
} }
/* /*

View File

@@ -329,7 +329,7 @@ void R_InitSkyClouds(mip_t *mt, texture_t *tx, qboolean custom_palette)
} }
void GAME_EXPORT GL_SubdivideSurface(msurface_t *fa) void GAME_EXPORT GL_SubdivideSurface( model_t *mod, msurface_t *fa )
{ {
} }

12
waf vendored

File diff suppressed because one or more lines are too long

View File

@@ -167,7 +167,7 @@ def configure(conf):
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64'] conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
# Load compilers early # Load compilers early
conf.load('xshlib xcompile compiler_c compiler_cxx') conf.load('xshlib xcompile compiler_c compiler_cxx cmake')
if conf.options.NSWITCH: if conf.options.NSWITCH:
conf.load('nswitch') conf.load('nswitch')