mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 11:35:05 +08:00
Compare commits
43 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05ff0d6020 | ||
|
|
3cea12627e | ||
|
|
b59b7c1a8d | ||
|
|
dd2c369df3 | ||
|
|
8b79e49a0f | ||
|
|
4ea6eba8f2 | ||
|
|
f649076bc3 | ||
|
|
8ecffa4663 | ||
|
|
e90b83849a | ||
|
|
d517b9717a | ||
|
|
2c0d6e06be | ||
|
|
dec71850a1 | ||
|
|
b1860972c6 | ||
|
|
1f4c9b67da | ||
|
|
c2da125358 | ||
|
|
31fa990d44 | ||
|
|
d3e60c7d84 | ||
|
|
e2424b4303 | ||
|
|
240563cd1b | ||
|
|
d708cd58fb | ||
|
|
491b503f96 | ||
|
|
636a2228f6 | ||
|
|
bb03e2597c | ||
|
|
21c828ee40 | ||
|
|
132c9de142 | ||
|
|
9d9507d77f | ||
|
|
7daa6c3451 | ||
|
|
c8e1ffe0dd | ||
|
|
b5f02324a6 | ||
|
|
47f5dfdcfd | ||
|
|
33da68b013 | ||
|
|
618ec83c9d | ||
|
|
85de61ebc8 | ||
|
|
2feaae59f7 | ||
|
|
2550d7fbd3 | ||
|
|
565f717804 | ||
|
|
b56c83a2f9 | ||
|
|
bf17996f72 | ||
|
|
a3acb1c85b | ||
|
|
d4d63301e0 | ||
|
|
e9af0c9810 | ||
|
|
131ad9c790 | ||
|
|
bfcaba54dc |
2
3rdparty/gl-wes-v2
vendored
2
3rdparty/gl-wes-v2
vendored
Submodule 3rdparty/gl-wes-v2 updated: f2a28de15d...2d9b5afe10
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: 7223589d60...46d05f9ff5
2
3rdparty/nanogl
vendored
2
3rdparty/nanogl
vendored
Submodule 3rdparty/nanogl updated: 6b6a947ee0...76393a8fde
2
3rdparty/vgui_support
vendored
2
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support updated: f85d64c149...a2a7b9073f
65
Documentation/extensions/sounds.lst.md
Normal file
65
Documentation/extensions/sounds.lst.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# sounds.lst.md
|
||||||
|
|
||||||
|
Using sounds.lst located in scripts folder, modder can override some of the hardcoded sounds in temp entities and server physics.
|
||||||
|
|
||||||
|
File format:
|
||||||
|
```
|
||||||
|
<group name>
|
||||||
|
{
|
||||||
|
<path1>
|
||||||
|
<path2>
|
||||||
|
<path3>
|
||||||
|
}
|
||||||
|
|
||||||
|
<group2 name> <path with %d> <min number> <max number>
|
||||||
|
```
|
||||||
|
|
||||||
|
* Sounds can use any supported sound format (WAV or MP3).
|
||||||
|
* The path must be relative to the sounds/ folder in the game or base directory root, addon folder, or archive root.
|
||||||
|
* Groups can be empty or omitted from the file to load no sound.
|
||||||
|
* Groups can either list a set of files or specify a format string and a range.
|
||||||
|
* Anything after // will be considered a comment and ignored.
|
||||||
|
* Behavior is undefined if the group was listed multiple times.
|
||||||
|
|
||||||
|
Currently supported groups are:
|
||||||
|
|Group name|Usage|
|
||||||
|
|----------|-----|
|
||||||
|
|`BouncePlayerShell`|Used for BOUNCE_SHELL tempentity hitsound|
|
||||||
|
|`BounceWeaponShell`|Used for BOUCNE_SHOTSHELL tempentity hitsound|
|
||||||
|
|`BounceConcrete`|Used for BOUNCE_CONCRETE tempentity hitsound|
|
||||||
|
|`BounceGlass`|Used for BOUCNE_GLASS|
|
||||||
|
|`BounceMetal`|Used for BOUNCE_METAL|
|
||||||
|
|`BounceFlesh`|Used for BOUNCE_FLESH|
|
||||||
|
|`BounceWood`|Used for BOUNCE_WOOD|
|
||||||
|
|`Ricochet`|Used for BOUNCE_SHRAP and ricochet tempentities|
|
||||||
|
|`Explode`|Used for tempentity explosions|
|
||||||
|
|`EntityWaterEnter`|Used for entity entering water|
|
||||||
|
|`EntityWaterExit`|Used for entity exiting water|
|
||||||
|
|`PlayerWaterEnter`|Used for player entering water|
|
||||||
|
|`PlayerWaterExit`|Used for player exiting water|
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
This example is based on defaults sounds used in Half-Life:
|
||||||
|
|
||||||
|
```
|
||||||
|
BouncePlayerShell "player/pl_shell%d.wav" 1 3
|
||||||
|
BounceWeaponShell "weapons/sshell%d.wav" 1 3
|
||||||
|
BounceConcrete "debris/concrete%d.wav" 1 3
|
||||||
|
BounceGlass "debris/glass%d.wav" 1 4
|
||||||
|
BounceMetal "debris/metal%d.wav" 1 6
|
||||||
|
BounceFlesh "debris/flesh%d.wav" 1 7
|
||||||
|
BounceWood "debris/wood%d.wav" 1 4
|
||||||
|
Ricochet "weapons/ric%d.wav" 1 5
|
||||||
|
Explode "weapons/explode%d.wav" 3 5
|
||||||
|
EntityWaterEnter "player/pl_wade%d.wav" 1 4
|
||||||
|
EntityWaterExit "player/pl_wade%d.wav" 1 4
|
||||||
|
PlayerWaterEnter
|
||||||
|
{
|
||||||
|
"player/pl_wade1.wav"
|
||||||
|
}
|
||||||
|
PlayerWaterExit
|
||||||
|
{
|
||||||
|
"player/pl_wade2.wav"
|
||||||
|
}
|
||||||
|
```
|
||||||
15
Documentation/musl.md
Normal file
15
Documentation/musl.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Xash3D FWGS on `musl`
|
||||||
|
|
||||||
|
Xash3D FWGS works on `musl` out of the box. However, the engine doesn't try to differentiate glibc and musl anymore. If you see error similar to:
|
||||||
|
|
||||||
|
```
|
||||||
|
Host_InitError: can't initialize cl_dlls/client.so: Error relocating valve/cl_dlls/client.so: __sprintf_chk: symbol not found
|
||||||
|
```
|
||||||
|
|
||||||
|
... or you know that the game you're running is linked against glibc, you can try using `libgcompat`, like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ...
|
||||||
|
```
|
||||||
|
|
||||||
|
It will automatically add the missing symbols that glibc binaries usually need. In the future we might automatically link engine against `libgcompat` for better compatibility with prebuilt or closed-source games, if there will be any use for this.
|
||||||
@@ -46,10 +46,35 @@ static int CL_LoadFontTexture( const char *fontname, uint texFlags, int *width )
|
|||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
static int CL_FontRenderMode( convar_t *fontrender )
|
||||||
|
{
|
||||||
|
switch((int)fontrender->value )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return kRenderTransAdd;
|
||||||
|
case 1:
|
||||||
|
return kRenderTransAlpha;
|
||||||
|
case 2:
|
||||||
|
return kRenderTransTexture;
|
||||||
|
default:
|
||||||
|
Cvar_DirectSet( fontrender, fontrender->def_string );
|
||||||
|
}
|
||||||
|
|
||||||
|
return kRenderTransTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CL_SetFontRendermode( cl_font_t *font )
|
||||||
|
{
|
||||||
|
ref.dllFuncs.GL_SetRenderMode( CL_FontRenderMode( font->rendermode ));
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||||
{
|
{
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
|
if( !rendermode )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true; // already loaded
|
return true; // already loaded
|
||||||
|
|
||||||
@@ -76,13 +101,16 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||||
{
|
{
|
||||||
fs_offset_t length;
|
fs_offset_t length;
|
||||||
qfont_t src;
|
qfont_t src;
|
||||||
byte *pfile;
|
byte *pfile;
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
|
if( !rendermode )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -105,7 +133,7 @@ qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float
|
|||||||
|
|
||||||
font->type = FONT_VARIABLE;
|
font->type = FONT_VARIABLE;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale;
|
font->scale = scale ? scale : 1.0f;
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( src.rowheight * scale );
|
font->charHeight = Q_rint( src.rowheight * scale );
|
||||||
|
|
||||||
@@ -177,7 +205,8 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
|||||||
return font->charWidths[number];
|
return font->charWidths[number];
|
||||||
|
|
||||||
rc = &font->fontRc[number];
|
rc = &font->fontRc[number];
|
||||||
if( font->scale <= 1.0f || REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture ))
|
|
||||||
|
if( font->scale <= 1.f || !REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture ))
|
||||||
half = 0;
|
half = 0;
|
||||||
|
|
||||||
s1 = ((float)rc->left + half ) / texw;
|
s1 = ((float)rc->left + half ) / texw;
|
||||||
@@ -191,7 +220,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
|||||||
SPR_AdjustSize( &x, &y, &w, &h );
|
SPR_AdjustSize( &x, &y, &w, &h );
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
// don't apply color to fixed fonts it's already colored
|
// don't apply color to fixed fonts it's already colored
|
||||||
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
||||||
@@ -214,7 +243,7 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon
|
|||||||
Con_UtfProcessChar( 0 ); // clear utf state
|
Con_UtfProcessChar( 0 ); // clear utf state
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
Vector4Copy( color, current_color );
|
Vector4Copy( color, current_color );
|
||||||
|
|
||||||
|
|||||||
@@ -474,8 +474,7 @@ void CL_DrawCenterPrint( void )
|
|||||||
pText = clgame.centerPrint.message;
|
pText = clgame.centerPrint.message;
|
||||||
|
|
||||||
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
||||||
|
CL_SetFontRendermode( font );
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
|
||||||
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
||||||
{
|
{
|
||||||
lineLength = 0;
|
lineLength = 0;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ CVAR_DEFINE_AUTO( cl_smoothtime, "0.1", FCVAR_ARCHIVE, "time to smooth up" );
|
|||||||
CVAR_DEFINE_AUTO( cl_clockreset, "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
|
CVAR_DEFINE_AUTO( cl_clockreset, "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
|
||||||
CVAR_DEFINE_AUTO( cl_fixtimerate, "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
|
CVAR_DEFINE_AUTO( cl_fixtimerate, "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
|
||||||
CVAR_DEFINE_AUTO( hud_fontscale, "1.0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud font texture" );
|
CVAR_DEFINE_AUTO( hud_fontscale, "1.0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud font texture" );
|
||||||
|
CVAR_DEFINE_AUTO( hud_fontrender, "0", FCVAR_ARCHIVE, "hud font render mode (0: additive, 1: holes, 2: trans)" );
|
||||||
CVAR_DEFINE_AUTO( hud_scale, "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
CVAR_DEFINE_AUTO( hud_scale, "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
||||||
CVAR_DEFINE_AUTO( hud_scale_minimal_width, "640", FCVAR_ARCHIVE|FCVAR_LATCH, "if hud_scale results in a HUD virtual screen smaller than this value, it won't be applied" );
|
CVAR_DEFINE_AUTO( hud_scale_minimal_width, "640", FCVAR_ARCHIVE|FCVAR_LATCH, "if hud_scale results in a HUD virtual screen smaller than this value, it won't be applied" );
|
||||||
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
CVAR_DEFINE_AUTO( cl_solid_players, "1", 0, "Make all players not solid (can't traceline them)" );
|
||||||
@@ -74,8 +75,9 @@ static CVAR_DEFINE_AUTO( cl_upmax, "1200", FCVAR_ARCHIVE, "max allowed incoming
|
|||||||
|
|
||||||
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
CVAR_DEFINE_AUTO( cl_lw, "1", FCVAR_ARCHIVE|FCVAR_USERINFO, "enable client weapon predicting" );
|
||||||
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
CVAR_DEFINE_AUTO( cl_charset, "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
||||||
CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)");
|
CVAR_DEFINE_AUTO( cl_trace_stufftext, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable stufftext (server-to-client console commands) tracing (good for developers)" );
|
||||||
CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)");
|
CVAR_DEFINE_AUTO( cl_trace_messages, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)" );
|
||||||
|
CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable events tracing (good for developers)" );
|
||||||
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
||||||
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
||||||
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||||
@@ -2891,6 +2893,7 @@ static void CL_InitLocal( void )
|
|||||||
|
|
||||||
Cvar_RegisterVariable( &rcon_address );
|
Cvar_RegisterVariable( &rcon_address );
|
||||||
|
|
||||||
|
Cvar_RegisterVariable( &cl_trace_stufftext );
|
||||||
Cvar_RegisterVariable( &cl_trace_messages );
|
Cvar_RegisterVariable( &cl_trace_messages );
|
||||||
Cvar_RegisterVariable( &cl_trace_events );
|
Cvar_RegisterVariable( &cl_trace_events );
|
||||||
|
|
||||||
@@ -2926,6 +2929,7 @@ static void CL_InitLocal( void )
|
|||||||
Cvar_RegisterVariable( &cl_clockreset );
|
Cvar_RegisterVariable( &cl_clockreset );
|
||||||
Cvar_RegisterVariable( &cl_fixtimerate );
|
Cvar_RegisterVariable( &cl_fixtimerate );
|
||||||
Cvar_RegisterVariable( &hud_fontscale );
|
Cvar_RegisterVariable( &hud_fontscale );
|
||||||
|
Cvar_RegisterVariable( &hud_fontrender );
|
||||||
Cvar_RegisterVariable( &hud_scale );
|
Cvar_RegisterVariable( &hud_scale );
|
||||||
Cvar_RegisterVariable( &hud_scale_minimal_width );
|
Cvar_RegisterVariable( &hud_scale_minimal_width );
|
||||||
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
|||||||
// move rolling average
|
// move rolling average
|
||||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
||||||
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
if( framerate > 0.0f )
|
if( framerate > 0.0f )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1382,9 +1382,13 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
|||||||
if( slot >= MAX_CLIENTS )
|
if( slot >= MAX_CLIENTS )
|
||||||
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
Host_Error( "CL_ParseServerMessage: svc_updateuserinfo >= MAX_CLIENTS\n" );
|
||||||
|
|
||||||
|
player = &cl.players[slot];
|
||||||
|
|
||||||
if( !legacy )
|
if( !legacy )
|
||||||
id = MSG_ReadLong( msg ); // unique user ID
|
id = MSG_ReadLong( msg ); // unique user ID
|
||||||
player = &cl.players[slot];
|
else
|
||||||
|
id = 0; // bogus
|
||||||
|
|
||||||
active = MSG_ReadOneBit( msg ) ? true : false;
|
active = MSG_ReadOneBit( msg ) ? true : false;
|
||||||
|
|
||||||
if( active )
|
if( active )
|
||||||
@@ -1406,6 +1410,10 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
|
|||||||
|
|
||||||
memset( player, 0, sizeof( *player ));
|
memset( player, 0, sizeof( *player ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in GoldSrc userinfo might be empty but userid is always sent as separate value
|
||||||
|
// thus avoids clean up even after client disconnect
|
||||||
|
player->userid = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2321,11 +2329,18 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
s = MSG_ReadString( msg );
|
||||||
|
if( cl_trace_stufftext.value )
|
||||||
|
{
|
||||||
|
size_t len = Q_strlen( s );
|
||||||
|
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HACKS_RELATED_HLMODS
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
|
|||||||
@@ -443,13 +443,17 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
s = MSG_ReadString( msg );
|
||||||
|
if( cl_trace_stufftext.value )
|
||||||
|
{
|
||||||
|
size_t len = Q_strlen( s );
|
||||||
|
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HACKS_RELATED_HLMODS
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Con_Reportf( "Stufftext: %s", s );
|
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
|
|||||||
@@ -288,6 +288,9 @@ void SCR_MakeScreenShot( void )
|
|||||||
qboolean iRet = false;
|
qboolean iRet = false;
|
||||||
int viewsize;
|
int viewsize;
|
||||||
|
|
||||||
|
if( cls.scrshot_action == scrshot_inactive )
|
||||||
|
return;
|
||||||
|
|
||||||
if( cls.envshot_viewsize > 0 )
|
if( cls.envshot_viewsize > 0 )
|
||||||
viewsize = cls.envshot_viewsize;
|
viewsize = cls.envshot_viewsize;
|
||||||
else viewsize = cl_envshot_size.value;
|
else viewsize = cl_envshot_size.value;
|
||||||
@@ -319,8 +322,6 @@ void SCR_MakeScreenShot( void )
|
|||||||
if( iRet )
|
if( iRet )
|
||||||
VID_WriteOverviewScript(); // store overview script too
|
VID_WriteOverviewScript(); // store overview script too
|
||||||
break;
|
break;
|
||||||
case scrshot_inactive:
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// report
|
// report
|
||||||
@@ -572,15 +573,15 @@ void SCR_LoadCreditsFont( void )
|
|||||||
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( charsetFnt, false ))
|
if( FS_FileExists( charsetFnt, false ))
|
||||||
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, kRenderTransAdd, TF_FONT );
|
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, &hud_fontrender, TF_FONT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, kRenderTransAdd, TF_FONT );
|
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, &hud_fontrender, TF_FONT );
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransAdd, TF_FONT );
|
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &hud_fontrender, TF_FONT );
|
||||||
|
|
||||||
// copy font size for client.dll
|
// copy font size for client.dll
|
||||||
if( success )
|
if( success )
|
||||||
|
|||||||
@@ -57,36 +57,6 @@ const char *cl_default_sprites[] =
|
|||||||
"sprites/shellchrome.spr",
|
"sprites/shellchrome.spr",
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *cl_player_shell_sounds[] =
|
|
||||||
{
|
|
||||||
"player/pl_shell1.wav",
|
|
||||||
"player/pl_shell2.wav",
|
|
||||||
"player/pl_shell3.wav",
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *cl_weapon_shell_sounds[] =
|
|
||||||
{
|
|
||||||
"weapons/sshell1.wav",
|
|
||||||
"weapons/sshell2.wav",
|
|
||||||
"weapons/sshell3.wav",
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *cl_ricochet_sounds[] =
|
|
||||||
{
|
|
||||||
"weapons/ric1.wav",
|
|
||||||
"weapons/ric2.wav",
|
|
||||||
"weapons/ric3.wav",
|
|
||||||
"weapons/ric4.wav",
|
|
||||||
"weapons/ric5.wav",
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *cl_explode_sounds[] =
|
|
||||||
{
|
|
||||||
"weapons/explode3.wav",
|
|
||||||
"weapons/explode4.wav",
|
|
||||||
"weapons/explode5.wav",
|
|
||||||
};
|
|
||||||
|
|
||||||
static void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
static void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -148,6 +118,7 @@ client resources not precached by server
|
|||||||
*/
|
*/
|
||||||
void CL_AddClientResources( void )
|
void CL_AddClientResources( void )
|
||||||
{
|
{
|
||||||
|
const char *snd;
|
||||||
char filepath[MAX_QPATH];
|
char filepath[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -163,37 +134,37 @@ void CL_AddClientResources( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then check sounds
|
// then check sounds
|
||||||
for( i = 0; i < ARRAYSIZE( cl_player_shell_sounds ); i++ )
|
for( i = 0; ( snd = SoundList_Get( BouncePlayerShell, i )); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_player_shell_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_player_shell_sounds[i], t_sound );
|
CL_AddClientResource( snd, t_sound );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( cl_weapon_shell_sounds ); i++ )
|
for( i = 0; ( snd = SoundList_Get( BounceWeaponShell, i )); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_weapon_shell_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_weapon_shell_sounds[i], t_sound );
|
CL_AddClientResource( snd, t_sound );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( cl_explode_sounds ); i++ )
|
for( i = 0; ( snd = SoundList_Get( Explode, i )); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_explode_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_explode_sounds[i], t_sound );
|
CL_AddClientResource( snd, t_sound );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // ric sounds was precached by server-side
|
#if 0 // ric sounds was precached by server-side
|
||||||
for( i = 0; i < ARRAYSIZE( cl_ricochet_sounds ); i++ )
|
for( i = 0; ( snd = SoundList_Get( Ricochet, i )); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_ricochet_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", snd );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_ricochet_sounds[i], t_sound );
|
CL_AddClientResource( snd, t_sound );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -301,7 +272,7 @@ play collide sound
|
|||||||
static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
||||||
{
|
{
|
||||||
float fvol;
|
float fvol;
|
||||||
char soundname[32];
|
const char *soundname = NULL;
|
||||||
qboolean isshellcasing = false;
|
qboolean isshellcasing = false;
|
||||||
int zvel;
|
int zvel;
|
||||||
|
|
||||||
@@ -312,36 +283,39 @@ static void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
|||||||
switch( pTemp->hitSound )
|
switch( pTemp->hitSound )
|
||||||
{
|
{
|
||||||
case BOUNCE_GLASS:
|
case BOUNCE_GLASS:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/glass%i.wav", COM_RandomLong( 1, 4 ));
|
soundname = SoundList_GetRandom( BounceGlass );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_METAL:
|
case BOUNCE_METAL:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/metal%i.wav", COM_RandomLong( 1, 6 ));
|
soundname = SoundList_GetRandom( BounceMetal );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_FLESH:
|
case BOUNCE_FLESH:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/flesh%i.wav", COM_RandomLong( 1, 7 ));
|
soundname = SoundList_GetRandom( BounceFlesh );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_WOOD:
|
case BOUNCE_WOOD:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/wood%i.wav", COM_RandomLong( 1, 4 ));
|
soundname = SoundList_GetRandom( BounceWood );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHRAP:
|
case BOUNCE_SHRAP:
|
||||||
Q_strncpy( soundname, cl_ricochet_sounds[COM_RandomLong( 0, 4 )], sizeof( soundname ) );
|
soundname = SoundList_GetRandom( Ricochet );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHOTSHELL:
|
case BOUNCE_SHOTSHELL:
|
||||||
Q_strncpy( soundname, cl_weapon_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
soundname = SoundList_GetRandom( BounceWeaponShell );
|
||||||
isshellcasing = true; // shell casings have different playback parameters
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
fvol = 0.5f;
|
fvol = 0.5f;
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHELL:
|
case BOUNCE_SHELL:
|
||||||
Q_strncpy( soundname, cl_player_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
soundname = SoundList_GetRandom( BouncePlayerShell );
|
||||||
isshellcasing = true; // shell casings have different playback parameters
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
break;
|
break;
|
||||||
case BOUNCE_CONCRETE:
|
case BOUNCE_CONCRETE:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/concrete%i.wav", COM_RandomLong( 1, 3 ));
|
soundname = SoundList_GetRandom( BounceConcrete );
|
||||||
break;
|
break;
|
||||||
default: // null sound
|
default: // null sound
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !soundname )
|
||||||
|
return;
|
||||||
|
|
||||||
zvel = abs( pTemp->entity.baseline.origin[2] );
|
zvel = abs( pTemp->entity.baseline.origin[2] );
|
||||||
|
|
||||||
// only play one out of every n
|
// only play one out of every n
|
||||||
@@ -1491,7 +1465,7 @@ void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
|
|||||||
===============
|
===============
|
||||||
R_SparkEffect
|
R_SparkEffect
|
||||||
|
|
||||||
Create a streaks + richochet sprite
|
Create a streaks + ricochet sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
void GAME_EXPORT R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
||||||
@@ -1507,18 +1481,25 @@ R_RicochetSound
|
|||||||
Make a random ricochet sound
|
Make a random ricochet sound
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static void R_RicochetSound_( const vec3_t pos, int sound )
|
static void R_RicochetSoundByName( const vec3_t pos, const char *name )
|
||||||
{
|
{
|
||||||
sound_t handle;
|
sound_t handle;
|
||||||
|
handle = S_RegisterSound( name );
|
||||||
handle = S_RegisterSound( cl_ricochet_sounds[sound] );
|
|
||||||
|
|
||||||
S_StartSound( pos, 0, CHAN_AUTO, handle, VOL_NORM, 1.0, 100, 0 );
|
S_StartSound( pos, 0, CHAN_AUTO, handle, VOL_NORM, 1.0, 100, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void R_RicochetSoundByIndex( const vec3_t pos, int idx )
|
||||||
|
{
|
||||||
|
const char *name = SoundList_Get( Ricochet, idx );
|
||||||
|
if( name )
|
||||||
|
R_RicochetSoundByName( pos, name );
|
||||||
|
}
|
||||||
|
|
||||||
void GAME_EXPORT R_RicochetSound( const vec3_t pos )
|
void GAME_EXPORT R_RicochetSound( const vec3_t pos )
|
||||||
{
|
{
|
||||||
R_RicochetSound_( pos, COM_RandomLong( 0, 4 ));
|
const char *name = SoundList_GetRandom( Ricochet );
|
||||||
|
if( name )
|
||||||
|
R_RicochetSoundByName( pos, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1665,8 +1646,12 @@ void GAME_EXPORT R_Explosion( vec3_t pos, int model, float scale, float framerat
|
|||||||
|
|
||||||
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
||||||
{
|
{
|
||||||
hSound = S_RegisterSound( cl_explode_sounds[COM_RandomLong( 0, 2 )] );
|
const char *name = SoundList_GetRandom( Explode );
|
||||||
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
if( name )
|
||||||
|
{
|
||||||
|
hSound = S_RegisterSound( name );
|
||||||
|
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1909,6 +1894,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
cl_entity_t *pEnt;
|
cl_entity_t *pEnt;
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
sound_t hSound;
|
sound_t hSound;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
if( cls.legacymode )
|
if( cls.legacymode )
|
||||||
iSize = MSG_ReadByte( msg );
|
iSize = MSG_ReadByte( msg );
|
||||||
@@ -1968,8 +1954,11 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
pos[2] = MSG_ReadCoord( &buf );
|
pos[2] = MSG_ReadCoord( &buf );
|
||||||
R_BlobExplosion( pos );
|
R_BlobExplosion( pos );
|
||||||
|
|
||||||
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
if(( name = SoundList_Get( Explode, 0 )))
|
||||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
{
|
||||||
|
hSound = S_RegisterSound( name );
|
||||||
|
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TE_SMOKE:
|
case TE_SMOKE:
|
||||||
pos[0] = MSG_ReadCoord( &buf );
|
pos[0] = MSG_ReadCoord( &buf );
|
||||||
@@ -2022,8 +2011,11 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
dl->die = cl.time + 0.5;
|
dl->die = cl.time + 0.5;
|
||||||
dl->decay = 300;
|
dl->decay = 300;
|
||||||
|
|
||||||
hSound = S_RegisterSound( cl_explode_sounds[0] );
|
if(( name = SoundList_Get( Explode, 0 )))
|
||||||
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 0.6f, PITCH_NORM, 0 );
|
{
|
||||||
|
hSound = S_RegisterSound( name );
|
||||||
|
S_StartSound( pos, -1, CHAN_AUTO, hSound, VOL_NORM, 1.0f, PITCH_NORM, 0 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TE_BSPDECAL:
|
case TE_BSPDECAL:
|
||||||
case TE_DECAL:
|
case TE_DECAL:
|
||||||
@@ -2251,8 +2243,8 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
|||||||
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
CL_DecalShoot( CL_DecalIndex( decalIndex ), entityIndex, 0, pos, 0 );
|
||||||
R_BulletImpactParticles( pos );
|
R_BulletImpactParticles( pos );
|
||||||
flags = COM_RandomLong( 0, 0x7fff );
|
flags = COM_RandomLong( 0, 0x7fff );
|
||||||
if( flags < 0x3fff )
|
if( flags < 0x3fff && ( count = SoundList_Count( Ricochet )))
|
||||||
R_RicochetSound_( pos, flags % 5 );
|
R_RicochetSoundByIndex( pos, flags % count );
|
||||||
break;
|
break;
|
||||||
case TE_SPRAY:
|
case TE_SPRAY:
|
||||||
case TE_SPRITE_SPRAY:
|
case TE_SPRITE_SPRAY:
|
||||||
|
|||||||
@@ -553,4 +553,6 @@ void V_PostRender( void )
|
|||||||
ref.dllFuncs.R_AllowFog( true );
|
ref.dllFuncs.R_AllowFog( true );
|
||||||
Platform_SetTimer( 0.0f );
|
Platform_SetTimer( 0.0f );
|
||||||
ref.dllFuncs.R_EndFrame();
|
ref.dllFuncs.R_EndFrame();
|
||||||
|
|
||||||
|
V_CheckGammaEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ typedef struct
|
|||||||
byte charWidths[256]; // scaled widths
|
byte charWidths[256]; // scaled widths
|
||||||
int charHeight; // scaled height
|
int charHeight; // scaled height
|
||||||
int type; // fixed width font or variable
|
int type; // fixed width font or variable
|
||||||
int rendermode; // default rendermode
|
convar_t *rendermode; // user-defined default rendermode
|
||||||
qboolean valid; // all rectangles are valid
|
qboolean valid; // all rectangles are valid
|
||||||
} cl_font_t;
|
} cl_font_t;
|
||||||
|
|
||||||
@@ -681,12 +681,14 @@ extern convar_t cl_draw_beams;
|
|||||||
extern convar_t cl_clockreset;
|
extern convar_t cl_clockreset;
|
||||||
extern convar_t cl_fixtimerate;
|
extern convar_t cl_fixtimerate;
|
||||||
extern convar_t hud_fontscale;
|
extern convar_t hud_fontscale;
|
||||||
|
extern convar_t hud_fontrender;
|
||||||
extern convar_t hud_scale;
|
extern convar_t hud_scale;
|
||||||
extern convar_t hud_scale_minimal_width;
|
extern convar_t hud_scale_minimal_width;
|
||||||
extern convar_t r_showtextures;
|
extern convar_t r_showtextures;
|
||||||
extern convar_t cl_bmodelinterp;
|
extern convar_t cl_bmodelinterp;
|
||||||
extern convar_t cl_lw; // local weapons
|
extern convar_t cl_lw; // local weapons
|
||||||
extern convar_t cl_charset;
|
extern convar_t cl_charset;
|
||||||
|
extern convar_t cl_trace_stufftext;
|
||||||
extern convar_t cl_trace_messages;
|
extern convar_t cl_trace_messages;
|
||||||
extern convar_t cl_trace_events;
|
extern convar_t cl_trace_events;
|
||||||
extern convar_t hud_utf8;
|
extern convar_t hud_utf8;
|
||||||
@@ -798,9 +800,10 @@ void CL_FireEvents( void );
|
|||||||
// cl_font.c
|
// cl_font.c
|
||||||
//
|
//
|
||||||
qboolean CL_FixedFont( cl_font_t *font );
|
qboolean CL_FixedFont( cl_font_t *font );
|
||||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||||
void CL_FreeFont( cl_font_t *font );
|
void CL_FreeFont( cl_font_t *font );
|
||||||
|
void CL_SetFontRendermode( cl_font_t *font );
|
||||||
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
||||||
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
||||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ GNU General Public License for more details.
|
|||||||
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
||||||
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
||||||
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
||||||
|
static CVAR_DEFINE_AUTO( con_fontrender, "2", FCVAR_ARCHIVE, "console font render mode (0: additive, 1: holes, 2: trans)" );
|
||||||
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
||||||
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
||||||
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
||||||
@@ -547,7 +548,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
|
|
||||||
if( con_oldfont.value )
|
if( con_oldfont.value )
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -560,14 +561,14 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( Q_snprintf( path, sizeof( path ),
|
if( Q_snprintf( path, sizeof( path ),
|
||||||
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
||||||
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,7 +576,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
{
|
{
|
||||||
// quake fixed font as fallback
|
// quake fixed font as fallback
|
||||||
// keep source to print directly into conback image
|
// keep source to print directly into conback image
|
||||||
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST|TF_KEEP_SOURCE ))
|
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &con_fontrender, TF_FONT|TF_NEAREST|TF_KEEP_SOURCE ))
|
||||||
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -840,6 +841,7 @@ void Con_Init( void )
|
|||||||
Cvar_RegisterVariable( &con_fontsize );
|
Cvar_RegisterVariable( &con_fontsize );
|
||||||
Cvar_RegisterVariable( &con_charset );
|
Cvar_RegisterVariable( &con_charset );
|
||||||
Cvar_RegisterVariable( &con_fontscale );
|
Cvar_RegisterVariable( &con_fontscale );
|
||||||
|
Cvar_RegisterVariable( &con_fontrender );
|
||||||
Cvar_RegisterVariable( &con_fontnum );
|
Cvar_RegisterVariable( &con_fontnum );
|
||||||
Cvar_RegisterVariable( &con_color );
|
Cvar_RegisterVariable( &con_color );
|
||||||
Cvar_RegisterVariable( &scr_drawversion );
|
Cvar_RegisterVariable( &scr_drawversion );
|
||||||
@@ -2185,6 +2187,8 @@ INTERNAL RESOURCE
|
|||||||
*/
|
*/
|
||||||
void Con_VidInit( void )
|
void Con_VidInit( void )
|
||||||
{
|
{
|
||||||
|
const uint flags = TF_IMAGE|TF_ALLOW_NEAREST;
|
||||||
|
|
||||||
if( !con.historyLoaded )
|
if( !con.historyLoaded )
|
||||||
{
|
{
|
||||||
Con_LoadHistory( &con.history );
|
Con_LoadHistory( &con.history );
|
||||||
@@ -2204,28 +2208,28 @@ void Con_VidInit( void )
|
|||||||
{
|
{
|
||||||
// trying to load truecolor image first
|
// trying to load truecolor image first
|
||||||
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, flags );
|
||||||
|
|
||||||
if( !con.background )
|
if( !con.background )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( "cached/conback640", false ))
|
if( FS_FileExists( "cached/conback640", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, flags );
|
||||||
else if( FS_FileExists( "cached/conback", false ))
|
else if( FS_FileExists( "cached/conback", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, flags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// trying to load truecolor image first
|
// trying to load truecolor image first
|
||||||
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, flags );
|
||||||
|
|
||||||
if( !con.background )
|
if( !con.background )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( "cached/loading640", false ))
|
if( FS_FileExists( "cached/loading640", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, flags );
|
||||||
else if( FS_FileExists( "cached/loading", false ))
|
else if( FS_FileExists( "cached/loading", false ))
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, flags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ GNU General Public License for more details.
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Gamma conversion support
|
// Gamma conversion support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
static qboolean gamma_rebuilt;
|
||||||
static byte texgammatable[256];
|
static byte texgammatable[256];
|
||||||
static uint lightgammatable[1024];
|
static uint lightgammatable[1024];
|
||||||
static uint lineargammatable[1024];
|
static uint lineargammatable[1024];
|
||||||
@@ -82,9 +83,6 @@ static void BuildGammaTable( const float gamma, const float brightness, const fl
|
|||||||
|
|
||||||
static void V_ValidateGammaCvars( void )
|
static void V_ValidateGammaCvars( void )
|
||||||
{
|
{
|
||||||
if( Host_IsLocalGame( ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( v_gamma.value < 1.8f )
|
if( v_gamma.value < 1.8f )
|
||||||
Cvar_DirectSet( &v_gamma, "1.8" );
|
Cvar_DirectSet( &v_gamma, "1.8" );
|
||||||
else if( v_gamma.value > 3.0f )
|
else if( v_gamma.value > 3.0f )
|
||||||
@@ -102,14 +100,13 @@ static void V_ValidateGammaCvars( void )
|
|||||||
|
|
||||||
if( v_brightness.value < 0.0f )
|
if( v_brightness.value < 0.0f )
|
||||||
Cvar_DirectSet( &v_brightness, "0" );
|
Cvar_DirectSet( &v_brightness, "0" );
|
||||||
else if( v_brightness.value > 2.0f )
|
else if( v_brightness.value > 3.0f )
|
||||||
Cvar_DirectSet( &v_brightness, "2" );
|
Cvar_DirectSet( &v_brightness, "3" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_CheckGamma( void )
|
void V_CheckGamma( void )
|
||||||
{
|
{
|
||||||
static qboolean dirty = false;
|
static qboolean dirty = false;
|
||||||
qboolean notify_refdll = false;
|
|
||||||
|
|
||||||
// because these cvars were defined as archive
|
// because these cvars were defined as archive
|
||||||
// but wasn't doing anything useful
|
// but wasn't doing anything useful
|
||||||
@@ -135,20 +132,33 @@ void V_CheckGamma( void )
|
|||||||
V_ValidateGammaCvars();
|
V_ValidateGammaCvars();
|
||||||
|
|
||||||
dirty = false;
|
dirty = false;
|
||||||
|
gamma_rebuilt = true;
|
||||||
|
|
||||||
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
||||||
|
|
||||||
// force refdll to recalculate lightmaps
|
// force refdll to recalculate lightmaps
|
||||||
notify_refdll = true;
|
if( ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// unfortunately, recalculating textures isn't possible yet
|
void V_CheckGammaEnd( void )
|
||||||
|
{
|
||||||
|
// don't reset changed flag if it was set during frame
|
||||||
|
// keep it for next frame
|
||||||
|
if( !gamma_rebuilt )
|
||||||
|
return;
|
||||||
|
|
||||||
|
gamma_rebuilt = false;
|
||||||
|
|
||||||
|
// keep the flags until the end of frame so client.dll will catch these changes
|
||||||
|
if( FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
||||||
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
||||||
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
||||||
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( notify_refdll && ref.initialized )
|
|
||||||
ref.dllFuncs.R_GammaChanged( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_Init( void )
|
void V_Init( void )
|
||||||
|
|||||||
@@ -611,6 +611,7 @@ qboolean R_Init( void )
|
|||||||
|
|
||||||
// cvars that are expected to exist by client.dll
|
// cvars that are expected to exist by client.dll
|
||||||
// refdll should just get pointer to them
|
// refdll should just get pointer to them
|
||||||
|
Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "compatibility cvar, does nothing" );
|
||||||
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||||
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
||||||
|
|
||||||
|
|||||||
@@ -529,7 +529,6 @@ typedef struct cmd_s
|
|||||||
static int cmd_argc;
|
static int cmd_argc;
|
||||||
static const char *cmd_args = NULL;
|
static const char *cmd_args = NULL;
|
||||||
static char *cmd_argv[MAX_CMD_TOKENS];
|
static char *cmd_argv[MAX_CMD_TOKENS];
|
||||||
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
|
||||||
static cmd_t *cmd_functions; // possible commands to execute
|
static cmd_t *cmd_functions; // possible commands to execute
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -17,15 +17,24 @@ GNU General Public License for more details.
|
|||||||
#define COM_STRINGS_H
|
#define COM_STRINGS_H
|
||||||
|
|
||||||
// default colored message headers
|
// default colored message headers
|
||||||
#define S_NOTE "^2Note:^7 "
|
#define S_BLACK "^0"
|
||||||
#define S_WARN "^3Warning:^7 "
|
#define S_RED "^1"
|
||||||
#define S_ERROR "^1Error:^7 "
|
#define S_GREEN "^2"
|
||||||
#define S_USAGE "Usage: "
|
#define S_YELLOW "^3"
|
||||||
#define S_USAGE_INDENT " "
|
#define S_BLUE "^4"
|
||||||
|
#define S_CYAN "^5"
|
||||||
|
#define S_MAGENTA "^6"
|
||||||
|
#define S_DEFAULT "^7"
|
||||||
|
|
||||||
#define S_OPENGL_NOTE "^2OpenGL Note:^7 "
|
#define S_NOTE S_GREEN "Note: " S_DEFAULT
|
||||||
#define S_OPENGL_WARN "^3OpenGL Warning:^7 "
|
#define S_WARN S_YELLOW "Warning: " S_DEFAULT
|
||||||
#define S_OPENGL_ERROR "^3OpenGL Error:^7 "
|
#define S_ERROR S_RED "Error: " S_DEFAULT
|
||||||
|
#define S_USAGE "Usage: "
|
||||||
|
#define S_USAGE_INDENT "\t"
|
||||||
|
|
||||||
|
#define S_OPENGL_NOTE S_GREEN "OpenGL Note: " S_DEFAULT
|
||||||
|
#define S_OPENGL_WARN S_YELLOW "OpenGL Warning: " S_DEFAULT
|
||||||
|
#define S_OPENGL_ERROR S_RED "OpenGL Error: " S_DEFAULT
|
||||||
|
|
||||||
// end game final default message
|
// end game final default message
|
||||||
#define DEFAULT_ENDGAME_MESSAGE "The End"
|
#define DEFAULT_ENDGAME_MESSAGE "The End"
|
||||||
|
|||||||
@@ -693,7 +693,7 @@ COM_LoadFileForMe
|
|||||||
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
byte *file, *pfile;
|
byte *pfile;
|
||||||
fs_offset_t iLength;
|
fs_offset_t iLength;
|
||||||
|
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
@@ -706,21 +706,9 @@ byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
|||||||
Q_strncpy( name, filename, sizeof( name ));
|
Q_strncpy( name, filename, sizeof( name ));
|
||||||
COM_FixSlashes( name );
|
COM_FixSlashes( name );
|
||||||
|
|
||||||
pfile = FS_LoadFile( name, &iLength, false );
|
pfile = g_fsapi.LoadFileMalloc( name, &iLength, false );
|
||||||
if( pLength ) *pLength = (int)iLength;
|
if( pLength ) *pLength = (int)iLength;
|
||||||
|
|
||||||
if( pfile )
|
|
||||||
{
|
|
||||||
file = malloc( iLength + 1 );
|
|
||||||
if( file != NULL )
|
|
||||||
{
|
|
||||||
memcpy( file, pfile, iLength );
|
|
||||||
file[iLength] = '\0';
|
|
||||||
}
|
|
||||||
Mem_Free( pfile );
|
|
||||||
pfile = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pfile;
|
return pfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -795,6 +795,7 @@ uint ScreenGammaTable( uint );
|
|||||||
uint LinearGammaTable( uint );
|
uint LinearGammaTable( uint );
|
||||||
void V_Init( void );
|
void V_Init( void );
|
||||||
void V_CheckGamma( void );
|
void V_CheckGamma( void );
|
||||||
|
void V_CheckGammaEnd( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// identification.c
|
// identification.c
|
||||||
@@ -815,6 +816,34 @@ void NET_MasterClear( void );
|
|||||||
void NET_MasterShutdown( void );
|
void NET_MasterShutdown( void );
|
||||||
qboolean NET_GetMaster( netadr_t from, uint *challenge, double *last_heartbeat );
|
qboolean NET_GetMaster( netadr_t from, uint *challenge, double *last_heartbeat );
|
||||||
|
|
||||||
|
//
|
||||||
|
// sounds.c
|
||||||
|
//
|
||||||
|
typedef enum soundlst_group_e
|
||||||
|
{
|
||||||
|
BouncePlayerShell = 0,
|
||||||
|
BounceWeaponShell,
|
||||||
|
BounceConcrete,
|
||||||
|
BounceGlass,
|
||||||
|
BounceMetal,
|
||||||
|
BounceFlesh,
|
||||||
|
BounceWood,
|
||||||
|
Ricochet,
|
||||||
|
Explode,
|
||||||
|
PlayerWaterEnter,
|
||||||
|
PlayerWaterExit,
|
||||||
|
EntityWaterEnter,
|
||||||
|
EntityWaterExit,
|
||||||
|
|
||||||
|
SoundList_Groups // must be last
|
||||||
|
} soundlst_group_t;
|
||||||
|
|
||||||
|
int SoundList_Count( soundlst_group_t group );
|
||||||
|
const char *SoundList_GetRandom( soundlst_group_t group );
|
||||||
|
const char *SoundList_Get( soundlst_group_t group, int idx );
|
||||||
|
void SoundList_Init( void );
|
||||||
|
void SoundList_Shutdown( void );
|
||||||
|
|
||||||
#ifdef REF_DLL
|
#ifdef REF_DLL
|
||||||
#error "common.h in ref_dll"
|
#error "common.h in ref_dll"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ static void Sys_PrintUsage( void )
|
|||||||
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands to prevent speed hacks")
|
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands to prevent speed hacks")
|
||||||
|
|
||||||
"\nGame options:\n"
|
"\nGame options:\n"
|
||||||
|
O("-game <directory>", "set game directory to start engine with")
|
||||||
O("-dll <path> ", "override server DLL path")
|
O("-dll <path> ", "override server DLL path")
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
O("-clientlib <path>", "override client DLL path")
|
O("-clientlib <path>", "override client DLL path")
|
||||||
@@ -1310,6 +1311,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
|
|
||||||
HTTP_Init();
|
HTTP_Init();
|
||||||
ID_Init();
|
ID_Init();
|
||||||
|
SoundList_Init();
|
||||||
|
|
||||||
if( Host_IsDedicated() )
|
if( Host_IsDedicated() )
|
||||||
{
|
{
|
||||||
@@ -1412,6 +1414,7 @@ void EXPORT Host_Shutdown( void )
|
|||||||
SV_ShutdownFilter();
|
SV_ShutdownFilter();
|
||||||
CL_Shutdown();
|
CL_Shutdown();
|
||||||
|
|
||||||
|
SoundList_Shutdown();
|
||||||
Mod_Shutdown();
|
Mod_Shutdown();
|
||||||
NET_Shutdown();
|
NET_Shutdown();
|
||||||
HTTP_Shutdown();
|
HTTP_Shutdown();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
rgba_t palette[256] = { 0 };
|
rgba_t palette[256] = { 0 };
|
||||||
int i, columns, column, rows, row, bpp = 1;
|
int i, columns, column, rows, row, bpp = 1;
|
||||||
int cbPalBytes = 0, padSize = 0, bps = 0;
|
int cbPalBytes = 0, padSize = 0, bps = 0;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
uint reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean load_qfont = false;
|
qboolean load_qfont = false;
|
||||||
bmp_t bhdr;
|
bmp_t bhdr;
|
||||||
fs_offset_t estimatedSize;
|
fs_offset_t estimatedSize;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
rgba_t palette[256];
|
rgba_t palette[256];
|
||||||
byte red = 0, green = 0, blue = 0, alpha = 0;
|
byte red = 0, green = 0, blue = 0, alpha = 0;
|
||||||
int readpixelcount, pixelcount;
|
int readpixelcount, pixelcount;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
uint reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean compressed;
|
qboolean compressed;
|
||||||
tga_t targa_header;
|
tga_t targa_header;
|
||||||
|
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
byte *fin, *pal;
|
byte *fin, *pal;
|
||||||
int ofs[4], rendermode;
|
int ofs[4], rendermode;
|
||||||
int i, pixels, numcolors;
|
int i, pixels, numcolors;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
uint reflectivity[3] = { 0, 0, 0 };
|
||||||
|
|
||||||
if( filesize < sizeof( mip ))
|
if( filesize < sizeof( mip ))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
362
engine/common/sounds.c
Normal file
362
engine/common/sounds.c
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
/*
|
||||||
|
sounds.c - sounds.lst parser
|
||||||
|
Copyright (C) 2024 Alibek Omarov
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
enum soundlst_type_e
|
||||||
|
{
|
||||||
|
SoundList_None,
|
||||||
|
SoundList_Range,
|
||||||
|
SoundList_List
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *soundlst_groups[SoundList_Groups] =
|
||||||
|
{
|
||||||
|
"BouncePlayerShell",
|
||||||
|
"BounceWeaponShell",
|
||||||
|
"BounceConcrete",
|
||||||
|
"BounceGlass",
|
||||||
|
"BounceMetal",
|
||||||
|
"BounceFlesh",
|
||||||
|
"BounceWood",
|
||||||
|
"Ricochet",
|
||||||
|
"Explode",
|
||||||
|
"PlayerWaterEnter",
|
||||||
|
"PlayerWaterExit",
|
||||||
|
"EntityWaterEnter",
|
||||||
|
"EntityWaterExit",
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct soundlst_s
|
||||||
|
{
|
||||||
|
enum soundlst_type_e type;
|
||||||
|
char *snd;
|
||||||
|
int min; // the string length if type is group
|
||||||
|
int max; // the string count if type is group
|
||||||
|
} soundlst_t;
|
||||||
|
|
||||||
|
soundlst_t soundlst[SoundList_Groups];
|
||||||
|
|
||||||
|
static void SoundList_Print_f( void );
|
||||||
|
static void SoundList_Free( soundlst_t *lst )
|
||||||
|
{
|
||||||
|
if( lst->snd )
|
||||||
|
Mem_Free( lst->snd );
|
||||||
|
|
||||||
|
memset( lst, 0, sizeof( *lst ));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoundList_Shutdown( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < SoundList_Groups; i++ )
|
||||||
|
SoundList_Free( &soundlst[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
int SoundList_Count( enum soundlst_group_e group )
|
||||||
|
{
|
||||||
|
soundlst_t *lst = &soundlst[group];
|
||||||
|
|
||||||
|
switch( lst->type )
|
||||||
|
{
|
||||||
|
case SoundList_Range:
|
||||||
|
return lst->max - lst->min + 1;
|
||||||
|
case SoundList_List:
|
||||||
|
return lst->max;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *SoundList_Get( enum soundlst_group_e group, int i )
|
||||||
|
{
|
||||||
|
static string temp;
|
||||||
|
soundlst_t *lst = &soundlst[group];
|
||||||
|
|
||||||
|
if( i < 0 || i >= SoundList_Count( group ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch( lst->type )
|
||||||
|
{
|
||||||
|
case SoundList_Range:
|
||||||
|
Q_snprintf( temp, sizeof( temp ), lst->snd, lst->min + i );
|
||||||
|
return temp;
|
||||||
|
case SoundList_List:
|
||||||
|
return &lst->snd[i * lst->min];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *SoundList_GetRandom( enum soundlst_group_e group )
|
||||||
|
{
|
||||||
|
int count = SoundList_Count( group );
|
||||||
|
int idx = COM_RandomLong( 0, count - 1 );
|
||||||
|
|
||||||
|
// Con_Printf( "%s: %s %d %d\n", __func__, soundlst_groups[group], count, idx );
|
||||||
|
|
||||||
|
return SoundList_Get( group, idx );
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean SoundList_ParseGroup( soundlst_t *lst, char **file )
|
||||||
|
{
|
||||||
|
string token;
|
||||||
|
int count = 0, slen = 0, i;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
p = *file;
|
||||||
|
|
||||||
|
while(( p = COM_ParseFile( p, token, sizeof( token ))))
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if( !Q_strcmp( token, "}" ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( !Q_strcmp( token, "{" ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: expected '}' but got '{' during group list parse\n", __func__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if( !COM_CheckStringEmpty( token ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: expected '}' but got EOF during group list parse\n", __func__ );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = Q_strlen( token ) + 1;
|
||||||
|
if( slen < len )
|
||||||
|
slen = len;
|
||||||
|
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( count == 0 ) // deactivate group
|
||||||
|
{
|
||||||
|
lst->type = SoundList_None;
|
||||||
|
lst->snd = NULL;
|
||||||
|
lst->min = lst->max = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
lst->type = SoundList_List;
|
||||||
|
lst->min = slen;
|
||||||
|
lst->max = count;
|
||||||
|
lst->snd = Mem_Malloc( host.mempool, count * slen ); // allocate single buffer for the whole group
|
||||||
|
|
||||||
|
for( i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
*file = COM_ParseFile( *file, token, sizeof( token ));
|
||||||
|
|
||||||
|
Q_strncpy( &lst->snd[i * slen], token, slen );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean SoundList_ParseRange( soundlst_t *lst, char **file )
|
||||||
|
{
|
||||||
|
string token, snd;
|
||||||
|
char *p;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
lst->type = SoundList_Range;
|
||||||
|
*file = COM_ParseFile( *file, snd, sizeof( snd ));
|
||||||
|
|
||||||
|
// validate format string, count all % characters
|
||||||
|
p = snd;
|
||||||
|
i = 0;
|
||||||
|
while(( p = Q_strchr( p, '%' )))
|
||||||
|
{
|
||||||
|
// only decimal
|
||||||
|
if( p[1] != 'd' && p[1] != 'i' && p[1] != 'u' )
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: invalid range string %s, only decimal numbers are allowed", __func__, snd );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if more than one %, then it's an invalid format string
|
||||||
|
if( i != 1 )
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: invalid range string %s, only single specifier is allowed\n", __func__, snd );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*file = COM_ParseFile( *file, token, sizeof( token ));
|
||||||
|
if( !Q_isdigit( token ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: %s must be a digit\n", __func__, token );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lst->min = Q_atoi( token );
|
||||||
|
|
||||||
|
*file = COM_ParseFile( *file, token, sizeof( token ));
|
||||||
|
if( !Q_isdigit( token ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: %s must be a digit\n", __func__, token );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lst->max = Q_atoi( token );
|
||||||
|
lst->snd = copystring( snd );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean SoundList_Parse( char *file )
|
||||||
|
{
|
||||||
|
string token;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
while(( file = COM_ParseFile( file, token, sizeof( token ))))
|
||||||
|
{
|
||||||
|
soundlst_t *lst = NULL;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
for( i = 0; i < SoundList_Groups; i++ )
|
||||||
|
{
|
||||||
|
if( !Q_strcmp( token, soundlst_groups[i] ))
|
||||||
|
{
|
||||||
|
lst = &soundlst[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !lst )
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: unexpected token %s, must be group name\n", __func__, token );
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = COM_ParseFile( file, token, sizeof( token ));
|
||||||
|
|
||||||
|
// group is a range
|
||||||
|
if( !Q_strcmp( token, "{" ))
|
||||||
|
{
|
||||||
|
file = p; // advance pointer
|
||||||
|
|
||||||
|
if( !SoundList_ParseGroup( lst, &file ))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
file = COM_ParseFile( file, token, sizeof( token ));
|
||||||
|
if( Q_strcmp( token, "}" ))
|
||||||
|
{
|
||||||
|
Con_Printf( "%s: unexpected token %s, must be }\n", __func__, token );
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// ranges are more simple, but need to rewind pointer for them
|
||||||
|
if( !SoundList_ParseRange( lst, &file ))
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( host_developer.value >= 2 )
|
||||||
|
SoundList_Print_f();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
SoundList_Shutdown();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SoundList_Print_f( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < SoundList_Groups; i++ )
|
||||||
|
{
|
||||||
|
soundlst_t *lst = &soundlst[i];
|
||||||
|
|
||||||
|
switch( lst->type )
|
||||||
|
{
|
||||||
|
case SoundList_Range:
|
||||||
|
Con_Reportf( "%-16s\t" S_CYAN "Range" S_DEFAULT " %s [%d; %d]\n",
|
||||||
|
soundlst_groups[i], lst->snd, lst->min, lst->max );
|
||||||
|
break;
|
||||||
|
case SoundList_List:
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
|
Con_Reportf( "%-16s\t" S_MAGENTA "List" S_DEFAULT " [", soundlst_groups[i] );
|
||||||
|
for( j = 0; j < lst->max; j++ )
|
||||||
|
Con_Reportf( "%s%s", &lst->snd[j * lst->min], j + 1 == lst->max ? "" : ", " );
|
||||||
|
Con_Reportf( "]\n" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
Con_Reportf( "%-16s\t" S_RED "inactive" S_DEFAULT "\n", soundlst_groups[i] );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// I wish we had #embed already
|
||||||
|
static const char default_sounds_lst[] =
|
||||||
|
"BouncePlayerShell \"player/pl_shell%d.wav\" 1 3\n"
|
||||||
|
"BounceWeaponShell \"weapons/sshell%d.wav\" 1 3\n"
|
||||||
|
"BounceConcrete \"debris/concrete%d.wav\" 1 3\n"
|
||||||
|
"BounceGlass \"debris/glass%d.wav\" 1 4\n"
|
||||||
|
"BounceMetal \"debris/metal%d.wav\" 1 6\n"
|
||||||
|
"BounceFlesh \"debris/flesh%d.wav\" 1 7\n"
|
||||||
|
"BounceWood \"debris/wood%d.wav\" 1 4\n"
|
||||||
|
"Ricochet \"weapons/ric%d.wav\" 1 5\n"
|
||||||
|
"Explode \"weapons/explode%d.wav\" 3 5\n"
|
||||||
|
"EntityWaterEnter \"player/pl_wade%d.wav\" 1 4\n"
|
||||||
|
"EntityWaterExit \"player/pl_wade%d.wav\" 1 4\n"
|
||||||
|
"PlayerWaterEnter\n"
|
||||||
|
"{\n"
|
||||||
|
" \"player/pl_wade1.wav\"\n"
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"PlayerWaterExit\n"
|
||||||
|
"{\n"
|
||||||
|
" \"player/pl_wade2.wav\"\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
static void SoundList_Reload_f( void )
|
||||||
|
{
|
||||||
|
qboolean load_internal = false;
|
||||||
|
char *pfile = FS_LoadFile( "scripts/sounds.lst", NULL, false );
|
||||||
|
|
||||||
|
if( pfile )
|
||||||
|
{
|
||||||
|
if( !SoundList_Parse( pfile ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "can't parse sounds.lst file, loading internal...\n" );
|
||||||
|
load_internal = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mem_Free( pfile );
|
||||||
|
}
|
||||||
|
else load_internal = true;
|
||||||
|
|
||||||
|
if( load_internal )
|
||||||
|
SoundList_Parse( (char *)default_sounds_lst );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoundList_Init( void )
|
||||||
|
{
|
||||||
|
Cmd_AddRestrictedCommand( "host_soundlist_print", SoundList_Print_f, "print current sound list" );
|
||||||
|
Cmd_AddRestrictedCommand( "host_soundlist_reload", SoundList_Reload_f, "reload sound list" );
|
||||||
|
|
||||||
|
SoundList_Reload_f ();
|
||||||
|
}
|
||||||
@@ -2,15 +2,30 @@
|
|||||||
mobility_int.h - interface between engine and client for mobile platforms
|
mobility_int.h - interface between engine and client for mobile platforms
|
||||||
Copyright (C) 2015 a1batross
|
Copyright (C) 2015 a1batross
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This is free and unencumbered software released into the public domain.
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
distribute this software, either in source code form or as a compiled
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
GNU General Public License for more details.
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|||||||
@@ -453,6 +453,11 @@ static void SV_ConnectClient( netadr_t from )
|
|||||||
|
|
||||||
// parse some info from the info strings (this can override cl_updaterate)
|
// parse some info from the info strings (this can override cl_updaterate)
|
||||||
Q_strncpy( newcl->userinfo, userinfo, sizeof( newcl->userinfo ));
|
Q_strncpy( newcl->userinfo, userinfo, sizeof( newcl->userinfo ));
|
||||||
|
newcl->fullupdate_next_calltime = 0;
|
||||||
|
newcl->userinfo_next_changetime = 0;
|
||||||
|
newcl->userinfo_penalty = 0;
|
||||||
|
newcl->userinfo_change_attempts = 0;
|
||||||
|
|
||||||
SV_UserinfoChanged( newcl );
|
SV_UserinfoChanged( newcl );
|
||||||
SV_ClearResourceLists( newcl );
|
SV_ClearResourceLists( newcl );
|
||||||
#if 0
|
#if 0
|
||||||
@@ -794,7 +799,7 @@ sv_client_t *SV_ClientById( int id )
|
|||||||
|
|
||||||
ASSERT( id >= 0 );
|
ASSERT( id >= 0 );
|
||||||
|
|
||||||
for( i = 0, cl = svs.clients; i < svgame.globals->maxClients; i++, cl++ )
|
for( i = 0, cl = svs.clients; cl && i < svgame.globals->maxClients; i++, cl++ )
|
||||||
{
|
{
|
||||||
if( !cl->state )
|
if( !cl->state )
|
||||||
continue;
|
continue;
|
||||||
@@ -814,7 +819,7 @@ sv_client_t *SV_ClientByName( const char *name )
|
|||||||
if( !COM_CheckString( name ))
|
if( !COM_CheckString( name ))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for( i = 0, cl = svs.clients; i < svgame.globals->maxClients; i++, cl++ )
|
for( i = 0, cl = svs.clients; cl && i < svgame.globals->maxClients; i++, cl++ )
|
||||||
{
|
{
|
||||||
if( !cl->state )
|
if( !cl->state )
|
||||||
continue;
|
continue;
|
||||||
@@ -3453,7 +3458,7 @@ static void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg )
|
|||||||
|
|
||||||
MSG_ReadBytes( msg, received, size );
|
MSG_ReadBytes( msg, received, size );
|
||||||
|
|
||||||
if( !sv_voiceenable.value )
|
if( !sv_voiceenable.value || svs.maxclients <= 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( i = 0, cur = svs.clients; i < svs.maxclients; i++, cur++ )
|
for( i = 0, cur = svs.clients; i < svs.maxclients; i++, cur++ )
|
||||||
|
|||||||
@@ -1209,7 +1209,7 @@ static edict_t* SV_AllocPrivateData( edict_t *ent, string_t className )
|
|||||||
|
|
||||||
if( !SpawnEdict )
|
if( !SpawnEdict )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "No spawn function for %s\n", STRING( className ));
|
Con_Printf( S_ERROR "No spawn function for \"%s\"\n", pszClassName );
|
||||||
|
|
||||||
// free entity immediately
|
// free entity immediately
|
||||||
SV_FreeEdict( ent );
|
SV_FreeEdict( ent );
|
||||||
|
|||||||
@@ -469,7 +469,8 @@ static void SV_CreateBaseline( void )
|
|||||||
int delta_type;
|
int delta_type;
|
||||||
int entnum;
|
int entnum;
|
||||||
|
|
||||||
SV_WriteVoiceCodec( &sv.signon );
|
if( svs.maxclients > 1 )
|
||||||
|
SV_WriteVoiceCodec( &sv.signon );
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
||||||
playermodel = SV_ModelIndex( DEFAULT_PLAYER_PATH_QUAKE );
|
playermodel = SV_ModelIndex( DEFAULT_PLAYER_PATH_QUAKE );
|
||||||
@@ -672,14 +673,6 @@ void SV_ActivateServer( int runPhysics )
|
|||||||
|
|
||||||
if( sv.ignored_world_decals )
|
if( sv.ignored_world_decals )
|
||||||
Con_Printf( S_WARN "%i static decals was rejected due buffer overflow\n", sv.ignored_world_decals );
|
Con_Printf( S_WARN "%i static decals was rejected due buffer overflow\n", sv.ignored_world_decals );
|
||||||
|
|
||||||
if( svs.maxclients > 1 )
|
|
||||||
{
|
|
||||||
const char *cycle = Cvar_VariableString( "mapchangecfgfile" );
|
|
||||||
|
|
||||||
if( COM_CheckString( cycle ))
|
|
||||||
Cbuf_AddTextf( "exec %s\n", cycle );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -692,6 +685,13 @@ deactivate server, free edicts, strings etc
|
|||||||
void SV_DeactivateServer( void )
|
void SV_DeactivateServer( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
const char *cycle = Cvar_VariableString( "disconcfgfile" );
|
||||||
|
|
||||||
|
if( COM_CheckString( cycle ))
|
||||||
|
Cbuf_AddTextf( "exec %s\n", cycle );
|
||||||
|
|
||||||
|
if( COM_CheckStringEmpty( sv.name ))
|
||||||
|
Cbuf_AddTextf( "exec maps/%s_unload.cfg\n", sv.name );
|
||||||
|
|
||||||
if( !svs.initialized || sv.state == ss_dead )
|
if( !svs.initialized || sv.state == ss_dead )
|
||||||
return;
|
return;
|
||||||
@@ -987,8 +987,9 @@ clients along with it.
|
|||||||
*/
|
*/
|
||||||
qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean background )
|
qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean background )
|
||||||
{
|
{
|
||||||
int i, current_skill;
|
int i, current_skill;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
const char *cycle;
|
||||||
|
|
||||||
SV_SetupClients();
|
SV_SetupClients();
|
||||||
|
|
||||||
@@ -1006,6 +1007,13 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba
|
|||||||
svs.timestart = Sys_DoubleTime();
|
svs.timestart = Sys_DoubleTime();
|
||||||
svs.spawncount++; // any partially connected client will be restarted
|
svs.spawncount++; // any partially connected client will be restarted
|
||||||
|
|
||||||
|
cycle = Cvar_VariableString( "mapchangecfgfile" );
|
||||||
|
|
||||||
|
if( COM_CheckString( cycle ))
|
||||||
|
Cbuf_AddTextf( "exec %s\n", cycle );
|
||||||
|
|
||||||
|
Cbuf_AddTextf( "exec maps/%s_load.cfg\n", mapname );
|
||||||
|
|
||||||
// let's not have any servers with no name
|
// let's not have any servers with no name
|
||||||
if( !COM_CheckString( hostname.string ))
|
if( !COM_CheckString( hostname.string ))
|
||||||
Cvar_Set( "hostname", svgame.dllFuncs.pfnGetGameDescription ? svgame.dllFuncs.pfnGetGameDescription() : FS_Title( ));
|
Cvar_Set( "hostname", svgame.dllFuncs.pfnGetGameDescription ? svgame.dllFuncs.pfnGetGameDescription() : FS_Title( ));
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ CVAR_DEFINE_AUTO( skill, "1", 0, "skill level in singleplayer game" );
|
|||||||
CVAR_DEFINE_AUTO( temp1, "0", 0, "temporary cvar that used by some mods" );
|
CVAR_DEFINE_AUTO( temp1, "0", 0, "temporary cvar that used by some mods" );
|
||||||
CVAR_DEFINE_AUTO( listipcfgfile, "listip.cfg", 0, "name of listip.cfg file" );
|
CVAR_DEFINE_AUTO( listipcfgfile, "listip.cfg", 0, "name of listip.cfg file" );
|
||||||
CVAR_DEFINE_AUTO( mapchangecfgfile, "", 0, "name of map change configuration file" );
|
CVAR_DEFINE_AUTO( mapchangecfgfile, "", 0, "name of map change configuration file" );
|
||||||
|
CVAR_DEFINE_AUTO( disconcfgfile, "", 0, "name of disconnect configuration file" );
|
||||||
|
CVAR_DEFINE_AUTO( _sv_override_scientist_mdl, "", 0, "override default scientist model name (specially for HL25 Uplink maps)" );
|
||||||
|
|
||||||
// physic-related variables
|
// physic-related variables
|
||||||
CVAR_DEFINE_AUTO( sv_gravity, "800", FCVAR_MOVEVARS, "world gravity value" );
|
CVAR_DEFINE_AUTO( sv_gravity, "800", FCVAR_MOVEVARS, "world gravity value" );
|
||||||
@@ -948,6 +950,8 @@ void SV_Init( void )
|
|||||||
Cvar_RegisterVariable( &bannedcfgfile );
|
Cvar_RegisterVariable( &bannedcfgfile );
|
||||||
Cvar_RegisterVariable( &listipcfgfile );
|
Cvar_RegisterVariable( &listipcfgfile );
|
||||||
Cvar_RegisterVariable( &mapchangecfgfile );
|
Cvar_RegisterVariable( &mapchangecfgfile );
|
||||||
|
Cvar_RegisterVariable( &disconcfgfile );
|
||||||
|
Cvar_RegisterVariable( &_sv_override_scientist_mdl );
|
||||||
|
|
||||||
Cvar_RegisterVariable( &sv_voiceenable );
|
Cvar_RegisterVariable( &sv_voiceenable );
|
||||||
Cvar_RegisterVariable( &sv_voicequality );
|
Cvar_RegisterVariable( &sv_voicequality );
|
||||||
|
|||||||
@@ -150,21 +150,9 @@ void SV_WaterMove( edict_t *ent )
|
|||||||
if( flags & FL_INWATER )
|
if( flags & FL_INWATER )
|
||||||
{
|
{
|
||||||
// leave the water.
|
// leave the water.
|
||||||
switch( COM_RandomLong( 0, 3 ))
|
const char *snd = SoundList_GetRandom( EntityWaterExit );
|
||||||
{
|
if( snd )
|
||||||
case 0:
|
SV_StartSound( ent, CHAN_BODY, snd, 1.0f, ATTN_NORM, 0, 100 );
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade1.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade2.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade3.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade4.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ent->v.flags = flags & ~FL_INWATER;
|
ent->v.flags = flags & ~FL_INWATER;
|
||||||
}
|
}
|
||||||
@@ -197,21 +185,9 @@ void SV_WaterMove( edict_t *ent )
|
|||||||
if( watertype == CONTENTS_WATER )
|
if( watertype == CONTENTS_WATER )
|
||||||
{
|
{
|
||||||
// entering the water
|
// entering the water
|
||||||
switch( COM_RandomLong( 0, 3 ))
|
const char *snd = SoundList_GetRandom( EntityWaterEnter );
|
||||||
{
|
if( snd )
|
||||||
case 0:
|
SV_StartSound( ent, CHAN_BODY, snd, 1.0f, ATTN_NORM, 0, 100 );
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade1.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade2.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade3.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
SV_StartSound( ent, CHAN_BODY, "player/pl_wade4.wav", 1.0f, ATTN_NORM, 0, 100 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->v.flags = flags | FL_INWATER;
|
ent->v.flags = flags | FL_INWATER;
|
||||||
|
|||||||
@@ -1384,7 +1384,9 @@ static void SV_CheckWaterTransition( edict_t *ent )
|
|||||||
if( ent->v.watertype == CONTENTS_EMPTY )
|
if( ent->v.watertype == CONTENTS_EMPTY )
|
||||||
{
|
{
|
||||||
// just crossed into water
|
// just crossed into water
|
||||||
SV_StartSound( ent, CHAN_AUTO, "player/pl_wade1.wav", 1.0f, ATTN_NORM, 0, 100 );
|
const char *snd = SoundList_GetRandom( PlayerWaterEnter );
|
||||||
|
if( snd )
|
||||||
|
SV_StartSound( ent, CHAN_AUTO, snd, 1.0f, ATTN_NORM, 0, 100 );
|
||||||
ent->v.velocity[2] *= 0.5f;
|
ent->v.velocity[2] *= 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1418,7 +1420,9 @@ static void SV_CheckWaterTransition( edict_t *ent )
|
|||||||
if( ent->v.watertype != CONTENTS_EMPTY )
|
if( ent->v.watertype != CONTENTS_EMPTY )
|
||||||
{
|
{
|
||||||
// just crossed into water
|
// just crossed into water
|
||||||
SV_StartSound( ent, CHAN_AUTO, "player/pl_wade2.wav", 1.0f, ATTN_NORM, 0, 100 );
|
const char *snd = SoundList_GetRandom( PlayerWaterExit );
|
||||||
|
if( snd )
|
||||||
|
SV_StartSound( ent, CHAN_AUTO, snd, 1.0f, ATTN_NORM, 0, 100 );
|
||||||
}
|
}
|
||||||
ent->v.watertype = CONTENTS_EMPTY;
|
ent->v.watertype = CONTENTS_EMPTY;
|
||||||
ent->v.waterlevel = 0;
|
ent->v.waterlevel = 0;
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ def build(bld):
|
|||||||
bld(name = 'engine_includes', export_includes = '. common common/imagelib', use = 'filesystem_includes')
|
bld(name = 'engine_includes', export_includes = '. common common/imagelib', use = 'filesystem_includes')
|
||||||
|
|
||||||
is_cxx_link = False
|
is_cxx_link = False
|
||||||
libs = [ 'engine_includes', 'public', 'dllemu' ]
|
libs = [ 'engine_includes', 'public', 'dllemu', 'werror' ]
|
||||||
|
|
||||||
# basic build: dedicated only
|
# basic build: dedicated only
|
||||||
source = bld.path.ant_glob([
|
source = bld.path.ant_glob([
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ static file_t *FS_OpenFile_AndroidAssets( searchpath_t *search, const char *file
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte *FS_LoadAndroidAssetsFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *filesize )
|
static byte *FS_LoadAndroidAssetsFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *filesize, void *( *pfnAlloc )( size_t ), void ( *pfnFree )( void * ))
|
||||||
{
|
{
|
||||||
byte *buf;
|
byte *buf;
|
||||||
off_t size;
|
off_t size;
|
||||||
@@ -247,18 +247,24 @@ static byte *FS_LoadAndroidAssetsFile( searchpath_t *search, const char *path, i
|
|||||||
|
|
||||||
size = AAsset_getLength( asset );
|
size = AAsset_getLength( asset );
|
||||||
|
|
||||||
buf = (byte *)Mem_Malloc( fs_mempool, size + 1 );
|
buf = (byte *)pfnAlloc( size + 1 );
|
||||||
|
if( unlikely( !buf ))
|
||||||
|
{
|
||||||
|
Con_Reportf( "%s: can't alloc %d bytes, no free memory\n", __func__, size + 1 );
|
||||||
|
AAsset_close( asset );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
|
|
||||||
if( AAsset_read( asset, buf, size ) < 0 )
|
if( AAsset_read( asset, buf, size ) < 0 )
|
||||||
{
|
{
|
||||||
Mem_Free( buf );
|
pfnFree( buf );
|
||||||
AAsset_close( asset );
|
AAsset_close( asset );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AAsset_close( asset );
|
AAsset_close( asset );
|
||||||
|
|
||||||
if( filesize ) *filesize = size;
|
if( filesize ) *filesize = size;
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|||||||
@@ -2419,6 +2419,16 @@ static void FS_Purge( file_t *file )
|
|||||||
file->ungetc = EOF;
|
file->ungetc = EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *FS_CustomAlloc( size_t size )
|
||||||
|
{
|
||||||
|
return Mem_Malloc( fs_mempool, size );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FS_CustomFree( void *data )
|
||||||
|
{
|
||||||
|
return Mem_Free( data );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
FS_LoadFile
|
FS_LoadFile
|
||||||
@@ -2427,12 +2437,16 @@ Filename are relative to the xash directory.
|
|||||||
Always appends a 0 byte.
|
Always appends a 0 byte.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly )
|
static byte *FS_LoadFile_( const char *path, fs_offset_t *filesizeptr, const qboolean gamedironly, const qboolean custom_alloc )
|
||||||
{
|
{
|
||||||
searchpath_t *search;
|
searchpath_t *search;
|
||||||
|
fs_offset_t filesize;
|
||||||
file_t *file;
|
file_t *file;
|
||||||
|
byte *buf;
|
||||||
char netpath[MAX_SYSPATH];
|
char netpath[MAX_SYSPATH];
|
||||||
int pack_ind;
|
int pack_ind;
|
||||||
|
void *( *pfnAlloc )( size_t ) = custom_alloc ? FS_CustomAlloc : malloc;
|
||||||
|
void ( *pfnFree )( void * ) = custom_alloc ? FS_CustomFree : free;
|
||||||
|
|
||||||
// some mappers used leading '/' or '\' in path to models or sounds
|
// some mappers used leading '/' or '\' in path to models or sounds
|
||||||
if( path[0] == '/' || path[0] == '\\' )
|
if( path[0] == '/' || path[0] == '\\' )
|
||||||
@@ -2451,27 +2465,39 @@ byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamediro
|
|||||||
|
|
||||||
// custom load file function for compressed files
|
// custom load file function for compressed files
|
||||||
if( search->pfnLoadFile )
|
if( search->pfnLoadFile )
|
||||||
return search->pfnLoadFile( search, netpath, pack_ind, filesizeptr );
|
return search->pfnLoadFile( search, netpath, pack_ind, filesizeptr, pfnAlloc, pfnFree );
|
||||||
|
|
||||||
file = search->pfnOpenFile( search, netpath, "rb", pack_ind );
|
file = search->pfnOpenFile( search, netpath, "rb", pack_ind );
|
||||||
|
|
||||||
if( file )
|
if( !file ) // TODO: indicate errors
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
filesize = file->real_length;
|
||||||
|
buf = (byte *)pfnAlloc( filesize + 1 );
|
||||||
|
|
||||||
|
if( unlikely( !buf )) // TODO: indicate errors
|
||||||
{
|
{
|
||||||
fs_offset_t filesize = file->real_length;
|
Con_Reportf( "%s: can't alloc %d bytes, no free memory\n", __func__, filesize + 1 );
|
||||||
byte *buf;
|
|
||||||
|
|
||||||
buf = (byte *)Mem_Malloc( fs_mempool, filesize + 1 );
|
|
||||||
buf[filesize] = '\0';
|
|
||||||
FS_Read( file, buf, filesize );
|
|
||||||
FS_Close( file );
|
FS_Close( file );
|
||||||
|
return NULL;
|
||||||
if( filesizeptr )
|
|
||||||
*filesizeptr = filesize;
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
buf[filesize] = '\0';
|
||||||
|
FS_Read( file, buf, filesize );
|
||||||
|
FS_Close( file );
|
||||||
|
if( filesizeptr ) *filesizeptr = filesize;
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte *FS_LoadFileMalloc( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly )
|
||||||
|
{
|
||||||
|
return FS_LoadFile_( path, filesizeptr, gamedironly, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly )
|
||||||
|
{
|
||||||
|
return FS_LoadFile_( path, filesizeptr, gamedironly, g_engfuncs._Mem_Alloc != _Mem_Alloc );
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean CRC32_File( dword *crcvalue, const char *filename )
|
qboolean CRC32_File( dword *crcvalue, const char *filename )
|
||||||
@@ -3020,6 +3046,7 @@ fs_api_t g_api =
|
|||||||
(void *)FS_MountArchive_Fullpath,
|
(void *)FS_MountArchive_Fullpath,
|
||||||
|
|
||||||
FS_GetFullDiskPath,
|
FS_GetFullDiskPath,
|
||||||
|
FS_LoadFileMalloc,
|
||||||
};
|
};
|
||||||
|
|
||||||
int EXPORT GetFSAPI( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *engfuncs );
|
int EXPORT GetFSAPI( int version, fs_api_t *api, fs_globals_t **globals, fs_interface_t *engfuncs );
|
||||||
|
|||||||
@@ -196,6 +196,9 @@ typedef struct fs_api_t
|
|||||||
void *(*MountArchive_Fullpath)( const char *path, int flags );
|
void *(*MountArchive_Fullpath)( const char *path, int flags );
|
||||||
|
|
||||||
qboolean (*GetFullDiskPath)( char *buffer, size_t size, const char *name, qboolean gamedironly );
|
qboolean (*GetFullDiskPath)( char *buffer, size_t size, const char *name, qboolean gamedironly );
|
||||||
|
|
||||||
|
// like LoadFile but returns pointer that can be free'd using standard library function
|
||||||
|
byte *(*LoadFileMalloc)( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||||
} fs_api_t;
|
} fs_api_t;
|
||||||
|
|
||||||
typedef struct fs_interface_t
|
typedef struct fs_interface_t
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ typedef struct searchpath_s
|
|||||||
int (*pfnFileTime)( struct searchpath_s *search, const char *filename );
|
int (*pfnFileTime)( struct searchpath_s *search, const char *filename );
|
||||||
int (*pfnFindFile)( struct searchpath_s *search, const char *path, char *fixedname, size_t len );
|
int (*pfnFindFile)( struct searchpath_s *search, const char *path, char *fixedname, size_t len );
|
||||||
void (*pfnSearch)( struct searchpath_s *search, stringlist_t *list, const char *pattern, int caseinsensitive );
|
void (*pfnSearch)( struct searchpath_s *search, stringlist_t *list, const char *pattern, int caseinsensitive );
|
||||||
byte *(*pfnLoadFile)( struct searchpath_s *search, const char *path, int pack_ind, fs_offset_t *filesize );
|
byte *(*pfnLoadFile)( struct searchpath_s *search, const char *path, int pack_ind, fs_offset_t *filesize, void *( *pfnAlloc )( size_t ), void ( *pfnFree )( void * ));
|
||||||
} searchpath_t;
|
} searchpath_t;
|
||||||
|
|
||||||
typedef searchpath_t *(*FS_ADDARCHIVE_FULLPATH)( const char *path, int flags );
|
typedef searchpath_t *(*FS_ADDARCHIVE_FULLPATH)( const char *path, int flags );
|
||||||
@@ -181,6 +181,7 @@ qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );
|
|||||||
|
|
||||||
// file buffer ops
|
// file buffer ops
|
||||||
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||||
|
byte *FS_LoadFileMalloc( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||||
byte *FS_LoadDirectFile( const char *path, fs_offset_t *filesizeptr );
|
byte *FS_LoadDirectFile( const char *path, fs_offset_t *filesizeptr );
|
||||||
qboolean FS_WriteFile( const char *filename, const void *data, fs_offset_t len );
|
qboolean FS_WriteFile( const char *filename, const void *data, fs_offset_t len );
|
||||||
|
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ W_ReadLump
|
|||||||
reading lump into temp buffer
|
reading lump into temp buffer
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *lumpsizeptr )
|
static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *lumpsizeptr, void *( *pfnAlloc )( size_t ), void ( *pfnFree )( void * ))
|
||||||
{
|
{
|
||||||
const wfile_t *wad = search->wad;
|
const wfile_t *wad = search->wad;
|
||||||
const dlumpinfo_t *lump = &wad->lumps[pack_ind];
|
const dlumpinfo_t *lump = &wad->lumps[pack_ind];
|
||||||
@@ -613,19 +613,25 @@ static byte *W_ReadLump( searchpath_t *search, const char *path, int pack_ind, f
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = (byte *)Mem_Malloc( wad->mempool, lump->disksize );
|
buf = (byte *)pfnAlloc( lump->disksize );
|
||||||
|
if( unlikely( !buf ))
|
||||||
|
{
|
||||||
|
Con_Reportf( S_ERROR "%s: can't alloc %d bytes, no free memory\n", __func__, lump->disksize );
|
||||||
|
FS_Seek( wad->handle, oldpos, SEEK_SET );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size = FS_Read( wad->handle, buf, lump->disksize );
|
size = FS_Read( wad->handle, buf, lump->disksize );
|
||||||
|
FS_Seek( wad->handle, oldpos, SEEK_SET );
|
||||||
|
|
||||||
if( size < lump->disksize )
|
if( size < lump->disksize )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_WARN "W_ReadLump: %s is probably corrupted\n", lump->name );
|
Con_Reportf( S_WARN "W_ReadLump: %s is probably corrupted\n", lump->name );
|
||||||
FS_Seek( wad->handle, oldpos, SEEK_SET );
|
pfnFree( buf );
|
||||||
Mem_Free( buf );
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lumpsizeptr ) *lumpsizeptr = lump->disksize;
|
if( lumpsizeptr ) *lumpsizeptr = lump->disksize;
|
||||||
FS_Seek( wad->handle, oldpos, SEEK_SET );
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def configure(conf):
|
|||||||
def build(bld):
|
def build(bld):
|
||||||
bld(name = 'filesystem_includes', export_includes = '.')
|
bld(name = 'filesystem_includes', export_includes = '.')
|
||||||
|
|
||||||
libs = [ 'filesystem_includes', 'sdk_includes' ]
|
libs = [ 'filesystem_includes', 'sdk_includes', 'werror' ]
|
||||||
|
|
||||||
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
||||||
if bld.env.DEST_OS != 'psvita':
|
if bld.env.DEST_OS != 'psvita':
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ FS_LoadZIPFile
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *sizeptr )
|
static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_ind, fs_offset_t *sizeptr, void *( *pfnAlloc )( size_t ), void ( *pfnFree )( void * ))
|
||||||
{
|
{
|
||||||
zipfile_t *file;
|
zipfile_t *file;
|
||||||
byte *compressed_buffer = NULL, *decompressed_buffer = NULL;
|
byte *compressed_buffer = NULL, *decompressed_buffer = NULL;
|
||||||
@@ -451,11 +451,16 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
return NULL;
|
return NULL;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
decompressed_buffer = pfnAlloc( file->size + 1 );
|
||||||
|
if( unlikely( !decompressed_buffer ))
|
||||||
|
{
|
||||||
|
Con_Reportf( S_ERROR "%s: can't alloc %d bytes, no free memory\n", __func__, file->size + 1 );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
decompressed_buffer[file->size] = '\0';
|
||||||
|
|
||||||
if( file->flags == ZIP_COMPRESSION_NO_COMPRESSION )
|
if( file->flags == ZIP_COMPRESSION_NO_COMPRESSION )
|
||||||
{
|
{
|
||||||
decompressed_buffer = Mem_Malloc( fs_mempool, file->size + 1 );
|
|
||||||
decompressed_buffer[file->size] = '\0';
|
|
||||||
|
|
||||||
c = read( search->zip->handle, decompressed_buffer, file->size );
|
c = read( search->zip->handle, decompressed_buffer, file->size );
|
||||||
if( c != file->size )
|
if( c != file->size )
|
||||||
{
|
{
|
||||||
@@ -472,7 +477,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
if( final_crc != file->crc32 )
|
if( final_crc != file->crc32 )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Zip_LoadFile: %s file crc32 mismatch\n", file->name );
|
Con_Reportf( S_ERROR "Zip_LoadFile: %s file crc32 mismatch\n", file->name );
|
||||||
Mem_Free( decompressed_buffer );
|
pfnFree( decompressed_buffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_CRC_CHECK
|
#endif // ENABLE_CRC_CHECK
|
||||||
@@ -485,8 +490,6 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
else if( file->flags == ZIP_COMPRESSION_DEFLATED )
|
else if( file->flags == ZIP_COMPRESSION_DEFLATED )
|
||||||
{
|
{
|
||||||
compressed_buffer = Mem_Malloc( fs_mempool, file->compressed_size + 1 );
|
compressed_buffer = Mem_Malloc( fs_mempool, file->compressed_size + 1 );
|
||||||
decompressed_buffer = Mem_Malloc( fs_mempool, file->size + 1 );
|
|
||||||
decompressed_buffer[file->size] = '\0';
|
|
||||||
|
|
||||||
c = read( search->zip->handle, compressed_buffer, file->compressed_size );
|
c = read( search->zip->handle, compressed_buffer, file->compressed_size );
|
||||||
if( c != file->compressed_size )
|
if( c != file->compressed_size )
|
||||||
@@ -529,7 +532,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
if( final_crc != file->crc32 )
|
if( final_crc != file->crc32 )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Zip_LoadFile: %s file crc32 mismatch\n", file->name );
|
Con_Reportf( S_ERROR "Zip_LoadFile: %s file crc32 mismatch\n", file->name );
|
||||||
Mem_Free( decompressed_buffer );
|
pfnFree( decompressed_buffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -542,7 +545,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Zip_LoadFile: %s : error while file decompressing. Zlib return code %d.\n", file->name, zlib_result );
|
Con_Reportf( S_ERROR "Zip_LoadFile: %s : error while file decompressing. Zlib return code %d.\n", file->name, zlib_result );
|
||||||
Mem_Free( compressed_buffer );
|
Mem_Free( compressed_buffer );
|
||||||
Mem_Free( decompressed_buffer );
|
pfnFree( decompressed_buffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,6 +553,7 @@ static byte *FS_LoadZIPFile( searchpath_t *search, const char *path, int pack_in
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "Zip_LoadFile: %s : file compressed with unknown algorithm.\n", file->name );
|
Con_Reportf( S_ERROR "Zip_LoadFile: %s : file compressed with unknown algorithm.\n", file->name );
|
||||||
|
pfnFree( decompressed_buffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ def build(bld):
|
|||||||
bld(source = source,
|
bld(source = source,
|
||||||
target = 'xash3d', # hl.exe
|
target = 'xash3d', # hl.exe
|
||||||
features = 'c cxx cxxprogram',
|
features = 'c cxx cxxprogram',
|
||||||
use = 'sdk_includes DL USER32 SHELL32',
|
use = 'sdk_includes DL USER32 SHELL32 werror',
|
||||||
rpath = bld.env.DEFAULT_RPATH,
|
rpath = bld.env.DEFAULT_RPATH,
|
||||||
install_path = bld.env.BINDIR,
|
install_path = bld.env.BINDIR,
|
||||||
subsystem = bld.env.MSVC_SUBSYSTEM
|
subsystem = bld.env.MSVC_SUBSYSTEM
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ const char *Q_PlatformStringByID( const int platform )
|
|||||||
return "win32";
|
return "win32";
|
||||||
case PLATFORM_ANDROID:
|
case PLATFORM_ANDROID:
|
||||||
return "android";
|
return "android";
|
||||||
case PLATFORM_LINUX_UNKNOWN:
|
|
||||||
return "linuxunkabi";
|
|
||||||
case PLATFORM_LINUX:
|
case PLATFORM_LINUX:
|
||||||
return "linux";
|
return "linux";
|
||||||
case PLATFORM_APPLE:
|
case PLATFORM_APPLE:
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ Then you can use another oneliner to query all variables:
|
|||||||
#undef XASH_IRIX
|
#undef XASH_IRIX
|
||||||
#undef XASH_JS
|
#undef XASH_JS
|
||||||
#undef XASH_LINUX
|
#undef XASH_LINUX
|
||||||
#undef XASH_LINUX_UNKNOWN
|
|
||||||
#undef XASH_LITTLE_ENDIAN
|
#undef XASH_LITTLE_ENDIAN
|
||||||
#undef XASH_MIPS
|
#undef XASH_MIPS
|
||||||
#undef XASH_MOBILE_PLATFORM
|
#undef XASH_MOBILE_PLATFORM
|
||||||
@@ -103,13 +102,6 @@ Then you can use another oneliner to query all variables:
|
|||||||
#if defined __linux__
|
#if defined __linux__
|
||||||
#if defined __ANDROID__
|
#if defined __ANDROID__
|
||||||
#define XASH_ANDROID 1
|
#define XASH_ANDROID 1
|
||||||
#else
|
|
||||||
#include <features.h>
|
|
||||||
// if our system libc has features.h header
|
|
||||||
// try to detect it to not confuse other libcs with built with glibc game libraries
|
|
||||||
#if !defined __GLIBC__
|
|
||||||
#define XASH_LINUX_UNKNOWN 1
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#define XASH_LINUX 1
|
#define XASH_LINUX 1
|
||||||
#elif defined __FreeBSD__
|
#elif defined __FreeBSD__
|
||||||
|
|||||||
@@ -41,14 +41,11 @@ GNU General Public License for more details.
|
|||||||
#define PLATFORM_IRIX 12
|
#define PLATFORM_IRIX 12
|
||||||
#define PLATFORM_NSWITCH 13
|
#define PLATFORM_NSWITCH 13
|
||||||
#define PLATFORM_PSVITA 14
|
#define PLATFORM_PSVITA 14
|
||||||
#define PLATFORM_LINUX_UNKNOWN 15
|
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
#define XASH_PLATFORM PLATFORM_WIN32
|
#define XASH_PLATFORM PLATFORM_WIN32
|
||||||
#elif XASH_ANDROID
|
#elif XASH_ANDROID
|
||||||
#define XASH_PLATFORM PLATFORM_ANDROID
|
#define XASH_PLATFORM PLATFORM_ANDROID
|
||||||
#elif XASH_LINUX_UNKNOWN
|
|
||||||
#define XASH_PLATFORM PLATFORM_LINUX_UNKNOWN
|
|
||||||
#elif XASH_LINUX
|
#elif XASH_LINUX
|
||||||
#define XASH_PLATFORM PLATFORM_LINUX
|
#define XASH_PLATFORM PLATFORM_LINUX
|
||||||
#elif XASH_APPLE
|
#elif XASH_APPLE
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ static struct
|
|||||||
{
|
{
|
||||||
{ PLATFORM_WIN32, "win32" },
|
{ PLATFORM_WIN32, "win32" },
|
||||||
{ PLATFORM_ANDROID, "android" },
|
{ PLATFORM_ANDROID, "android" },
|
||||||
{ PLATFORM_LINUX_UNKNOWN, "linuxunkabi" },
|
|
||||||
{ PLATFORM_LINUX, "linux" },
|
{ PLATFORM_LINUX, "linux" },
|
||||||
{ PLATFORM_APPLE, "apple" },
|
{ PLATFORM_APPLE, "apple" },
|
||||||
{ PLATFORM_FREEBSD, "freebsd" },
|
{ PLATFORM_FREEBSD, "freebsd" },
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ def build(bld):
|
|||||||
bld.stlib(source = bld.path.ant_glob('*.c'),
|
bld.stlib(source = bld.path.ant_glob('*.c'),
|
||||||
target = 'public',
|
target = 'public',
|
||||||
features = 'c',
|
features = 'c',
|
||||||
use = 'sdk_includes',
|
use = 'sdk_includes werror',
|
||||||
subsystem = bld.env.MSVC_SUBSYSTEM)
|
subsystem = bld.env.MSVC_SUBSYSTEM)
|
||||||
|
|
||||||
if bld.env.TESTS:
|
if bld.env.TESTS:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ def configure(conf):
|
|||||||
def build(bld):
|
def build(bld):
|
||||||
source = bld.path.ant_glob( [ '*.c' ] )
|
source = bld.path.ant_glob( [ '*.c' ] )
|
||||||
includes = [ '.' ]
|
includes = [ '.' ]
|
||||||
libs = [ 'engine_includes', 'sdk_includes' ]
|
libs = [ 'engine_includes', 'sdk_includes', 'werror' ]
|
||||||
bld.env.LDFLAGS += ['-fPIC']
|
bld.env.LDFLAGS += ['-fPIC']
|
||||||
bld.env.CFLAGS += ['-fPIC']
|
bld.env.CFLAGS += ['-fPIC']
|
||||||
bld.stlib(
|
bld.stlib(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ def configure(conf):
|
|||||||
def build(bld):
|
def build(bld):
|
||||||
source = bld.path.ant_glob( [ '*.c' ] )
|
source = bld.path.ant_glob( [ '*.c' ] )
|
||||||
includes = [ '.' ]
|
includes = [ '.' ]
|
||||||
libs = [ 'engine_includes', 'sdk_includes' ]
|
libs = [ 'engine_includes', 'sdk_includes', 'werror' ]
|
||||||
bld.env.LDFLAGS += ['-fPIC']
|
bld.env.LDFLAGS += ['-fPIC']
|
||||||
bld.env.CFLAGS += ['-fPIC']
|
bld.env.CFLAGS += ['-fPIC']
|
||||||
bld.stlib(
|
bld.stlib(
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def configure(conf):
|
|||||||
conf.check_cc(lib='log')
|
conf.check_cc(lib='log')
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
libs = [ 'engine_includes' ]
|
libs = [ 'engine_includes', 'werror' ]
|
||||||
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
||||||
if bld.env.DEST_OS == 'psvita':
|
if bld.env.DEST_OS == 'psvita':
|
||||||
libs += [ 'sdk_includes', 'vgl_shim' ]
|
libs += [ 'sdk_includes', 'vgl_shim' ]
|
||||||
@@ -65,7 +65,7 @@ def build(bld):
|
|||||||
},
|
},
|
||||||
'ref_gles3compat': {
|
'ref_gles3compat': {
|
||||||
'enable': bld.env.GLES3COMPAT,
|
'enable': bld.env.GLES3COMPAT,
|
||||||
'libs': ['DL', 'gl4es', 'LOG'],
|
'libs': [],
|
||||||
'defines': ['XASH_GLES3COMPAT'],
|
'defines': ['XASH_GLES3COMPAT'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
623
ref/null/r_context.c
Normal file
623
ref/null/r_context.c
Normal file
@@ -0,0 +1,623 @@
|
|||||||
|
/*
|
||||||
|
r_context.c -- null renderer context
|
||||||
|
Copyright (C) 2023-2024 a1batross
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "xash3d_types.h"
|
||||||
|
#include "const.h"
|
||||||
|
#include "cvardef.h"
|
||||||
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "ref_api.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this initially was made to be able to run full client
|
||||||
|
* in hazardous^Wheadless environments
|
||||||
|
* but might be a starting point for new renderers as well
|
||||||
|
*/
|
||||||
|
|
||||||
|
static ref_api_t gEngfuncs;
|
||||||
|
static ref_globals_t *gpGlobals;
|
||||||
|
|
||||||
|
static void R_SimpleStub( void )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SimpleStubInt( int )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SimpleStubUInt( unsigned int )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SimpleStubBool( qboolean )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean R_Init( void )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *R_GetConfigName( void )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int x, int y, float scale_x, float scale_y )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_SetupAttributes( int safegl )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean R_AddEntity( struct cl_entity_s *clent, int type )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_AddCustomBeam( cl_entity_t *pEnvBeam )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_ProcessEntData( qboolean allocate, cl_entity_t *entities, unsigned int max_entities )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const byte *R_GetTextureOriginalBuffer( unsigned int idx )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags, qboolean update )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SetupSky( const char *skyname )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_DrawTileClear( int texnum, int x, int y, int w, int h )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FillRGBA( float x, float y, float w, float h, int r, int g, int b, int a )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WorldToScreen( const vec3_t world, vec3_t screen )
|
||||||
|
{
|
||||||
|
VectorClear( screen );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean VID_ScreenShot( const char *filename, int shot_type )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static colorVec R_LightPoint( const float *p )
|
||||||
|
{
|
||||||
|
colorVec c = { 0 };
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos, int flags, float scale )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int R_CreateDecalList( struct decallist_s *pList )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc, double time )
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_StudioLerpMovement( cl_entity_t *e, double time, vec3_t origin, vec3_t angles )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_InitSkyClouds( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_SubdivideSurface( model_t *mod, msurface_t *fa )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite )
|
||||||
|
{
|
||||||
|
*frameWidth = *frameHeight = *numFrames = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int R_GetSpriteTexture( const model_t *m_pSpriteModel, int frame )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Mod_LoadMapSprite( struct model_s *mod, const void *buffer, size_t size, qboolean *loaded )
|
||||||
|
{
|
||||||
|
*loaded = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean Mod_ProcessRenderData( model_t *mod, qboolean create, const byte *buffer )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Mod_StudioLoadTextures( model_t *mod, void *data )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_DrawParticles( double frametime, particle_t *particles, float partsize )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_DrawTracers( double frametime, particle_t *tracers )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_DrawBeams( int fTrans, BEAM *beams )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int RefGetParm( int parm, int arg )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GetDetailScaleForTexture( int texture, float *xScale, float *yScale )
|
||||||
|
{
|
||||||
|
*xScale = *yScale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GetExtraParmsForTexture( int texture, byte *red, byte *green, byte *blue, byte *alpha )
|
||||||
|
{
|
||||||
|
*red = *green = *blue = *alpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float GetFrameTime( void )
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SetCurrentEntity( struct cl_entity_s *ent )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_SetCurrentModel( struct model_s *mod )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GL_FindTexture( const char *name )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *GL_TextureName( unsigned int texnum )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const byte *GL_TextureData( unsigned int texnum )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GL_LoadTextureArray( const char **names, int flags )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GL_CreateTextureArray( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawSingleDecal( struct decal_s *pDecal, struct msurface_s *fa )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float *R_DecalSetupVerts( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void R_EntityRemoveDecals( struct model_s *mod )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AVI_UploadRawFrame( int texture, int cols, int rows, int width, int height, const byte *data )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_Bind( int tmu, unsigned int texnum )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_LoadTextureMatrix( const float *glmatrix )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_TexGen( unsigned int coord, unsigned int mode )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_UpdateTexSize( int texnum, int width, int height, int depth )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_DrawParticles( const struct ref_viewpass_s *rvp, qboolean trans_pass, float frametime )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static colorVec LightVec( const float *start, const float *end, float *lightspot, float *lightvec )
|
||||||
|
{
|
||||||
|
colorVec c = { 0 };
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct mstudiotex_s *StudioGetTexture( struct cl_entity_s *e )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_RenderFrame( const struct ref_viewpass_s *rvp )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GL_OrthoBounds( const float *mins, const float *maxs )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean R_SpeedsMessage( char *out, size_t size )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static byte *Mod_GetCurrentVis( void )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *R_GetProcAddress( const char *name )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Color4f( float r, float g, float b, float a )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Color4ub( unsigned char r, unsigned char g, unsigned char b, unsigned char a )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TexCoord2f( float u, float v )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Vertex3fv( const float *worldPnt )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Vertex3f( float x, float y, float z )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Fog( float flFogColor[3], float flStart, float flEnd, int bOn )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ScreenToWorld( const float *screen, float *world )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GetMatrix( const int pname, float *matrix )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FogParams( float flDensity, int iFogSkybox )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CullFace( TRICULLSTYLE mode )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_SetupDrawing( int *pColor )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_EnableTexture( qboolean enable )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_CreateTexture( int id, int width, int height )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_UploadTexture( int id, const char *buffer, int width, int height )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_UploadTextureBlock( int id, int drawX, int drawY, const byte *rgba, int blockWidth, int blockHeight )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr )
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void VGUI_GetTextureSizes( int *width, int *height )
|
||||||
|
{
|
||||||
|
*width = *height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int VGUI_GenerateTexture( void )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ref_interface_t gReffuncs =
|
||||||
|
{
|
||||||
|
.R_Init = R_Init,
|
||||||
|
.R_Shutdown = R_SimpleStub,
|
||||||
|
.R_GetConfigName = R_GetConfigName,
|
||||||
|
.R_SetDisplayTransform = R_SetDisplayTransform,
|
||||||
|
|
||||||
|
.GL_SetupAttributes = GL_SetupAttributes,
|
||||||
|
.GL_InitExtensions = R_SimpleStub,
|
||||||
|
.GL_ClearExtensions = R_SimpleStub,
|
||||||
|
|
||||||
|
.R_GammaChanged = R_SimpleStubBool,
|
||||||
|
.R_BeginFrame = R_SimpleStubBool,
|
||||||
|
.R_RenderScene = R_SimpleStub,
|
||||||
|
.R_EndFrame = R_SimpleStub,
|
||||||
|
.R_PushScene = R_SimpleStub,
|
||||||
|
.R_PopScene = R_SimpleStub,
|
||||||
|
.GL_BackendStartFrame = R_SimpleStub,
|
||||||
|
.GL_BackendEndFrame = R_SimpleStub,
|
||||||
|
|
||||||
|
.R_ClearScreen = R_SimpleStub,
|
||||||
|
.R_AllowFog = R_SimpleStubBool,
|
||||||
|
.GL_SetRenderMode = R_SimpleStubInt,
|
||||||
|
|
||||||
|
.R_AddEntity = R_AddEntity,
|
||||||
|
.CL_AddCustomBeam = CL_AddCustomBeam,
|
||||||
|
.R_ProcessEntData = R_ProcessEntData,
|
||||||
|
.R_Flush = R_SimpleStubUInt,
|
||||||
|
|
||||||
|
.R_ShowTextures = R_SimpleStub,
|
||||||
|
|
||||||
|
.R_GetTextureOriginalBuffer = R_GetTextureOriginalBuffer,
|
||||||
|
.GL_LoadTextureFromBuffer = GL_LoadTextureFromBuffer,
|
||||||
|
.GL_ProcessTexture = GL_ProcessTexture,
|
||||||
|
.R_SetupSky = R_SetupSky,
|
||||||
|
|
||||||
|
.R_Set2DMode = R_SimpleStubBool,
|
||||||
|
.R_DrawStretchRaw = R_DrawStretchRaw,
|
||||||
|
.R_DrawStretchPic = R_DrawStretchPic,
|
||||||
|
.R_DrawTileClear = R_DrawTileClear,
|
||||||
|
.FillRGBA = FillRGBA,
|
||||||
|
.FillRGBABlend = FillRGBA,
|
||||||
|
.WorldToScreen = WorldToScreen,
|
||||||
|
|
||||||
|
.VID_ScreenShot = VID_ScreenShot,
|
||||||
|
.VID_CubemapShot = VID_CubemapShot,
|
||||||
|
|
||||||
|
.R_LightPoint = R_LightPoint,
|
||||||
|
|
||||||
|
.R_DecalShoot = R_DecalShoot,
|
||||||
|
.R_DecalRemoveAll = R_SimpleStubInt,
|
||||||
|
.R_CreateDecalList = R_CreateDecalList,
|
||||||
|
.R_ClearAllDecals = R_SimpleStub,
|
||||||
|
|
||||||
|
.R_StudioEstimateFrame = R_StudioEstimateFrame,
|
||||||
|
.R_StudioLerpMovement = R_StudioLerpMovement,
|
||||||
|
.CL_InitStudioAPI = R_SimpleStub,
|
||||||
|
|
||||||
|
.R_InitSkyClouds = R_InitSkyClouds,
|
||||||
|
.GL_SubdivideSurface = GL_SubdivideSurface,
|
||||||
|
.CL_RunLightStyles = R_SimpleStub,
|
||||||
|
|
||||||
|
.R_GetSpriteParms = R_GetSpriteParms,
|
||||||
|
.R_GetSpriteTexture = R_GetSpriteTexture,
|
||||||
|
|
||||||
|
.Mod_LoadMapSprite = Mod_LoadMapSprite,
|
||||||
|
.Mod_ProcessRenderData = Mod_ProcessRenderData,
|
||||||
|
.Mod_StudioLoadTextures = Mod_StudioLoadTextures,
|
||||||
|
|
||||||
|
.CL_DrawParticles = CL_DrawParticles,
|
||||||
|
.CL_DrawTracers = CL_DrawTracers,
|
||||||
|
.CL_DrawBeams = CL_DrawBeams,
|
||||||
|
.R_BeamCull = R_BeamCull,
|
||||||
|
|
||||||
|
.RefGetParm = RefGetParm,
|
||||||
|
.GetDetailScaleForTexture = GetDetailScaleForTexture,
|
||||||
|
.GetExtraParmsForTexture = GetExtraParmsForTexture,
|
||||||
|
.GetFrameTime = GetFrameTime,
|
||||||
|
|
||||||
|
.R_SetCurrentEntity = R_SetCurrentEntity,
|
||||||
|
.R_SetCurrentModel = R_SetCurrentModel,
|
||||||
|
|
||||||
|
.GL_FindTexture = GL_FindTexture,
|
||||||
|
.GL_TextureName = GL_TextureName,
|
||||||
|
.GL_TextureData = GL_TextureData,
|
||||||
|
.GL_LoadTexture = GL_LoadTexture,
|
||||||
|
.GL_CreateTexture = GL_CreateTexture,
|
||||||
|
.GL_LoadTextureArray = GL_LoadTextureArray,
|
||||||
|
.GL_CreateTextureArray = GL_CreateTextureArray,
|
||||||
|
.GL_FreeTexture = R_SimpleStubUInt,
|
||||||
|
|
||||||
|
.DrawSingleDecal = DrawSingleDecal,
|
||||||
|
.R_DecalSetupVerts = R_DecalSetupVerts,
|
||||||
|
.R_EntityRemoveDecals = R_EntityRemoveDecals,
|
||||||
|
|
||||||
|
.AVI_UploadRawFrame = AVI_UploadRawFrame,
|
||||||
|
|
||||||
|
.GL_Bind = GL_Bind,
|
||||||
|
.GL_SelectTexture = R_SimpleStubInt,
|
||||||
|
.GL_LoadTextureMatrix = GL_LoadTextureMatrix,
|
||||||
|
.GL_TexMatrixIdentity = R_SimpleStub,
|
||||||
|
.GL_CleanUpTextureUnits = R_SimpleStubInt,
|
||||||
|
.GL_TexGen = GL_TexGen,
|
||||||
|
.GL_TextureTarget = R_SimpleStubUInt,
|
||||||
|
.GL_TexCoordArrayMode = R_SimpleStubUInt,
|
||||||
|
.GL_UpdateTexSize = GL_UpdateTexSize,
|
||||||
|
.GL_Reserved0 = NULL,
|
||||||
|
.GL_Reserved1 = NULL,
|
||||||
|
|
||||||
|
.GL_DrawParticles = GL_DrawParticles,
|
||||||
|
.LightVec = LightVec,
|
||||||
|
.StudioGetTexture = StudioGetTexture,
|
||||||
|
|
||||||
|
.GL_RenderFrame = GL_RenderFrame,
|
||||||
|
.GL_OrthoBounds = GL_OrthoBounds,
|
||||||
|
.R_SpeedsMessage = R_SpeedsMessage,
|
||||||
|
.Mod_GetCurrentVis = Mod_GetCurrentVis,
|
||||||
|
.R_NewMap = R_SimpleStub,
|
||||||
|
.R_ClearScene = R_SimpleStub,
|
||||||
|
.R_GetProcAddress = R_GetProcAddress,
|
||||||
|
|
||||||
|
.TriRenderMode = R_SimpleStubInt,
|
||||||
|
.Begin = R_SimpleStubInt,
|
||||||
|
.End = R_SimpleStub,
|
||||||
|
.Color4f = Color4f,
|
||||||
|
.Color4ub = Color4ub,
|
||||||
|
.TexCoord2f = TexCoord2f,
|
||||||
|
.Vertex3fv = Vertex3fv,
|
||||||
|
.Vertex3f = Vertex3f,
|
||||||
|
.Fog = Fog,
|
||||||
|
.ScreenToWorld = ScreenToWorld,
|
||||||
|
.GetMatrix = GetMatrix,
|
||||||
|
.FogParams = FogParams,
|
||||||
|
.CullFace = CullFace,
|
||||||
|
|
||||||
|
.VGUI_DrawInit = R_SimpleStub,
|
||||||
|
.VGUI_DrawShutdown = R_SimpleStub,
|
||||||
|
.VGUI_SetupDrawingText = VGUI_SetupDrawing,
|
||||||
|
.VGUI_SetupDrawingRect = VGUI_SetupDrawing,
|
||||||
|
.VGUI_SetupDrawingImage = VGUI_SetupDrawing,
|
||||||
|
.VGUI_BindTexture = R_SimpleStubInt,
|
||||||
|
.VGUI_EnableTexture = VGUI_EnableTexture,
|
||||||
|
.VGUI_CreateTexture = VGUI_CreateTexture,
|
||||||
|
.VGUI_UploadTexture = VGUI_UploadTexture,
|
||||||
|
.VGUI_UploadTextureBlock = VGUI_UploadTextureBlock,
|
||||||
|
.VGUI_DrawQuad = VGUI_DrawQuad,
|
||||||
|
.VGUI_GetTextureSizes = VGUI_GetTextureSizes,
|
||||||
|
.VGUI_GenerateTexture = VGUI_GenerateTexture,
|
||||||
|
};
|
||||||
|
|
||||||
|
int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals );
|
||||||
|
int EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals )
|
||||||
|
{
|
||||||
|
if( version != REF_API_VERSION )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// fill in our callbacks
|
||||||
|
memcpy( funcs, &gReffuncs, sizeof( ref_interface_t ));
|
||||||
|
memcpy( &gEngfuncs, engfuncs, sizeof( ref_api_t ));
|
||||||
|
gpGlobals = globals;
|
||||||
|
|
||||||
|
return REF_API_VERSION;
|
||||||
|
}
|
||||||
20
ref/null/wscript
Normal file
20
ref/null/wscript
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
# encoding: utf-8
|
||||||
|
# mittorn, 2018
|
||||||
|
|
||||||
|
def options(opt):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def configure(conf):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def build(bld):
|
||||||
|
bld.shlib(
|
||||||
|
source = 'r_context.c',
|
||||||
|
target = 'ref_null',
|
||||||
|
features = 'c',
|
||||||
|
defines = 'REF_DLL',
|
||||||
|
use = 'engine_includes sdk_includes werror',
|
||||||
|
install_path = bld.env.LIBDIR,
|
||||||
|
subsystem = bld.env.MSVC_SUBSYSTEM
|
||||||
|
)
|
||||||
@@ -22,7 +22,7 @@ def configure(conf):
|
|||||||
conf.env.append_unique('DEFINES', 'REF_DLL')
|
conf.env.append_unique('DEFINES', 'REF_DLL')
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
libs = [ 'engine_includes' ]
|
libs = [ 'engine_includes', 'werror' ]
|
||||||
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
# on PSVita do not link any libraries that are already in the main executable, but add the includes target
|
||||||
if bld.env.DEST_OS == 'psvita':
|
if bld.env.DEST_OS == 'psvita':
|
||||||
libs += [ 'sdk_includes' ]
|
libs += [ 'sdk_includes' ]
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def build(bld):
|
|||||||
target = 'mdldec',
|
target = 'mdldec',
|
||||||
features = 'c cprogram',
|
features = 'c cprogram',
|
||||||
includes = '.',
|
includes = '.',
|
||||||
use = 'engine_includes public M',
|
use = 'engine_includes public M werror',
|
||||||
install_path = bld.env.BINDIR,
|
install_path = bld.env.BINDIR,
|
||||||
subsystem = bld.env.CONSOLE_SUBSYSTEM
|
subsystem = bld.env.CONSOLE_SUBSYSTEM
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,14 +18,13 @@ def configure(conf):
|
|||||||
def add_runner_target(bld, lib, func):
|
def add_runner_target(bld, lib, func):
|
||||||
source = bld.path.ant_glob('*.c')
|
source = bld.path.ant_glob('*.c')
|
||||||
includes = '.'
|
includes = '.'
|
||||||
libs = [ 'DL' ]
|
|
||||||
|
|
||||||
bld(
|
bld(
|
||||||
source = source,
|
source = source,
|
||||||
target = 'run-fuzzer-' + func,
|
target = 'run-fuzzer-' + func,
|
||||||
features = 'c cprogram',
|
features = 'c cprogram',
|
||||||
includes = includes,
|
includes = includes,
|
||||||
use = libs,
|
use = 'DL werror',
|
||||||
defines = ['FUNC="Fuzz_' + func + '"', 'LIB="' + lib + '"'],
|
defines = ['FUNC="Fuzz_' + func + '"', 'LIB="' + lib + '"'],
|
||||||
install_path = bld.env.BINDIR,
|
install_path = bld.env.BINDIR,
|
||||||
subsystem = bld.env.CONSOLE_SUBSYSTEM
|
subsystem = bld.env.CONSOLE_SUBSYSTEM
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def build(bld):
|
|||||||
target = 'xar',
|
target = 'xar',
|
||||||
features = 'c cprogram',
|
features = 'c cprogram',
|
||||||
includes = '.',
|
includes = '.',
|
||||||
use = 'public filesystem_includes',
|
use = 'public filesystem_includes werror',
|
||||||
rpath = bld.env.DEFAULT_RPATH,
|
rpath = bld.env.DEFAULT_RPATH,
|
||||||
install_path = bld.env.BINDIR,
|
install_path = bld.env.BINDIR,
|
||||||
subsystem = bld.env.CONSOLE_SUBSYSTEM
|
subsystem = bld.env.CONSOLE_SUBSYSTEM
|
||||||
|
|||||||
19
wscript
19
wscript
@@ -75,6 +75,7 @@ SUBDIRS = [
|
|||||||
Subproject('3rdparty/gl4es', lambda x: not x.env.DEDICATED and x.env.GL4ES),
|
Subproject('3rdparty/gl4es', lambda x: not x.env.DEDICATED and x.env.GL4ES),
|
||||||
Subproject('ref/gl', lambda x: not x.env.DEDICATED and (x.env.GL or x.env.NANOGL or x.env.GLWES or x.env.GL4ES)),
|
Subproject('ref/gl', lambda x: not x.env.DEDICATED and (x.env.GL or x.env.NANOGL or x.env.GLWES or x.env.GL4ES)),
|
||||||
Subproject('ref/soft', lambda x: not x.env.DEDICATED and not x.env.SUPPORT_BSP2_FORMAT and x.env.SOFT),
|
Subproject('ref/soft', lambda x: not x.env.DEDICATED and not x.env.SUPPORT_BSP2_FORMAT and x.env.SOFT),
|
||||||
|
Subproject('ref/null', lambda x: not x.env.DEDICATED and x.env.NULL),
|
||||||
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
|
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
|
||||||
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
|
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
|
||||||
Subproject('stub/client', lambda x: not x.env.DEDICATED),
|
Subproject('stub/client', lambda x: not x.env.DEDICATED),
|
||||||
@@ -100,6 +101,7 @@ REFDLLS = [
|
|||||||
RefDll('gles2', False, 'GLWES'),
|
RefDll('gles2', False, 'GLWES'),
|
||||||
RefDll('gl4es', False),
|
RefDll('gl4es', False),
|
||||||
RefDll('gles3compat', False),
|
RefDll('gles3compat', False),
|
||||||
|
RefDll('null', False),
|
||||||
]
|
]
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
@@ -340,11 +342,8 @@ def configure(conf):
|
|||||||
|
|
||||||
opt_cxxflags = [] # TODO:
|
opt_cxxflags = [] # TODO:
|
||||||
|
|
||||||
cflags = conf.filter_cflags(opt_flags + opt_cflags, cflags)
|
conf.env.CFLAGS_werror = conf.filter_cflags(opt_flags + opt_cflags, cflags)
|
||||||
cxxflags = conf.filter_cxxflags(opt_flags + opt_cxxflags, cxxflags)
|
conf.env.CXXFLAGS_werror = conf.filter_cxxflags(opt_flags + opt_cxxflags, cxxflags)
|
||||||
|
|
||||||
conf.env.append_unique('CFLAGS', cflags)
|
|
||||||
conf.env.append_unique('CXXFLAGS', cxxflags)
|
|
||||||
|
|
||||||
conf.env.TESTS = conf.options.TESTS
|
conf.env.TESTS = conf.options.TESTS
|
||||||
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
|
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
|
||||||
@@ -425,7 +424,7 @@ def configure(conf):
|
|||||||
tgmath_usable = conf.check_cc(fragment='''#include<tgmath.h>
|
tgmath_usable = conf.check_cc(fragment='''#include<tgmath.h>
|
||||||
const float val = 2, val2 = 3;
|
const float val = 2, val2 = 3;
|
||||||
int main(void){ return (int)(-asin(val) + cos(val2)); }''',
|
int main(void){ return (int)(-asin(val) + cos(val2)); }''',
|
||||||
msg='Checking if tgmath.h is usable', mandatory=False, use='M')
|
msg='Checking if tgmath.h is usable', mandatory=False, use='M werror')
|
||||||
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
|
conf.define_cond('HAVE_TGMATH_H', tgmath_usable)
|
||||||
else:
|
else:
|
||||||
conf.undefine('HAVE_TGMATH_H')
|
conf.undefine('HAVE_TGMATH_H')
|
||||||
@@ -443,7 +442,7 @@ def configure(conf):
|
|||||||
int t2[(((64 * GB -1) % 671088649) == 268434537)
|
int t2[(((64 * GB -1) % 671088649) == 268434537)
|
||||||
&& (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
|
&& (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
|
||||||
int main(void) { return 0; }''',
|
int main(void) { return 0; }''',
|
||||||
msg='Checking if _FILE_OFFSET_BITS can be defined to 64', mandatory=False)
|
msg='Checking if _FILE_OFFSET_BITS can be defined to 64', mandatory=False, use='werror')
|
||||||
if file_offset_bits_usable:
|
if file_offset_bits_usable:
|
||||||
conf.define('_FILE_OFFSET_BITS', 64)
|
conf.define('_FILE_OFFSET_BITS', 64)
|
||||||
else: conf.undefine('_FILE_OFFSET_BITS')
|
else: conf.undefine('_FILE_OFFSET_BITS')
|
||||||
@@ -455,9 +454,9 @@ int main(int argc, char **argv) { strcasestr(argv[1], argv[2]); return 0; }'''
|
|||||||
int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
|
int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
|
||||||
|
|
||||||
def check_gnu_function(frag, msg, define):
|
def check_gnu_function(frag, msg, define):
|
||||||
if conf.check_cc(msg=msg, mandatory=False, fragment=frag):
|
if conf.check_cc(msg=msg, mandatory=False, fragment=frag, use='werror'):
|
||||||
conf.define(define, 1)
|
conf.define(define, 1)
|
||||||
elif conf.check_cc(msg='... with _GNU_SOURCE?', mandatory=False, fragment=frag, defines='_GNU_SOURCE=1'):
|
elif conf.check_cc(msg='... with _GNU_SOURCE?', mandatory=False, fragment=frag, defines='_GNU_SOURCE=1', use='werror'):
|
||||||
conf.define(define, 1)
|
conf.define(define, 1)
|
||||||
conf.define('_GNU_SOURCE', 1)
|
conf.define('_GNU_SOURCE', 1)
|
||||||
check_gnu_function(strcasestr_frag, 'Checking for strcasestr', 'HAVE_STRCASESTR')
|
check_gnu_function(strcasestr_frag, 'Checking for strcasestr', 'HAVE_STRCASESTR')
|
||||||
@@ -484,7 +483,7 @@ int main(int argc, char **argv) { strchrnul(argv[1], 'x'); return 0; }'''
|
|||||||
frag='''#include <opus_custom.h>
|
frag='''#include <opus_custom.h>
|
||||||
int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''
|
int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''
|
||||||
|
|
||||||
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=False):
|
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus werror', fragment=frag, mandatory=False):
|
||||||
conf.env.HAVE_SYSTEM_OPUS = True
|
conf.env.HAVE_SYSTEM_OPUS = True
|
||||||
|
|
||||||
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
|
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
|
||||||
|
|||||||
Reference in New Issue
Block a user