mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-07 21:10:46 +08:00
Compare commits
48 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2c080e736 | ||
|
|
ea55e78855 | ||
|
|
f7c536b81c | ||
|
|
6c40104c66 | ||
|
|
4d7d592918 | ||
|
|
c5e91f299b | ||
|
|
cff276db71 | ||
|
|
30d1492b93 | ||
|
|
f07eea5073 | ||
|
|
fe407fbe00 | ||
|
|
78bc177e05 | ||
|
|
8fb908e3d4 | ||
|
|
d8b261370a | ||
|
|
a2c9ac5b1f | ||
|
|
7f9025e178 | ||
|
|
8647110a10 | ||
|
|
48e44f0057 | ||
|
|
e3934af7d1 | ||
|
|
a5ee631191 | ||
|
|
ce39255ef0 | ||
|
|
5aac5d2a52 | ||
|
|
061b50404d | ||
|
|
279cec5ae9 | ||
|
|
83a5648335 | ||
|
|
a8fc9a4c5a | ||
|
|
6f6ddbce28 | ||
|
|
4cb425d2bb | ||
|
|
bf5fd40d64 | ||
|
|
6bc613bdb4 | ||
|
|
a982562658 | ||
|
|
96a9172e36 | ||
|
|
34d7664342 | ||
|
|
b0a79df86f | ||
|
|
9e107e900c | ||
|
|
8f819a2fde | ||
|
|
3251b68df5 | ||
|
|
3ac8ad9484 | ||
|
|
b9ca0d4563 | ||
|
|
dcb3da53b0 | ||
|
|
e68b19ed1a | ||
|
|
14c7a84482 | ||
|
|
c1d1aa6787 | ||
|
|
bee81e9723 | ||
|
|
1bfb6c560a | ||
|
|
24d6f1788a | ||
|
|
fb95cc9a97 | ||
|
|
b949da291e | ||
|
|
2ecbe5b67e |
@@ -57,6 +57,7 @@ typedef uint64_t longtime_t;
|
|||||||
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
#define GAMMA ( 2.2f ) // Valve Software gamma
|
||||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
||||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
||||||
|
|||||||
@@ -1124,7 +1124,10 @@ void CL_FinishTimeDemo( void )
|
|||||||
time = host.realtime - cls.td_starttime;
|
time = host.realtime - cls.td_starttime;
|
||||||
if( !time ) time = 1.0;
|
if( !time ) time = 1.0;
|
||||||
|
|
||||||
Con_Printf( "%i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
|
Con_Printf( "timedemo result: %i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
|
||||||
|
|
||||||
|
if( Sys_CheckParm( "-timedemo" ))
|
||||||
|
CL_Quit_f();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -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" );
|
||||||
@@ -2247,10 +2247,13 @@ void CL_ReadNetMessage( void )
|
|||||||
|
|
||||||
while( CL_GetMessage( net_message_buffer, &curSize ))
|
while( CL_GetMessage( net_message_buffer, &curSize ))
|
||||||
{
|
{
|
||||||
if( cls.legacymode && *((int *)&net_message_buffer) == 0xFFFFFFFE )
|
const int split_header = LittleLong( 0xFFFFFFFE );
|
||||||
|
if( cls.legacymode && !memcmp( &split_header, net_message_buffer, sizeof( split_header )))
|
||||||
|
{
|
||||||
// Will rewrite existing packet by merged
|
// Will rewrite existing packet by merged
|
||||||
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
|
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
|
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
|
||||||
|
|
||||||
|
|||||||
@@ -1534,7 +1534,8 @@ void CL_SendConsistencyInfo( sizebuf_t *msg )
|
|||||||
{
|
{
|
||||||
case force_exactfile:
|
case force_exactfile:
|
||||||
MD5_HashFile( md5, filename, NULL );
|
MD5_HashFile( md5, filename, NULL );
|
||||||
pc->value = *(int *)md5;
|
memcpy( &pc->value, md5, sizeof( pc->value ));
|
||||||
|
LittleLongSW( pc->value );
|
||||||
|
|
||||||
if( user_changed_diskfile )
|
if( user_changed_diskfile )
|
||||||
MSG_WriteUBitLong( msg, 0, 32 );
|
MSG_WriteUBitLong( msg, 0, 32 );
|
||||||
|
|||||||
@@ -726,6 +726,7 @@ void SCR_VidInit( void )
|
|||||||
|
|
||||||
// restart console size
|
// restart console size
|
||||||
Con_VidInit ();
|
Con_VidInit ();
|
||||||
|
Touch_NotifyResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1983,7 +1983,7 @@ void Con_DrawConsole( void )
|
|||||||
|
|
||||||
if( cls.state == ca_connecting || cls.state == ca_connected )
|
if( cls.state == ca_connecting || cls.state == ca_connected )
|
||||||
{
|
{
|
||||||
if( !cl_allow_levelshots.value )
|
if( !cl_allow_levelshots.value && !cls.timedemo )
|
||||||
{
|
{
|
||||||
if(( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )) && cls.key_dest != key_console )
|
if(( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )) && cls.key_dest != key_console )
|
||||||
con.vislines = con.showlines = 0;
|
con.vislines = con.showlines = 0;
|
||||||
@@ -1993,7 +1993,7 @@ void Con_DrawConsole( void )
|
|||||||
{
|
{
|
||||||
con.showlines = 0;
|
con.showlines = 0;
|
||||||
|
|
||||||
if( host_developer.value >= DEV_EXTENDED )
|
if( host_developer.value >= DEV_EXTENDED && !cls.timedemo )
|
||||||
Con_DrawNotify(); // draw notify lines
|
Con_DrawNotify(); // draw notify lines
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2025,7 +2025,7 @@ void Con_DrawConsole( void )
|
|||||||
{
|
{
|
||||||
if( con.vislines )
|
if( con.vislines )
|
||||||
Con_DrawSolidConsole( con.vislines );
|
Con_DrawSolidConsole( con.vislines );
|
||||||
else if( cls.state == ca_active && ( cls.key_dest == key_game || cls.key_dest == key_message ))
|
else if( cls.state == ca_active && ( cls.key_dest == key_game || cls.key_dest == key_message ) && !cls.timedemo )
|
||||||
Con_DrawNotify(); // draw notify lines
|
Con_DrawNotify(); // draw notify lines
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ static struct touch_s
|
|||||||
int whitetexture;
|
int whitetexture;
|
||||||
int joytexture; // touch indicator
|
int joytexture; // touch indicator
|
||||||
qboolean configchanged;
|
qboolean configchanged;
|
||||||
|
float actual_aspect_ratio; // maximum aspect ratio from launch, or aspect ratio when entering editor
|
||||||
|
float config_aspect_ratio; // aspect ratio set by command from config or after entering editor
|
||||||
} touch;
|
} touch;
|
||||||
|
|
||||||
// private to the engine flags
|
// private to the engine flags
|
||||||
@@ -168,13 +170,42 @@ CVAR_DEFINE_AUTO( touch_emulate, "0", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "emulate
|
|||||||
#define B(x) (button->x)
|
#define B(x) (button->x)
|
||||||
#define SCR_W ((float)refState.width)
|
#define SCR_W ((float)refState.width)
|
||||||
#define SCR_H ((float)refState.height)
|
#define SCR_H ((float)refState.height)
|
||||||
#define TO_SCRN_Y(x) (refState.height * (x))
|
#define TO_SCRN_Y(x) (refState.width * (x) * Touch_AspectRatio())
|
||||||
#define TO_SCRN_X(x) (refState.width * (x))
|
#define TO_SCRN_X(x) (refState.width * (x))
|
||||||
|
|
||||||
static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 );
|
static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 );
|
||||||
static void IN_TouchEditClear( void );
|
static void IN_TouchEditClear( void );
|
||||||
static void Touch_InitConfig( void );
|
static void Touch_InitConfig( void );
|
||||||
|
|
||||||
|
void Touch_NotifyResize( void )
|
||||||
|
{
|
||||||
|
if( refState.width && refState.height && ( !touch.configchanged || !touch.actual_aspect_ratio ))
|
||||||
|
{
|
||||||
|
float aspect_ratio = SCR_H/SCR_W;
|
||||||
|
if( aspect_ratio < 0.99 && aspect_ratio > touch.actual_aspect_ratio )
|
||||||
|
touch.actual_aspect_ratio = aspect_ratio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline float Touch_AspectRatio( void )
|
||||||
|
{
|
||||||
|
if( touch.config_aspect_ratio )
|
||||||
|
return touch.config_aspect_ratio;
|
||||||
|
else if( touch.actual_aspect_ratio )
|
||||||
|
return touch.actual_aspect_ratio;
|
||||||
|
else if( refState.width && refState.height )
|
||||||
|
return SCR_H/SCR_W;
|
||||||
|
else
|
||||||
|
return 9.0f / 16.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void Touch_ConfigAspectRatio_f( void )
|
||||||
|
{
|
||||||
|
touch.config_aspect_ratio = Q_atof( Cmd_Argv( 1 ));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==========================
|
==========================
|
||||||
Touch_ExportButtonToConfig
|
Touch_ExportButtonToConfig
|
||||||
@@ -206,7 +237,7 @@ static inline int Touch_ExportButtonToConfig( file_t *f, touch_button_t *button,
|
|||||||
|
|
||||||
if( keepAspect )
|
if( keepAspect )
|
||||||
{
|
{
|
||||||
float aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
float aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(Touch_AspectRatio()) );
|
||||||
FS_Printf( f, " %f\n", aspect );
|
FS_Printf( f, " %f\n", aspect );
|
||||||
}
|
}
|
||||||
else FS_Printf( f, "\n" );
|
else FS_Printf( f, "\n" );
|
||||||
@@ -271,6 +302,8 @@ qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
|||||||
FS_Printf( f, "touch_setclientonly 0\n" );
|
FS_Printf( f, "touch_setclientonly 0\n" );
|
||||||
FS_Printf( f, "\n// touch buttons\n" );
|
FS_Printf( f, "\n// touch buttons\n" );
|
||||||
FS_Printf( f, "touch_removeall\n" );
|
FS_Printf( f, "touch_removeall\n" );
|
||||||
|
FS_Printf( f, "touch_aspectratio %f\n", Touch_AspectRatio());
|
||||||
|
|
||||||
|
|
||||||
for( button = touch.list_user.first; button; button = button->next )
|
for( button = touch.list_user.first; button; button = button->next )
|
||||||
{
|
{
|
||||||
@@ -376,7 +409,7 @@ static void Touch_GenerateCode_f( void )
|
|||||||
if( FBitSet( flags, TOUCH_FL_DEF_HIDE ))
|
if( FBitSet( flags, TOUCH_FL_DEF_HIDE ))
|
||||||
SetBits( flags, TOUCH_FL_HIDE );
|
SetBits( flags, TOUCH_FL_HIDE );
|
||||||
|
|
||||||
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(Touch_AspectRatio()) );
|
||||||
if( memcmp( &c, &B(color), sizeof( rgba_t ) ) )
|
if( memcmp( &c, &B(color), sizeof( rgba_t ) ) )
|
||||||
{
|
{
|
||||||
Con_Printf( "unsigned char color[] = { %d, %d, %d, %d };\n", B(color[0]), B(color[1]), B(color[2]), B(color[3]) );
|
Con_Printf( "unsigned char color[] = { %d, %d, %d, %d };\n", B(color[0]), B(color[1]), B(color[2]), B(color[3]) );
|
||||||
@@ -549,6 +582,7 @@ static void Touch_RemoveAll_f( void )
|
|||||||
{
|
{
|
||||||
IN_TouchEditClear();
|
IN_TouchEditClear();
|
||||||
Touch_ClearList( &touch.list_user );
|
Touch_ClearList( &touch.list_user );
|
||||||
|
touch.config_aspect_ratio = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Touch_SetColor( touchbuttonlist_t *list, const char *name, byte *color )
|
static void Touch_SetColor( touchbuttonlist_t *list, const char *name, byte *color )
|
||||||
@@ -726,6 +760,8 @@ static void Touch_SetCommand_f( void )
|
|||||||
Con_Printf( S_USAGE "touch_setcommand <name> <command>\n" );
|
Con_Printf( S_USAGE "touch_setcommand <name> <command>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Touch_LoadDefaults_f( void );
|
||||||
|
|
||||||
static void Touch_ReloadConfig_f( void )
|
static void Touch_ReloadConfig_f( void )
|
||||||
{
|
{
|
||||||
touch.state = state_none;
|
touch.state = state_none;
|
||||||
@@ -735,8 +771,15 @@ static void Touch_ReloadConfig_f( void )
|
|||||||
touch.selection->finger = -1;
|
touch.selection->finger = -1;
|
||||||
touch.edit = touch.selection = NULL;
|
touch.edit = touch.selection = NULL;
|
||||||
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
||||||
|
if( FS_FileExists( touch_config_file.string, true ) )
|
||||||
Cbuf_AddTextf( "exec %s\n", touch_config_file.string );
|
{
|
||||||
|
Cbuf_AddTextf( "exec \"%s\"\n", touch_config_file.string );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Touch_LoadDefaults_f();
|
||||||
|
touch.configchanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static touch_button_t *Touch_AddButton( touchbuttonlist_t *list,
|
static touch_button_t *Touch_AddButton( touchbuttonlist_t *list,
|
||||||
@@ -784,7 +827,7 @@ void Touch_AddClientButton( const char *name, const char *texture, const char *c
|
|||||||
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
|
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
|
||||||
if( round == round_aspect )
|
if( round == round_aspect )
|
||||||
{
|
{
|
||||||
y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * aspect;
|
y2 = y1 + ( x2 - x1 ) / (Touch_AspectRatio()) * aspect;
|
||||||
}
|
}
|
||||||
button = Touch_AddButton( &touch.list_user, name, texture, command, x1, y1, x2, y2, color, true );
|
button = Touch_AddButton( &touch.list_user, name, texture, command, x1, y1, x2, y2, color, true );
|
||||||
button->flags |= flags | TOUCH_FL_CLIENT | TOUCH_FL_NOEDIT;
|
button->flags |= flags | TOUCH_FL_CLIENT | TOUCH_FL_NOEDIT;
|
||||||
@@ -809,7 +852,7 @@ static void Touch_LoadDefaults_f( void )
|
|||||||
if( g_DefaultButtons[i].texturefile[0] == '#' )
|
if( g_DefaultButtons[i].texturefile[0] == '#' )
|
||||||
y2 = y1 + ( (float)clgame.scrInfo.iCharHeight / (float)clgame.scrInfo.iHeight ) * g_DefaultButtons[i].aspect + touch.swidth*2/SCR_H;
|
y2 = y1 + ( (float)clgame.scrInfo.iCharHeight / (float)clgame.scrInfo.iHeight ) * g_DefaultButtons[i].aspect + touch.swidth*2/SCR_H;
|
||||||
else
|
else
|
||||||
y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * g_DefaultButtons[i].aspect;
|
y2 = y1 + (( x2 - x1 ) / Touch_AspectRatio()) * g_DefaultButtons[i].aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
|
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
|
||||||
@@ -817,6 +860,7 @@ static void Touch_LoadDefaults_f( void )
|
|||||||
button->flags |= g_DefaultButtons[i].flags;
|
button->flags |= g_DefaultButtons[i].flags;
|
||||||
button->aspect = g_DefaultButtons[i].aspect;
|
button->aspect = g_DefaultButtons[i].aspect;
|
||||||
}
|
}
|
||||||
|
touch.configchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add default button from client
|
// Add default button from client
|
||||||
@@ -909,7 +953,7 @@ static void Touch_AddButton_f( void )
|
|||||||
if( aspect )
|
if( aspect )
|
||||||
{
|
{
|
||||||
if( B( texturefile )[0] != '#' )
|
if( B( texturefile )[0] != '#' )
|
||||||
B( y2 ) = B( y1 ) + ( B( x2 ) - B( x1 )) * ( SCR_W / SCR_H ) * aspect;
|
B( y2 ) = B( y1 ) + (( B( x2 ) - B( x1 )) / Touch_AspectRatio() ) * aspect;
|
||||||
B( aspect ) = aspect;
|
B( aspect ) = aspect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -917,11 +961,39 @@ static void Touch_AddButton_f( void )
|
|||||||
|
|
||||||
static void Touch_EnableEdit_f( void )
|
static void Touch_EnableEdit_f( void )
|
||||||
{
|
{
|
||||||
|
touch_button_t *button;
|
||||||
|
float current_ratio = SCR_H/SCR_W;
|
||||||
if( touch.state == state_none )
|
if( touch.state == state_none )
|
||||||
touch.state = state_edit;
|
touch.state = state_edit;
|
||||||
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
||||||
touch.move_button = NULL;
|
touch.move_button = NULL;
|
||||||
touch.configchanged = true;
|
touch.configchanged = true;
|
||||||
|
/* try determine the best ratio
|
||||||
|
* User enters editor. Window now have correct size. Need to fix aspect ratio in some cases */
|
||||||
|
// Case A: no config was loaded, touch was generated with lower height, but window was resized higher, reset it to actual size
|
||||||
|
if( touch.actual_aspect_ratio > current_ratio )
|
||||||
|
touch.actual_aspect_ratio = current_ratio;
|
||||||
|
if( !touch.config_aspect_ratio )
|
||||||
|
touch.config_aspect_ratio = touch.actual_aspect_ratio;
|
||||||
|
// Case B: config was loaded, but window may be resized later, so keep y coordinate as is
|
||||||
|
touch.actual_aspect_ratio = current_ratio;
|
||||||
|
// convert coordinates to actual aspect ratio after it was updated
|
||||||
|
if( touch.config_aspect_ratio != touch.actual_aspect_ratio )
|
||||||
|
{
|
||||||
|
for( button = touch.list_user.first; button; button = button->next )
|
||||||
|
{
|
||||||
|
B(y1) /= touch.actual_aspect_ratio / touch.config_aspect_ratio;
|
||||||
|
B(y2) /= touch.actual_aspect_ratio / touch.config_aspect_ratio;
|
||||||
|
|
||||||
|
// clamp positions to make buttons visible by user
|
||||||
|
if( B(y2) > 1.0f )
|
||||||
|
{
|
||||||
|
B(y1) -= B(y2) - 1.0f;
|
||||||
|
B(y2) -= B(y2) - 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
touch.config_aspect_ratio = touch.actual_aspect_ratio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Touch_DisableEdit_f( void )
|
static void Touch_DisableEdit_f( void )
|
||||||
@@ -956,7 +1028,7 @@ static void Touch_DeleteProfile_f( void )
|
|||||||
|
|
||||||
static void Touch_InitEditor( void )
|
static void Touch_InitEditor( void )
|
||||||
{
|
{
|
||||||
float x = 0.1f * (SCR_H/SCR_W);
|
float x = 0.1f * (Touch_AspectRatio());
|
||||||
float y = 0.05f;
|
float y = 0.05f;
|
||||||
touch_button_t *temp;
|
touch_button_t *temp;
|
||||||
rgba_t color;
|
rgba_t color;
|
||||||
@@ -1051,6 +1123,7 @@ void Touch_Init( void )
|
|||||||
Cmd_AddRestrictedCommand( "touch_generate_code", Touch_GenerateCode_f, "create code sample for mobility API" );
|
Cmd_AddRestrictedCommand( "touch_generate_code", Touch_GenerateCode_f, "create code sample for mobility API" );
|
||||||
Cmd_AddCommand( "touch_fade", Touch_Fade_f, "start fade animation for selected buttons" );
|
Cmd_AddCommand( "touch_fade", Touch_Fade_f, "start fade animation for selected buttons" );
|
||||||
Cmd_AddRestrictedCommand( "touch_toggleselection", Touch_ToggleSelection_f, "toggle vidibility on selected button in editor" );
|
Cmd_AddRestrictedCommand( "touch_toggleselection", Touch_ToggleSelection_f, "toggle vidibility on selected button in editor" );
|
||||||
|
Cmd_AddRestrictedCommand( "touch_aspectratio", Touch_ConfigAspectRatio_f, "set current aspect ratio" );
|
||||||
|
|
||||||
// not saved, just runtime state for scripting
|
// not saved, just runtime state for scripting
|
||||||
Cvar_RegisterVariable( &touch_in_menu );
|
Cvar_RegisterVariable( &touch_in_menu );
|
||||||
@@ -1087,7 +1160,7 @@ void Touch_Init( void )
|
|||||||
#if SDL_VERSION_ATLEAST( 2, 0, 10 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 10 )
|
||||||
SDL_SetHint( SDL_HINT_MOUSE_TOUCH_EVENTS, "0" );
|
SDL_SetHint( SDL_HINT_MOUSE_TOUCH_EVENTS, "0" );
|
||||||
SDL_SetHint( SDL_HINT_TOUCH_MOUSE_EVENTS, "0" );
|
SDL_SetHint( SDL_HINT_TOUCH_MOUSE_EVENTS, "0" );
|
||||||
#else
|
#elif defined(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH)
|
||||||
SDL_SetHint( SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "1" );
|
SDL_SetHint( SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "1" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1170,9 +1243,9 @@ static void Touch_DrawTexture ( float x1, float y1, float x2, float y2, int text
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GRID_COUNT_X ((int)touch_grid_count.value)
|
#define GRID_COUNT_X ((int)touch_grid_count.value)
|
||||||
#define GRID_COUNT_Y (((int)touch_grid_count.value) * SCR_H / SCR_W)
|
#define GRID_COUNT_Y (((int)touch_grid_count.value) * Touch_AspectRatio())
|
||||||
#define GRID_X (1.0f/GRID_COUNT_X)
|
#define GRID_X (1.0f/GRID_COUNT_X)
|
||||||
#define GRID_Y (SCR_W/SCR_H/GRID_COUNT_X)
|
#define GRID_Y (1.0f/Touch_AspectRatio()/GRID_COUNT_X)
|
||||||
#define GRID_ROUND_X(x) ((float)round( x * GRID_COUNT_X ) / GRID_COUNT_X)
|
#define GRID_ROUND_X(x) ((float)round( x * GRID_COUNT_X ) / GRID_COUNT_X)
|
||||||
#define GRID_ROUND_Y(x) ((float)round( x * GRID_COUNT_Y ) / GRID_COUNT_Y)
|
#define GRID_ROUND_Y(x) ((float)round( x * GRID_COUNT_Y ) / GRID_COUNT_Y)
|
||||||
|
|
||||||
@@ -1250,7 +1323,7 @@ static float Touch_DrawText( float x1, float y1, float x2, float y2, const char
|
|||||||
{
|
{
|
||||||
while( *s && ( *s != '\n' ) && ( *s != ';' ) && ( x1 < maxx ) )
|
while( *s && ( *s != '\n' ) && ( *s != ';' ) && ( x1 < maxx ) )
|
||||||
x1 += Touch_DrawCharacter( x1, y1, *s++, size );
|
x1 += Touch_DrawCharacter( x1, y1, *s++, size );
|
||||||
y1 += cls.creditsFont.charHeight / 1024.f * size / SCR_H * SCR_W;
|
y1 += cls.creditsFont.charHeight / 1024.f * size / Touch_AspectRatio();
|
||||||
|
|
||||||
if( y1 >= maxy )
|
if( y1 >= maxy )
|
||||||
break;
|
break;
|
||||||
@@ -1357,11 +1430,12 @@ void Touch_Draw( void )
|
|||||||
if( !touch.initialized || ( !touch_enable.value && !touch.clientonly ))
|
if( !touch.initialized || ( !touch_enable.value && !touch.clientonly ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Touch_InitConfig();
|
|
||||||
|
|
||||||
if( cls.key_dest != key_game && !touch_in_menu.value )
|
if( cls.key_dest != key_game && !touch_in_menu.value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Touch_InitConfig();
|
||||||
|
|
||||||
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
|
|
||||||
if( touch.state >= state_edit && touch_grid_enable.value )
|
if( touch.state >= state_edit && touch_grid_enable.value )
|
||||||
@@ -1948,6 +2022,8 @@ static int Touch_ControlsEvent( touchEventType type, int fingerID, float x, floa
|
|||||||
|
|
||||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy )
|
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy )
|
||||||
{
|
{
|
||||||
|
y *= SCR_H/SCR_W/Touch_AspectRatio();
|
||||||
|
// Con_Printf("%f %f\n", TO_SCRN_X(x), TO_SCRN_Y(y));
|
||||||
// simulate menu mouse click
|
// simulate menu mouse click
|
||||||
if( cls.key_dest != key_game && !touch_in_menu.value )
|
if( cls.key_dest != key_game && !touch_in_menu.value )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
{
|
{
|
||||||
if( newstate == oldstate )
|
if( newstate == oldstate )
|
||||||
return;
|
return;
|
||||||
|
if( m_ignore.value )
|
||||||
|
return;
|
||||||
|
|
||||||
// since SetCursorType controls cursor visibility
|
// since SetCursorType controls cursor visibility
|
||||||
// execute it first, and then check mouse grab state
|
// execute it first, and then check mouse grab state
|
||||||
@@ -212,6 +214,9 @@ void IN_CheckMouseState( qboolean active )
|
|||||||
qboolean useRawInput = true; // always use SDL code
|
qboolean useRawInput = true; // always use SDL code
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( m_ignore.value )
|
||||||
|
return;
|
||||||
|
|
||||||
if( active && useRawInput && !host.mouse_visible && cls.state == ca_active )
|
if( active && useRawInput && !host.mouse_visible && cls.state == ca_active )
|
||||||
{
|
{
|
||||||
if( !s_bRawInput )
|
if( !s_bRawInput )
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ void Touch_ResetDefaultButtons( void );
|
|||||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
||||||
void Touch_KeyEvent( int key, int down );
|
void Touch_KeyEvent( int key, int down );
|
||||||
qboolean Touch_WantVisibleCursor( void );
|
qboolean Touch_WantVisibleCursor( void );
|
||||||
|
void Touch_NotifyResize( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// in_joy.c
|
// in_joy.c
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ static void make_hull_windings( hull_t *hull, hull_model_t *model )
|
|||||||
Con_Reportf( "%i hull polys\n", model->num_polys );
|
Con_Reportf( "%i hull polys\n", model->num_polys );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mod_InitDebugHulls( void )
|
void Mod_InitDebugHulls( model_t *loadmodel )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -127,6 +128,7 @@ void Sys_PrintUsage( void )
|
|||||||
O("-noenginejoy ", "disable engine builtin joystick support")
|
O("-noenginejoy ", "disable engine builtin joystick support")
|
||||||
O("-noenginemouse ", "disable engine builtin mouse support")
|
O("-noenginemouse ", "disable engine builtin mouse support")
|
||||||
O("-nosound ", "disable sound output")
|
O("-nosound ", "disable sound output")
|
||||||
|
O("-timedemo ", "run timedemo and exit")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
"\nPlatform-specific options:\n"
|
"\nPlatform-specific options:\n"
|
||||||
@@ -1016,21 +1018,31 @@ 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;
|
||||||
}
|
}
|
||||||
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
||||||
char *szBasePath;
|
char *szBasePath = SDL_GetBasePath();
|
||||||
|
if( szBasePath )
|
||||||
if( !( szBasePath = SDL_GetBasePath() ) )
|
{
|
||||||
|
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ));
|
||||||
|
SDL_free( szBasePath );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if XASH_POSIX || XASH_WIN32
|
||||||
|
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
||||||
|
Sys_Error( "couldn't determine current directory: %s, getcwd: %s", SDL_GetError(), strerror( errno ));
|
||||||
|
#else
|
||||||
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
||||||
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ));
|
#endif
|
||||||
SDL_free( szBasePath );
|
}
|
||||||
#else
|
#else
|
||||||
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
||||||
{
|
{
|
||||||
@@ -1149,6 +1161,7 @@ Host_Main
|
|||||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func )
|
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func )
|
||||||
{
|
{
|
||||||
static double oldtime, newtime;
|
static double oldtime, newtime;
|
||||||
|
string demoname;
|
||||||
|
|
||||||
host.starttime = Sys_DoubleTime();
|
host.starttime = Sys_DoubleTime();
|
||||||
|
|
||||||
@@ -1245,6 +1258,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
|
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
|
||||||
SCR_CheckStartupVids(); // must be last
|
SCR_CheckStartupVids(); // must be last
|
||||||
|
|
||||||
|
if( Sys_GetParmFromCmdLine( "-timedemo", demoname ))
|
||||||
|
Cbuf_AddTextf( "timedemo %s\n", demoname );
|
||||||
|
|
||||||
oldtime = Sys_DoubleTime() - 0.1;
|
oldtime = Sys_DoubleTime() - 0.1;
|
||||||
|
|
||||||
if( Host_IsDedicated( ))
|
if( Host_IsDedicated( ))
|
||||||
@@ -1293,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();
|
||||||
|
|
||||||
|
|||||||
@@ -284,8 +284,10 @@ int Image_ComparePalette( const byte *pal )
|
|||||||
void Image_SetPalette( const byte *pal, uint *d_table )
|
void Image_SetPalette( const byte *pal, uint *d_table )
|
||||||
{
|
{
|
||||||
byte rgba[4];
|
byte rgba[4];
|
||||||
|
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
// setup palette
|
// setup palette
|
||||||
switch( image.d_rendermode )
|
switch( image.d_rendermode )
|
||||||
{
|
{
|
||||||
@@ -296,7 +298,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[i*3+1];
|
rgba[1] = pal[i*3+1];
|
||||||
rgba[2] = pal[i*3+2];
|
rgba[2] = pal[i*3+2];
|
||||||
rgba[3] = 0xFF;
|
rgba[3] = 0xFF;
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LUMP_GRADIENT:
|
case LUMP_GRADIENT:
|
||||||
@@ -306,7 +309,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[766];
|
rgba[1] = pal[766];
|
||||||
rgba[2] = pal[767];
|
rgba[2] = pal[767];
|
||||||
rgba[3] = i;
|
rgba[3] = i;
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LUMP_MASKED:
|
case LUMP_MASKED:
|
||||||
@@ -316,7 +320,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[i*3+1];
|
rgba[1] = pal[i*3+1];
|
||||||
rgba[2] = pal[i*3+2];
|
rgba[2] = pal[i*3+2];
|
||||||
rgba[3] = 0xFF;
|
rgba[3] = 0xFF;
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
d_table[255] = 0;
|
d_table[255] = 0;
|
||||||
break;
|
break;
|
||||||
@@ -327,7 +332,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
|||||||
rgba[1] = pal[i*4+1];
|
rgba[1] = pal[i*4+1];
|
||||||
rgba[2] = pal[i*4+2];
|
rgba[2] = pal[i*4+2];
|
||||||
rgba[3] = pal[i*4+3];
|
rgba[3] = pal[i*4+3];
|
||||||
d_table[i] = *(uint *)rgba;
|
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||||
|
d_table[i] = uirgba;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -419,5 +419,6 @@ void NET_InitMasters( void )
|
|||||||
|
|
||||||
// keep main master always there
|
// keep main master always there
|
||||||
NET_AddMaster( MASTERSERVER_ADR, false );
|
NET_AddMaster( MASTERSERVER_ADR, false );
|
||||||
|
NET_AddMaster( MASTERSERVER_ADR_TEST, false );
|
||||||
NET_LoadMasters( );
|
NET_LoadMasters( );
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -118,7 +118,6 @@ typedef struct world_static_s
|
|||||||
#ifndef REF_DLL
|
#ifndef REF_DLL
|
||||||
extern world_static_t world;
|
extern world_static_t world;
|
||||||
extern poolhandle_t com_studiocache;
|
extern poolhandle_t com_studiocache;
|
||||||
extern model_t *loadmodel;
|
|
||||||
extern convar_t mod_studiocache;
|
extern convar_t mod_studiocache;
|
||||||
extern convar_t r_wadtextures;
|
extern convar_t r_wadtextures;
|
||||||
extern convar_t r_showhull;
|
extern convar_t r_showhull;
|
||||||
@@ -164,7 +163,7 @@ void Mod_PrintWorldStats_f( void );
|
|||||||
//
|
//
|
||||||
// mod_dbghulls.c
|
// mod_dbghulls.c
|
||||||
//
|
//
|
||||||
void Mod_InitDebugHulls( void );
|
void Mod_InitDebugHulls( model_t *mod );
|
||||||
void Mod_CreatePolygonsForHull( int hullnum );
|
void Mod_CreatePolygonsForHull( int hullnum );
|
||||||
void Mod_ReleaseHullPolygons( void );
|
void Mod_ReleaseHullPolygons( void );
|
||||||
|
|
||||||
|
|||||||
@@ -851,11 +851,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
char poolname[MAX_VA_STRING];
|
char poolname[MAX_VA_STRING];
|
||||||
studiohdr_t *phdr;
|
studiohdr_t *phdr;
|
||||||
|
|
||||||
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", loadmodel->name );
|
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", mod->name );
|
||||||
|
|
||||||
if( loaded ) *loaded = false;
|
if( loaded ) *loaded = false;
|
||||||
loadmodel->mempool = Mem_AllocPool( poolname );
|
mod->mempool = Mem_AllocPool( poolname );
|
||||||
loadmodel->type = mod_studio;
|
mod->type = mod_studio;
|
||||||
|
|
||||||
phdr = R_StudioLoadHeader( mod, buffer );
|
phdr = R_StudioLoadHeader( mod, buffer );
|
||||||
if( !phdr ) return; // bad model
|
if( !phdr ) return; // bad model
|
||||||
@@ -886,9 +886,9 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
// give space for textures and skinrefs
|
// give space for textures and skinrefs
|
||||||
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
|
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
|
||||||
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
|
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
|
||||||
mod->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length + size1 + size2 );
|
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length + size1 + size2 );
|
||||||
memcpy( loadmodel->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
memcpy( mod->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
||||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||||
phdr->numskinfamilies = thdr->numskinfamilies;
|
phdr->numskinfamilies = thdr->numskinfamilies;
|
||||||
phdr->numtextures = thdr->numtextures;
|
phdr->numtextures = thdr->numtextures;
|
||||||
phdr->numskinref = thdr->numskinref;
|
phdr->numskinref = thdr->numskinref;
|
||||||
@@ -905,52 +905,52 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// NOTE: don't modify source buffer because it's used for CRC computing
|
// NOTE: don't modify source buffer because it's used for CRC computing
|
||||||
loadmodel->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length );
|
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
|
||||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
memcpy( mod->cache.data, buffer, phdr->length );
|
||||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
|
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: we wan't keep raw textures in memory. just cutoff model pointer above texture base
|
// NOTE: we wan't keep raw textures in memory. just cutoff model pointer above texture base
|
||||||
loadmodel->cache.data = Mem_Realloc( loadmodel->mempool, loadmodel->cache.data, phdr->texturedataindex );
|
mod->cache.data = Mem_Realloc( mod->mempool, mod->cache.data, phdr->texturedataindex );
|
||||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||||
phdr->length = phdr->texturedataindex; // update model size
|
phdr->length = phdr->texturedataindex; // update model size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// just copy model into memory
|
// just copy model into memory
|
||||||
loadmodel->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length );
|
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
|
||||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
memcpy( mod->cache.data, buffer, phdr->length );
|
||||||
|
|
||||||
phdr = loadmodel->cache.data;
|
phdr = mod->cache.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup bounding box
|
// setup bounding box
|
||||||
if( !VectorCompare( vec3_origin, phdr->bbmin ))
|
if( !VectorCompare( vec3_origin, phdr->bbmin ))
|
||||||
{
|
{
|
||||||
// clipping bounding box
|
// clipping bounding box
|
||||||
VectorCopy( phdr->bbmin, loadmodel->mins );
|
VectorCopy( phdr->bbmin, mod->mins );
|
||||||
VectorCopy( phdr->bbmax, loadmodel->maxs );
|
VectorCopy( phdr->bbmax, mod->maxs );
|
||||||
}
|
}
|
||||||
else if( !VectorCompare( vec3_origin, phdr->min ))
|
else if( !VectorCompare( vec3_origin, phdr->min ))
|
||||||
{
|
{
|
||||||
// movement bounding box
|
// movement bounding box
|
||||||
VectorCopy( phdr->min, loadmodel->mins );
|
VectorCopy( phdr->min, mod->mins );
|
||||||
VectorCopy( phdr->max, loadmodel->maxs );
|
VectorCopy( phdr->max, mod->maxs );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// well compute bounds from vertices and round to nearest even values
|
// well compute bounds from vertices and round to nearest even values
|
||||||
Mod_StudioComputeBounds( phdr, loadmodel->mins, loadmodel->maxs, true );
|
Mod_StudioComputeBounds( phdr, mod->mins, mod->maxs, true );
|
||||||
RoundUpHullSize( loadmodel->mins );
|
RoundUpHullSize( mod->mins );
|
||||||
RoundUpHullSize( loadmodel->maxs );
|
RoundUpHullSize( mod->maxs );
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->numframes = Mod_StudioBodyVariations( loadmodel );
|
mod->numframes = Mod_StudioBodyVariations( mod );
|
||||||
loadmodel->radius = RadiusFromBounds( loadmodel->mins, loadmodel->maxs );
|
mod->radius = RadiusFromBounds( mod->mins, mod->maxs );
|
||||||
loadmodel->flags = phdr->flags; // copy header flags
|
mod->flags = phdr->flags; // copy header flags
|
||||||
|
|
||||||
if( loaded ) *loaded = true;
|
if( loaded ) *loaded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ poolhandle_t com_studiocache; // cache for submodels
|
|||||||
CVAR_DEFINE( mod_studiocache, "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
|
CVAR_DEFINE( mod_studiocache, "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
|
||||||
CVAR_DEFINE_AUTO( r_wadtextures, "0", 0, "completely ignore textures in the bsp-file if enabled" );
|
CVAR_DEFINE_AUTO( r_wadtextures, "0", 0, "completely ignore textures in the bsp-file if enabled" );
|
||||||
CVAR_DEFINE_AUTO( r_showhull, "0", 0, "draw collision hulls 1-3" );
|
CVAR_DEFINE_AUTO( r_showhull, "0", 0, "draw collision hulls 1-3" );
|
||||||
model_t *loadmodel;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@@ -287,7 +286,6 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
|||||||
Con_Reportf( "loading %s\n", mod->name );
|
Con_Reportf( "loading %s\n", mod->name );
|
||||||
mod->needload = NL_PRESENT;
|
mod->needload = NL_PRESENT;
|
||||||
mod->type = mod_bad;
|
mod->type = mod_bad;
|
||||||
loadmodel = mod;
|
|
||||||
|
|
||||||
// call the apropriate loader
|
// call the apropriate loader
|
||||||
switch( *(uint *)buf )
|
switch( *(uint *)buf )
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ static void NET_NetadrToSockadr( netadr_t *a, struct sockaddr_storage *s )
|
|||||||
else if( a->type == NA_IP )
|
else if( a->type == NA_IP )
|
||||||
{
|
{
|
||||||
((struct sockaddr_in *)s)->sin_family = AF_INET;
|
((struct sockaddr_in *)s)->sin_family = AF_INET;
|
||||||
((struct sockaddr_in *)s)->sin_addr.s_addr = *(uint32_t *)&a->ip;
|
|
||||||
((struct sockaddr_in *)s)->sin_port = a->port;
|
((struct sockaddr_in *)s)->sin_port = a->port;
|
||||||
|
((struct sockaddr_in *)s)->sin_addr.s_addr = a->ip4;
|
||||||
}
|
}
|
||||||
else if( a->type6 == NA_IP6 )
|
else if( a->type6 == NA_IP6 )
|
||||||
{
|
{
|
||||||
@@ -314,7 +314,7 @@ static void NET_SockadrToNetadr( const struct sockaddr_storage *s, netadr_t *a )
|
|||||||
if( s->ss_family == AF_INET )
|
if( s->ss_family == AF_INET )
|
||||||
{
|
{
|
||||||
a->type = NA_IP;
|
a->type = NA_IP;
|
||||||
*(int *)&a->ip = ((struct sockaddr_in *)s)->sin_addr.s_addr;
|
a->ip4 = ((struct sockaddr_in *)s)->sin_addr.s_addr;
|
||||||
a->port = ((struct sockaddr_in *)s)->sin_port;
|
a->port = ((struct sockaddr_in *)s)->sin_port;
|
||||||
}
|
}
|
||||||
else if( s->ss_family == AF_INET6 )
|
else if( s->ss_family == AF_INET6 )
|
||||||
@@ -444,6 +444,7 @@ static void NET_InitializeCriticalSections( void )
|
|||||||
void NET_ResolveThread( void )
|
void NET_ResolveThread( void )
|
||||||
{
|
{
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
|
qboolean res;
|
||||||
|
|
||||||
RESOLVE_DBG( "[resolve thread] starting resolve for " );
|
RESOLVE_DBG( "[resolve thread] starting resolve for " );
|
||||||
RESOLVE_DBG( nsthread.hostname );
|
RESOLVE_DBG( nsthread.hostname );
|
||||||
@@ -453,13 +454,14 @@ void NET_ResolveThread( void )
|
|||||||
RESOLVE_DBG( " with gethostbyname\n" );
|
RESOLVE_DBG( " with gethostbyname\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( NET_GetHostByName( nsthread.hostname, nsthread.family, &addr ))
|
if(( res = NET_GetHostByName( nsthread.hostname, nsthread.family, &addr )))
|
||||||
RESOLVE_DBG( "[resolve thread] success\n" );
|
RESOLVE_DBG( "[resolve thread] success\n" );
|
||||||
else
|
else
|
||||||
RESOLVE_DBG( "[resolve thread] failed\n" );
|
RESOLVE_DBG( "[resolve thread] failed\n" );
|
||||||
mutex_lock( &nsthread.mutexres );
|
mutex_lock( &nsthread.mutexres );
|
||||||
nsthread.addr = addr;
|
nsthread.addr = addr;
|
||||||
nsthread.busy = false;
|
nsthread.busy = false;
|
||||||
|
nsthread.result = res ? NET_EAI_OK : NET_EAI_NONAME;
|
||||||
RESOLVE_DBG( "[resolve thread] returning result\n" );
|
RESOLVE_DBG( "[resolve thread] returning result\n" );
|
||||||
mutex_unlock( &nsthread.mutexres );
|
mutex_unlock( &nsthread.mutexres );
|
||||||
RESOLVE_DBG( "[resolve thread] exiting thread\n" );
|
RESOLVE_DBG( "[resolve thread] exiting thread\n" );
|
||||||
@@ -544,6 +546,7 @@ static net_gai_state_t NET_StringToSockaddr( const char *s, struct sockaddr_stor
|
|||||||
memset( &nsthread.addr, 0, sizeof( nsthread.addr ));
|
memset( &nsthread.addr, 0, sizeof( nsthread.addr ));
|
||||||
|
|
||||||
detach_thread( nsthread.thread );
|
detach_thread( nsthread.thread );
|
||||||
|
asyncfailed = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ GNU General Public License for more details.
|
|||||||
#define NET_MAX_MESSAGE PAD_NUMBER(( NET_MAX_PAYLOAD + HEADER_BYTES ), 16 )
|
#define NET_MAX_MESSAGE PAD_NUMBER(( NET_MAX_PAYLOAD + HEADER_BYTES ), 16 )
|
||||||
|
|
||||||
#define MASTERSERVER_ADR "mentality.rip:27010"
|
#define MASTERSERVER_ADR "mentality.rip:27010"
|
||||||
|
#define MASTERSERVER_ADR_TEST "mentality.rip:27011"
|
||||||
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0"
|
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0"
|
||||||
|
|
||||||
#define PORT_MASTER 27010
|
#define PORT_MASTER 27010
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ static qboolean SDLash_IsInstanceIDAGameController( SDL_JoystickID joyId )
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if( SDL_GameControllerFromInstanceID( joyId ) )
|
if( SDL_GameControllerFromInstanceID( joyId ) != NULL )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@@ -148,7 +148,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
#else
|
#else
|
||||||
int keynum = key.keysym.sym;
|
int keynum = key.keysym.sym;
|
||||||
#endif
|
#endif
|
||||||
qboolean numLock = SDL_GetModState() & KMOD_NUM;
|
qboolean numLock = FBitSet( SDL_GetModState(), KMOD_NUM );
|
||||||
|
|
||||||
#if XASH_ANDROID
|
#if XASH_ANDROID
|
||||||
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
|
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
|
||||||
@@ -159,7 +159,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
|
|
||||||
if( SDL_IsTextInputActive() && down && cls.key_dest != key_game )
|
if( SDL_IsTextInputActive() && down && cls.key_dest != key_game )
|
||||||
{
|
{
|
||||||
if( SDL_GetModState() & KMOD_CTRL )
|
if( FBitSet( SDL_GetModState(), KMOD_CTRL ))
|
||||||
{
|
{
|
||||||
if( keynum >= SDL_SCANCODE_A && keynum <= SDL_SCANCODE_Z )
|
if( keynum >= SDL_SCANCODE_A && keynum <= SDL_SCANCODE_Z )
|
||||||
{
|
{
|
||||||
@@ -176,7 +176,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
|||||||
|
|
||||||
if( isprint( keynum ) )
|
if( isprint( keynum ) )
|
||||||
{
|
{
|
||||||
if( SDL_GetModState() & KMOD_SHIFT )
|
if( FBitSet( SDL_GetModState(), KMOD_SHIFT ))
|
||||||
{
|
{
|
||||||
keynum = Key_ToUpper( keynum );
|
keynum = Key_ToUpper( keynum );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,8 +158,8 @@ void *SW_LockBuffer( void )
|
|||||||
void *pixels;
|
void *pixels;
|
||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) )
|
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) < 0 )
|
||||||
Sys_Error("%s", SDL_GetError());
|
Sys_Error( "%s: %s", __func__, SDL_GetError( ));
|
||||||
return pixels;
|
return pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ static void R_InitVideoModes( void )
|
|||||||
int j;
|
int j;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
||||||
if( SDL_GetDisplayMode( displayIndex, i, &mode ) )
|
if( SDL_GetDisplayMode( displayIndex, i, &mode ) < 0 )
|
||||||
{
|
{
|
||||||
Msg( "SDL_GetDisplayMode: %s\n", SDL_GetError() );
|
Msg( "SDL_GetDisplayMode: %s\n", SDL_GetError() );
|
||||||
continue;
|
continue;
|
||||||
@@ -419,12 +419,16 @@ static qboolean WIN_SetWindowIcon( HICON ico )
|
|||||||
{
|
{
|
||||||
SDL_SysWMinfo wminfo;
|
SDL_SysWMinfo wminfo;
|
||||||
|
|
||||||
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ))
|
SDL_VERSION( &wminfo.version );
|
||||||
|
|
||||||
|
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE )
|
||||||
{
|
{
|
||||||
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
|
||||||
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
|
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Con_Reportf( S_ERROR "%s: %s", __func__, SDL_GetError( ));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -438,6 +442,25 @@ GL_GetProcAddress
|
|||||||
void *GL_GetProcAddress( const char *name )
|
void *GL_GetProcAddress( const char *name )
|
||||||
{
|
{
|
||||||
void *func = SDL_GL_GetProcAddress( name );
|
void *func = SDL_GL_GetProcAddress( name );
|
||||||
|
#if !SDL_VERSION_ATLEAST( 2, 0, 6 ) && XASH_POSIX
|
||||||
|
if( !func && Sys_CheckParm( "-egl" ))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* SDL2 has broken SDL_GL_GetProcAddress until this commit if using egl:
|
||||||
|
* https://github.com/libsdl-org/SDL/commit/466ba57d42d244e80357e9ad3011c50af30ed225
|
||||||
|
* so call eglGetProcAddress directly
|
||||||
|
* */
|
||||||
|
static void *(*peglGetProcAddress)( const char * );
|
||||||
|
if( !peglGetProcAddress )
|
||||||
|
{
|
||||||
|
void *lib = dlopen( "libEGL.so", RTLD_NOW );
|
||||||
|
if( lib )
|
||||||
|
*(void**)&peglGetProcAddress = dlsym( lib, "eglGetProcAddress" );
|
||||||
|
}
|
||||||
|
if( peglGetProcAddress )
|
||||||
|
func = peglGetProcAddress( name );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if XASH_PSVITA
|
#if XASH_PSVITA
|
||||||
// try to find in main module
|
// try to find in main module
|
||||||
@@ -473,8 +496,8 @@ void GL_UpdateSwapInterval( void )
|
|||||||
{
|
{
|
||||||
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
||||||
|
|
||||||
if( SDL_GL_SetSwapInterval( gl_vsync.value ) )
|
if( SDL_GL_SetSwapInterval( gl_vsync.value ) < 0 )
|
||||||
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
|
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ));
|
||||||
}
|
}
|
||||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
}
|
}
|
||||||
@@ -523,7 +546,7 @@ GL_UpdateContext
|
|||||||
static qboolean GL_UpdateContext( void )
|
static qboolean GL_UpdateContext( void )
|
||||||
{
|
{
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ))
|
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ) < 0 )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError());
|
Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError());
|
||||||
return GL_DeleteContext();
|
return GL_DeleteContext();
|
||||||
@@ -580,7 +603,7 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
|
|||||||
want.w = width;
|
want.w = width;
|
||||||
want.h = height;
|
want.h = height;
|
||||||
|
|
||||||
if( SDL_GetClosestDisplayMode( 0, &want, &got ) < 0 )
|
if( SDL_GetClosestDisplayMode( 0, &want, &got ) == NULL )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "%s: SDL_GetClosestDisplayMode: %s", __func__, SDL_GetError( ));
|
Con_Printf( S_ERROR "%s: SDL_GetClosestDisplayMode: %s", __func__, SDL_GetError( ));
|
||||||
return false;
|
return false;
|
||||||
@@ -626,9 +649,9 @@ void VID_RestoreScreenResolution( void )
|
|||||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
static void VID_SetWindowIcon( SDL_Window *hWnd )
|
static void VID_SetWindowIcon( SDL_Window *hWnd )
|
||||||
{
|
{
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
|
||||||
rgbdata_t *icon = NULL;
|
rgbdata_t *icon = NULL;
|
||||||
char iconpath[MAX_STRING];
|
char iconpath[MAX_STRING];
|
||||||
const char *localIcoPath;
|
const char *localIcoPath;
|
||||||
@@ -666,8 +689,8 @@ static void VID_SetWindowIcon( SDL_Window *hWnd )
|
|||||||
#if XASH_WIN32 // ICO support only for Win32
|
#if XASH_WIN32 // ICO support only for Win32
|
||||||
WIN_SetWindowIcon( LoadIcon( host.hInst, MAKEINTRESOURCE( 101 )));
|
WIN_SetWindowIcon( LoadIcon( host.hInst, MAKEINTRESOURCE( 101 )));
|
||||||
#endif
|
#endif
|
||||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
|
||||||
}
|
}
|
||||||
|
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
|
|
||||||
static qboolean VID_CreateWindowWithSafeGL( const char *wndname, int xpos, int ypos, int w, int h, uint32_t flags )
|
static qboolean VID_CreateWindowWithSafeGL( const char *wndname, int xpos, int ypos, int w, int h, uint32_t flags )
|
||||||
{
|
{
|
||||||
@@ -785,6 +808,7 @@ qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode )
|
|||||||
else VID_RestoreScreenResolution();
|
else VID_RestoreScreenResolution();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
VID_SetWindowIcon( host.hWnd );
|
||||||
SDL_ShowWindow( host.hWnd );
|
SDL_ShowWindow( host.hWnd );
|
||||||
|
|
||||||
if( glw_state.software )
|
if( glw_state.software )
|
||||||
@@ -996,8 +1020,12 @@ qboolean R_Init_Video( const int type )
|
|||||||
refState.desktopBitsPixel = 16;
|
refState.desktopBitsPixel = 16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SDL_HINT_QTWAYLAND_WINDOW_FLAGS
|
||||||
SDL_SetHint( SDL_HINT_QTWAYLAND_WINDOW_FLAGS, "OverridesSystemGestures" );
|
SDL_SetHint( SDL_HINT_QTWAYLAND_WINDOW_FLAGS, "OverridesSystemGestures" );
|
||||||
|
#endif
|
||||||
|
#ifdef SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
|
||||||
SDL_SetHint( SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION, "landscape" );
|
SDL_SetHint( SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION, "landscape" );
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !XASH_WIN32
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !XASH_WIN32
|
||||||
SDL_SetHint( "SDL_VIDEO_X11_XRANDR", "1" );
|
SDL_SetHint( "SDL_VIDEO_X11_XRANDR", "1" );
|
||||||
@@ -1023,7 +1051,7 @@ qboolean R_Init_Video( const int type )
|
|||||||
// refdll can request some attributes
|
// refdll can request some attributes
|
||||||
GL_SetupAttributes( );
|
GL_SetupAttributes( );
|
||||||
|
|
||||||
if( SDL_GL_LoadLibrary( EGL_LIB ) )
|
if( SDL_GL_LoadLibrary( EGL_LIB ) < 0 )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError());
|
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
@@ -1062,7 +1090,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
|
|||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
SDL_DisplayMode displayMode;
|
SDL_DisplayMode displayMode;
|
||||||
|
|
||||||
SDL_GetCurrentDisplayMode( 0, &displayMode );
|
if( SDL_GetCurrentDisplayMode( 0, &displayMode ) < 0 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "SDL_GetCurrentDisplayMode: %s", SDL_GetError( ));
|
||||||
|
return rserr_invalid_mode;
|
||||||
|
}
|
||||||
|
|
||||||
// check our desktop attributes
|
// check our desktop attributes
|
||||||
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format );
|
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format );
|
||||||
@@ -1091,8 +1123,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
|
|||||||
VID_RestoreScreenResolution();
|
VID_RestoreScreenResolution();
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( SDL_SetWindowFullscreen( host.hWnd, 0 ))
|
if( SDL_SetWindowFullscreen( host.hWnd, 0 ) < 0 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "SDL_SetWindowFullscreen: %s", SDL_GetError( ));
|
||||||
return rserr_invalid_fullscreen;
|
return rserr_invalid_fullscreen;
|
||||||
|
}
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 5 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 5 )
|
||||||
SDL_SetWindowResizable( host.hWnd, SDL_TRUE );
|
SDL_SetWindowResizable( host.hWnd, SDL_TRUE );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -121,8 +121,10 @@ void SV_ParseConsistencyResponse( sv_client_t *cl, sizebuf_t *msg )
|
|||||||
{
|
{
|
||||||
value = MSG_ReadUBitLong( msg, 32 );
|
value = MSG_ReadUBitLong( msg, 32 );
|
||||||
|
|
||||||
|
LittleLongSW( value );
|
||||||
|
|
||||||
// will be compare only first 4 bytes
|
// will be compare only first 4 bytes
|
||||||
if( value != *(int *)r->rgucMD5_hash )
|
if( memcmp( &value, r->rgucMD5_hash, 4 ))
|
||||||
badresindex = idx + 1;
|
badresindex = idx + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,8 +1041,9 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba
|
|||||||
// force normal player collisions for single player
|
// force normal player collisions for single player
|
||||||
if( svs.maxclients == 1 ) Cvar_SetValue( "sv_clienttrace", 1 );
|
if( svs.maxclients == 1 ) Cvar_SetValue( "sv_clienttrace", 1 );
|
||||||
|
|
||||||
// make sure what server name doesn't contain path and extension
|
// allow loading maps from subdirectories, strip extension anyway
|
||||||
COM_FileBase( mapname, sv.name, sizeof( sv.name ));
|
Q_strncpy( sv.name, mapname, sizeof( sv.name ));
|
||||||
|
COM_StripExtension( sv.name );
|
||||||
|
|
||||||
// precache and static commands can be issued during map initialization
|
// precache and static commands can be issued during map initialization
|
||||||
Host_SetServerState( ss_loading );
|
Host_SetServerState( ss_loading );
|
||||||
@@ -1115,28 +1115,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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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" ))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -645,10 +645,10 @@ void COM_ExtractFilePath( const char *path, char *dest )
|
|||||||
const char *src = path + Q_strlen( path ) - 1;
|
const char *src = path + Q_strlen( path ) - 1;
|
||||||
|
|
||||||
// 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) == '/' ))
|
||||||
src--;
|
src--;
|
||||||
|
|
||||||
if( src != path )
|
if( src > path )
|
||||||
{
|
{
|
||||||
memcpy( dest, path, src - path );
|
memcpy( dest, path, src - path );
|
||||||
dest[src - path - 1] = 0; // cutoff backslash
|
dest[src - path - 1] = 0; // cutoff backslash
|
||||||
|
|||||||
40
public/tests/test_efp.c
Normal file
40
public/tests/test_efp.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include "crtlib.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int Test_ExtractFilePath( void )
|
||||||
|
{
|
||||||
|
char dst[64];
|
||||||
|
const char *strings[] =
|
||||||
|
{
|
||||||
|
"dir/file", "dir",
|
||||||
|
"bark\\meow", "bark",
|
||||||
|
"nopath", "",
|
||||||
|
"knee/deep/in/paths", "knee/deep/in",
|
||||||
|
// yes, it removes the behavior/ even if it might be technically a directory
|
||||||
|
"keep/the/original/func/behavior/", "keep/the/original/func",
|
||||||
|
"backslashes\\are\\annoying\\af", "backslashes\\are\\annoying",
|
||||||
|
"", ""
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for( i = 0; i < sizeof( strings ) / sizeof( strings[0] ); i += 2 )
|
||||||
|
{
|
||||||
|
COM_ExtractFilePath( strings[i], dst );
|
||||||
|
if( Q_strcmp( dst, strings[i+1] ))
|
||||||
|
{
|
||||||
|
printf( "%s %s %s\n", strings[i], strings[i+1], dst );
|
||||||
|
return (i >> 1) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
if( Test_ExtractFilePath( ))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ def build(bld):
|
|||||||
'strings': 'tests/test_strings.c',
|
'strings': 'tests/test_strings.c',
|
||||||
'build': 'tests/test_build.c',
|
'build': 'tests/test_build.c',
|
||||||
'filebase': 'tests/test_filebase.c',
|
'filebase': 'tests/test_filebase.c',
|
||||||
|
'efp': 'tests/test_efp.c',
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in tests:
|
for i in tests:
|
||||||
|
|||||||
@@ -1014,7 +1014,7 @@ static void APIENTRY GL2_TexImage2D( GLenum target, GLint level, GLint internalf
|
|||||||
}
|
}
|
||||||
internalformat = format;
|
internalformat = format;
|
||||||
}
|
}
|
||||||
if( internalformat == GL_LUMINANCE8_ALPHA8 || internalformat == GL_RGB )
|
if( internalformat == GL_LUMINANCE8_ALPHA8 || internalformat == GL_RGB || internalformat == GL_RGB8 || internalformat == GL_RGB5 )
|
||||||
internalformat = GL_RGBA;
|
internalformat = GL_RGBA;
|
||||||
rpglTexImage2D( target, level, internalformat, width, height, border, format, type, data );
|
rpglTexImage2D( target, level, internalformat, width, height, border, format, type, data );
|
||||||
if( data != pixels )
|
if( data != pixels )
|
||||||
@@ -1309,9 +1309,9 @@ static void GL2_Mul4x4( const GLfloat *in0, const GLfloat *in1, GLfloat *out )
|
|||||||
static void GL2_UpdateMVP( gl2wrap_prog_t *prog )
|
static void GL2_UpdateMVP( gl2wrap_prog_t *prog )
|
||||||
{
|
{
|
||||||
// use bitset to determine if need update matrix for this prog
|
// use bitset to determine if need update matrix for this prog
|
||||||
if( FBitSet( gl2wrap_matrix.update, BIT( prog->flags )))
|
if( FBitSet( gl2wrap_matrix.update, BIT64( prog->flags )))
|
||||||
{
|
{
|
||||||
ClearBits( gl2wrap_matrix.update, BIT( prog->flags ));
|
ClearBits( gl2wrap_matrix.update, BIT64( prog->flags ));
|
||||||
GL2_Mul4x4( gl2wrap_matrix.mv, gl2wrap_matrix.pr, gl2wrap_matrix.mvp );
|
GL2_Mul4x4( gl2wrap_matrix.mv, gl2wrap_matrix.pr, gl2wrap_matrix.mvp );
|
||||||
pglUniformMatrix4fvARB( prog->uMVP, 1, false, (void *)gl2wrap_matrix.mvp );
|
pglUniformMatrix4fvARB( prog->uMVP, 1, false, (void *)gl2wrap_matrix.mvp );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 );
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ CVAR_DEFINE_AUTO( r_novis, "0", 0, "ignore vis information (perfomance test)" );
|
|||||||
CVAR_DEFINE_AUTO( r_nocull, "0", 0, "ignore frustrum culling (perfomance test)" );
|
CVAR_DEFINE_AUTO( r_nocull, "0", 0, "ignore frustrum culling (perfomance test)" );
|
||||||
CVAR_DEFINE_AUTO( r_lockpvs, "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
|
CVAR_DEFINE_AUTO( r_lockpvs, "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
|
||||||
CVAR_DEFINE_AUTO( r_lockfrustum, "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
|
CVAR_DEFINE_AUTO( r_lockfrustum, "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
|
||||||
CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models" );
|
CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models" );
|
||||||
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
|
||||||
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
|
||||||
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
|
||||||
@@ -549,24 +549,54 @@ qboolean GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char
|
|||||||
for( func = funcs; func && func->name; func++ )
|
for( func = funcs; func && func->name; func++ )
|
||||||
{
|
{
|
||||||
// functions are cleared before all the extensions are evaluated
|
// functions are cleared before all the extensions are evaluated
|
||||||
if((*func->func = (void *)gEngfuncs.GL_GetProcAddress( func->name )) == NULL )
|
if(( *func->func = (void *)gEngfuncs.GL_GetProcAddress( func->name )) == NULL )
|
||||||
{
|
{
|
||||||
|
string name;
|
||||||
|
char *end;
|
||||||
|
size_t i = 0;
|
||||||
|
#ifdef XASH_GLES
|
||||||
|
const char *suffixes[] = { "", "EXT", "OES" };
|
||||||
|
#else
|
||||||
|
const char *suffixes[] = { "", "EXT" };
|
||||||
|
#endif
|
||||||
|
|
||||||
// HACK: fix ARB names
|
// HACK: fix ARB names
|
||||||
char *str = Q_strstr( func->name, "ARB" );
|
Q_strncpy( name, func->name, sizeof( name ));
|
||||||
if(str)
|
if(( end = Q_strstr( name, "ARB" )))
|
||||||
{
|
{
|
||||||
string name;
|
*end = '\0';
|
||||||
|
|
||||||
Q_strncpy( name, func->name, MAX_STRING );
|
|
||||||
name[str - func->name] = '\0';
|
|
||||||
*func->func = gEngfuncs.GL_GetProcAddress( name );
|
|
||||||
|
|
||||||
if( !*func->func )
|
|
||||||
GL_SetExtension( r_ext, false );
|
|
||||||
}
|
}
|
||||||
else
|
else // I need Q_strstrnul
|
||||||
// one or more functions are invalid, extension will be disabled
|
{
|
||||||
|
end = name + Q_strlen( name );
|
||||||
|
i++; // skip empty suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
for( ; i < sizeof( suffixes ) / sizeof( suffixes[0] ); i++ )
|
||||||
|
{
|
||||||
|
void *f;
|
||||||
|
|
||||||
|
Q_strncat( name, suffixes[i], sizeof( name ));
|
||||||
|
|
||||||
|
if(( f = gEngfuncs.GL_GetProcAddress( name )))
|
||||||
|
{
|
||||||
|
// GL_GetProcAddress prints errors about missing functions, so tell user that we found it with different name
|
||||||
|
gEngfuncs.Con_Printf( S_NOTE "found %s\n", name );
|
||||||
|
|
||||||
|
*func->func = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*end = '\0'; // cut suffix, try next
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found...
|
||||||
|
if( i == sizeof( suffixes ) / sizeof( suffixes[0] ))
|
||||||
|
{
|
||||||
GL_SetExtension( r_ext, false );
|
GL_SetExtension( r_ext, false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -829,7 +859,9 @@ void GL_InitExtensionsGLES( void )
|
|||||||
#endif
|
#endif
|
||||||
case GL_DEBUG_OUTPUT:
|
case GL_DEBUG_OUTPUT:
|
||||||
if( glw_state.extended )
|
if( glw_state.extended )
|
||||||
GL_CheckExtension( "GL_KHR_debug", NULL, NULL, extid, 0 );
|
GL_CheckExtension( "GL_KHR_debug", debugoutputfuncs, "gl_debug_output", extid, 0 );
|
||||||
|
else
|
||||||
|
GL_SetExtension( extid, false );
|
||||||
break;
|
break;
|
||||||
// case GL_TEXTURE_COMPRESSION_EXT: NOPE
|
// case GL_TEXTURE_COMPRESSION_EXT: NOPE
|
||||||
// case GL_SHADER_GLSL100_EXT: NOPE
|
// case GL_SHADER_GLSL100_EXT: NOPE
|
||||||
@@ -1093,6 +1125,7 @@ void GL_InitExtensions( void )
|
|||||||
|
|
||||||
// force everything to happen in the main thread instead of in a separate driver thread
|
// force everything to happen in the main thread instead of in a separate driver thread
|
||||||
pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB );
|
pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable all the low priority messages
|
// enable all the low priority messages
|
||||||
@@ -1345,7 +1378,7 @@ void GL_SetupAttributes( int safegl )
|
|||||||
#ifdef XASH_NANOGL
|
#ifdef XASH_NANOGL
|
||||||
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MAJOR_VERSION, 1 );
|
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MAJOR_VERSION, 1 );
|
||||||
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MINOR_VERSION, 1 );
|
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MINOR_VERSION, 1 );
|
||||||
#elif defined( XASH_WES ) || defined( XASH_REGAL )
|
#else
|
||||||
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MAJOR_VERSION, 2 );
|
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MAJOR_VERSION, 2 );
|
||||||
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MINOR_VERSION, 0 );
|
gEngfuncs.GL_SetAttribute( REF_GL_CONTEXT_MINOR_VERSION, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ static void R_ParseDetailTextures( const char *filename )
|
|||||||
if( Q_stricmp( tex->name, texname ))
|
if( Q_stricmp( tex->name, texname ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tex->dt_texturenum = GL_LoadTexture( detail_path, NULL, 0, TF_FORCE_COLOR );
|
tex->dt_texturenum = GL_LoadTexture( detail_path, NULL, 0, TF_FORCE_COLOR|TF_NOFLIP_TGA );
|
||||||
|
|
||||||
// texture is loaded
|
// texture is loaded
|
||||||
if( tex->dt_texturenum )
|
if( tex->dt_texturenum )
|
||||||
|
|||||||
@@ -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] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -877,7 +875,7 @@ void DrawGLPolyChain( glpoly_t *p, float soffset, float toffset )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline qboolean R_HasLightmap( void )
|
static qboolean R_HasLightmap( void )
|
||||||
{
|
{
|
||||||
if( r_fullbright->value || !WORLDMODEL->lightdata )
|
if( r_fullbright->value || !WORLDMODEL->lightdata )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1726,7 +1726,7 @@ static void R_LightLambert( vec4_t light[MAX_LOCALLIGHTS], const vec3_t normal,
|
|||||||
out[2] = Q_min( (int)( finalLight[2] ), 255 );
|
out[2] = Q_min( (int)( finalLight[2] ), 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void R_StudioSetColorArray(short *ptricmds, vec3_t *pstudionorms, byte *color )
|
static void R_StudioSetColorArray( short *ptricmds, vec3_t *pstudionorms, byte *color )
|
||||||
{
|
{
|
||||||
float *lv = (float *)g_studio.lightvalues[ptricmds[1]];
|
float *lv = (float *)g_studio.lightvalues[ptricmds[1]];
|
||||||
|
|
||||||
@@ -1896,9 +1896,8 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
static void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
||||||
{
|
{
|
||||||
float *lv;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while(( i = *( ptricmds++ )))
|
while(( i = *( ptricmds++ )))
|
||||||
@@ -1929,9 +1928,8 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||||
{
|
{
|
||||||
float *lv;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while(( i = *( ptricmds++ )))
|
while(( i = *( ptricmds++ )))
|
||||||
@@ -1961,7 +1959,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
static void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
||||||
{
|
{
|
||||||
float *lv, *av;
|
float *lv, *av;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
@@ -2006,7 +2004,7 @@ _inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, floa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_inline int R_StudioBuildIndices( qboolean tri_strip, int vertexState )
|
static int R_StudioBuildIndices( qboolean tri_strip, int vertexState )
|
||||||
{
|
{
|
||||||
// build in indices
|
// build in indices
|
||||||
if( vertexState++ < 3 )
|
if( vertexState++ < 3 )
|
||||||
@@ -2049,7 +2047,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioBuildArrayNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
static void R_StudioBuildArrayNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -2092,7 +2090,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioBuildArrayFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioBuildArrayFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -2135,7 +2133,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
static void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
||||||
{
|
{
|
||||||
float *lv, *av;
|
float *lv, *av;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
@@ -2192,7 +2190,7 @@ _inline void R_StudioBuildArrayChromeMesh( short *ptricmds, vec3_t *pstudionorms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline void R_StudioDrawArrays( uint startverts, uint startelems )
|
static void R_StudioDrawArrays( uint startverts, uint startelems )
|
||||||
{
|
{
|
||||||
pglEnableClientState( GL_VERTEX_ARRAY );
|
pglEnableClientState( GL_VERTEX_ARRAY );
|
||||||
pglVertexPointer( 3, GL_FLOAT, 12, g_studio.arrayverts );
|
pglVertexPointer( 3, GL_FLOAT, 12, g_studio.arrayverts );
|
||||||
|
|||||||
@@ -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 )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ CVAR_DEFINE_AUTO( sw_surfcacheoverride, "0", 0, "");
|
|||||||
static CVAR_DEFINE_AUTO( sw_waterwarp, "1", FCVAR_GLCONFIG, "nothing");
|
static CVAR_DEFINE_AUTO( sw_waterwarp, "1", FCVAR_GLCONFIG, "nothing");
|
||||||
static CVAR_DEFINE_AUTO( sw_notransbrushes, "0", FCVAR_GLCONFIG, "do not apply transparency to water/glasses (faster)");
|
static CVAR_DEFINE_AUTO( sw_notransbrushes, "0", FCVAR_GLCONFIG, "do not apply transparency to water/glasses (faster)");
|
||||||
CVAR_DEFINE_AUTO( sw_noalphabrushes, "0", FCVAR_GLCONFIG, "do not draw brush holes (faster)");
|
CVAR_DEFINE_AUTO( sw_noalphabrushes, "0", FCVAR_GLCONFIG, "do not draw brush holes (faster)");
|
||||||
CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models" );
|
CVAR_DEFINE_AUTO( r_traceglow, "0", FCVAR_GLCONFIG, "cull flares behind models" );
|
||||||
CVAR_DEFINE_AUTO( sw_texfilt, "0", FCVAR_GLCONFIG, "texture dither");
|
CVAR_DEFINE_AUTO( sw_texfilt, "0", FCVAR_GLCONFIG, "texture dither");
|
||||||
static CVAR_DEFINE_AUTO( r_novis, "0", 0, "" );
|
static CVAR_DEFINE_AUTO( r_novis, "0", 0, "" );
|
||||||
|
|
||||||
|
|||||||
@@ -1891,7 +1891,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
static void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -1924,7 +1924,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
static void R_StudioDrawFloatMesh( short *ptricmds, vec3_t *pstudionorms )
|
||||||
{
|
{
|
||||||
float *lv;
|
float *lv;
|
||||||
int i;
|
int i;
|
||||||
@@ -1956,7 +1956,7 @@ R_StudioDrawNormalMesh
|
|||||||
generic path
|
generic path
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
_inline void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
static void R_StudioDrawChromeMesh( short *ptricmds, vec3_t *pstudionorms, float s, float t, float scale )
|
||||||
{
|
{
|
||||||
float *lv, *av;
|
float *lv, *av;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
|
|||||||
2
wscript
2
wscript
@@ -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')
|
||||||
|
|||||||
Reference in New Issue
Block a user